Skip to content

Commit

Permalink
Merge pull request #210 from HannesWell/fix-export-branding
Browse files Browse the repository at this point in the history
Fix potential NPEs during export branding and fix Extension example
  • Loading branch information
NiklasRentzCAU authored Oct 21, 2024
2 parents f8ce58e + 9420a41 commit 44d08e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
* <pre>
* {@code
* <extension
* point="de.cau.cs.kieler.klighd.piccolo.exportHooks">
* <exportHook
* class="de.cau.cs.kieler.klighd.piccolo.export.AuthorConfidentialExportHook"
* point="de.cau.cs.kieler.klighd.extensions">
* <exportBranding
* class="de.cau.cs.kieler.klighd.piccolo.export.AuthorConfidentialExportBranding"
* id="de.cau.cs.kieler.klighd.piccolo.export.AuthorConfidentialExportHook"
* supportedFormats="bmp, jpeg, png, pdf, printout">
* </exportHook>
* </exportBranding>
* </extension>}
* </pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public IStatus export(final KlighdCanvas canvas, final ExportData data) {
final TilingData tilingInfo = data.tilingInfo();

final Trim trim = getMaximumDiagramTrim(brandings, bounds);
final Trim tileTrimScaled = getMaximumDiagramTileTrim(brandings);
final Trim tileTrimScaled = getMaximumDiagramTileTrim(brandings, bounds, null, null);

// determine the employed image's size
final double width = data.scale() * (bounds.getWidth() + trim.getWidth());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public FontData getFontData() {
protected static final HashMap<FontData, Font> FONT_CACHE = new HashMap<FontData, Font>();

private boolean cacheFonts = true;
private List<org.eclipse.swt.graphics.Font> temporaryFonts = null;
private final List<Font> temporaryFonts = new ArrayList<>();


/**
Expand Down Expand Up @@ -486,9 +486,6 @@ public void setFont(final FontData fontData, final int maxLineWidth) {
curFont = font;

} else {
if (temporaryFonts == null) {
temporaryFonts = new ArrayList<>();
}
curFont = new org.eclipse.swt.graphics.Font(
fontCreationDevice != null ? fontCreationDevice : device, fontData);
temporaryFonts.add(curFont);
Expand Down

0 comments on commit 44d08e1

Please sign in to comment.