Skip to content

Commit

Permalink
PDFPainter updated for transparency text processing, metanorma/metano…
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Aug 19, 2022
1 parent 5b0d989 commit cb706b2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/apache/fop/render/pdf/PDFPainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,12 @@ private void drawTextWithDX(int x, int y, String text, FontTriplet triplet,

double shear = 0;
boolean simulateStyle = tf instanceof CustomFont && ((CustomFont) tf).getSimulateStyle();
if (simulateStyle) {

boolean isTransparent = state.getTextColor().getAlpha() == 0;

if (isTransparent) {
textutil.setTextRenderingMode(PDFTextUtil.TR_INVISIBLE); // set transparent mode '3 Tr'
} else if (simulateStyle) {
if (triplet.getWeight() == 700) {
generator.add("q\n");
generator.add("2 Tr 0.31543 w\n");
Expand Down Expand Up @@ -528,7 +533,9 @@ private void drawTextWithDX(int x, int y, String text, FontTriplet triplet,

}
textutil.writeTJ();
if (simulateStyle && triplet.getWeight() == 700) {
if (isTransparent) {
textutil.setTextRenderingMode(PDFTextUtil.TR_FILL); //restore default mode
} else if (simulateStyle && triplet.getWeight() == 700) {
generator.add("Q\n");
}
}
Expand Down

0 comments on commit cb706b2

Please sign in to comment.