diff options
author | Glenn Adams <gadams@apache.org> | 2012-05-25 20:02:21 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2012-05-25 20:02:21 +0000 |
commit | 47789800746b09c46b7369d9d8122b40531494e0 (patch) | |
tree | 71b8cec5543d08620b0bfd5ec0b768f596dc85f8 /src | |
parent | b14cfce3f812f97852d88db7b837b55b0c55c625 (diff) | |
download | xmlgraphics-fop-47789800746b09c46b7369d9d8122b40531494e0.tar.gz xmlgraphics-fop-47789800746b09c46b7369d9d8122b40531494e0.zip |
Bugzilla #53294: Fix invalid PostScript file being created when font-size is 0. Submitted by Robert Meyer.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1342792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSPainter.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSPainter.java b/src/java/org/apache/fop/render/ps/PSPainter.java index 370472457..9bed2a432 100644 --- a/src/java/org/apache/fop/render/ps/PSPainter.java +++ b/src/java/org/apache/fop/render/ps/PSPainter.java @@ -74,10 +74,14 @@ public class PSPainter extends AbstractIFPainter { * @param documentHandler the parent document handler */ public PSPainter(PSDocumentHandler documentHandler) { + this(documentHandler, IFState.create()); + } + + protected PSPainter(PSDocumentHandler documentHandler, IFState state) { super(); this.documentHandler = documentHandler; this.borderPainter = new PSBorderPainter(documentHandler.gen); - this.state = IFState.create(); + this.state = state; } /** {@inheritDoc} */ @@ -346,6 +350,10 @@ public class PSPainter extends AbstractIFPainter { public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[][] dp, String text) throws IFException { try { + //Do not draw text if font-size is 0 as it creates an invalid PostScript file + if (state.getFontSize() == 0) { + return; + } PSGenerator generator = getGenerator(); generator.useColor(state.getTextColor()); beginTextObject(); |