Skip to content

Commit

Permalink
allow disabling/enabling of compositeFontDrawer programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
mppperez authored and asturio committed Aug 19, 2021
1 parent 30a71f3 commit fed5154
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions openpdf/src/main/java/com/lowagie/text/pdf/PdfGraphics2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fed5154

Please sign in to comment.