diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfGraphics2D.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfGraphics2D.java index 99472adbb..2ecbe520a 100755 --- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfGraphics2D.java +++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfGraphics2D.java @@ -193,8 +193,8 @@ public class PdfGraphics2D extends Graphics2D { private final CompositeFontDrawer compositeFontDrawer = new CompositeFontDrawer(); - // make use of compositeFontDrawer configurable ... note: must be explicitly set to false otherwise always true (backwards compatibility). - private final boolean isCompositeFontDrawerEnabled = SystemPropertyUtil.getBoolean("com.github.librepdf.openpdf.compositeFontDrawerEnabled", true); + // make use of compositeFontDrawer configurable ... may be set via property or directly via setter + private boolean isCompositeFontDrawerEnabled = SystemPropertyUtil.getBoolean("com.github.librepdf.openpdf.compositeFontDrawerEnabled", true); private PdfGraphics2D() { dg2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); @@ -1377,8 +1377,15 @@ private void internalDispose(ByteBuffer buf) { // implementation specific methods // // - - + + /** + * Enables/Disables the composite font drawer due to issues with custom font mappers that do not always default to one specific font but allow custom fonts. + * @param compositeFontDrawerEnabled true if the composite font drawer should be used else false. + */ + public void setCompositeFontDrawerEnabled(boolean compositeFontDrawerEnabled) { + isCompositeFontDrawerEnabled = compositeFontDrawerEnabled; + } + private void followPath(Shape s, int drawType) { if (s==null) return; if (drawType==STROKE) {