diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-04-16 09:35:11 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-04-16 09:35:11 +0000 |
commit | 0fc0d56d8b7b2685ee39c433e1b26d926114d6e7 (patch) | |
tree | 27dcd1d13cc9ea20db2ecb695ed76f00a3356f72 /src/java | |
parent | 75fde7d0214aa2c35ce1f4695ae631752ae659fd (diff) | |
download | xmlgraphics-fop-0fc0d56d8b7b2685ee39c433e1b26d926114d6e7.tar.gz xmlgraphics-fop-0fc0d56d8b7b2685ee39c433e1b26d926114d6e7.zip |
Bugfix: Previous simplification requires keeping track of whether we are in a marked content sequence.
Removed unused variable accessEnabled in PDFContentGenerator.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@765539 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
3 files changed, 13 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java index 5f9256e9e..73e1945f2 100644 --- a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java +++ b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java @@ -50,13 +50,13 @@ public class PDFContentGenerator { /** the current stream to add PDF commands to */ private PDFStream currentStream; - private boolean accessEnabled; // used for accessibility /** drawing state */ protected PDFPaintingState currentState = null; /** Text generation utility holding the current font status */ protected PDFTextUtil textutil; + private boolean inMarkedContentSequence; private boolean inArtifactMode; /** @@ -65,10 +65,9 @@ public class PDFContentGenerator { * @param document the PDF document * @param out the output stream the PDF document is generated to * @param resourceContext the resource context - * @param accessibilityEnabled indicating if accessibility is enabled or not */ public PDFContentGenerator(PDFDocument document, OutputStream out, - PDFResourceContext resourceContext, boolean accessibilityEnabled) { + PDFResourceContext resourceContext) { this.document = document; this.outputStream = out; this.resourceContext = resourceContext; @@ -81,7 +80,6 @@ public class PDFContentGenerator { }; this.currentState = new PDFPaintingState(); - this.accessEnabled = accessibilityEnabled; } /** @@ -173,6 +171,7 @@ public class PDFContentGenerator { * @param sequenceNum Sequence number */ protected void beginMarkedContentSequence(String structElemType, int sequenceNum) { + assert !this.inMarkedContentSequence; assert !this.inArtifactMode; if (structElemType != null) { currentStream.add(structElemType + " <</MCID " + String.valueOf(sequenceNum) + ">>\n" @@ -181,10 +180,12 @@ public class PDFContentGenerator { currentStream.add("/Artifact\nBMC\n"); this.inArtifactMode = true; } + this.inMarkedContentSequence = true; } private void endMarkedContentSequence() { currentStream.add("EMC\n"); + this.inMarkedContentSequence = false; this.inArtifactMode = false; } @@ -210,7 +211,9 @@ public class PDFContentGenerator { protected void restoreGraphicsStateAccess() { endTextObject(); currentStream.add("Q\n"); - endMarkedContentSequence(); + if (this.inMarkedContentSequence) { + endMarkedContentSequence(); + } currentState.restore(); } @@ -265,7 +268,9 @@ public class PDFContentGenerator { /** Indicates the end of a text object. */ protected void endTextObject() { if (textutil.isInTextObject()) { - endMarkedContentSequence(); + if (this.inMarkedContentSequence) { + endMarkedContentSequence(); + } textutil.endTextObject(); } } diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java index 0a975efc3..fea606f97 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java @@ -372,7 +372,7 @@ public class PDFDocumentHandler extends AbstractBinaryWritingIFDocumentHandler { this.pageReferences.put(new Integer(index), currentPageRef); this.generator = new PDFContentGenerator(this.pdfDoc, this.outputStream, - this.currentPage, this.accessEnabled); + this.currentPage); // Transform the PDF's default coordinate system (0,0 at lower left) to the PDFPainter's AffineTransform basicPageTransform = new AffineTransform(1, 0, 0, -1, 0, size.height / 1000f); diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 2c166f679..c40c94fc4 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -461,8 +461,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer implements PDFConf double h = bounds.getHeight(); pageHeight = (int) h; - this.generator = new PDFContentGenerator(this.pdfDoc, this.ostream, this.currentPage, - false); + this.generator = new PDFContentGenerator(this.pdfDoc, this.ostream, this.currentPage); this.borderPainter = new PDFBorderPainter(this.generator); // Transform the PDF's default coordinate system (0,0 at lower left) to the PDFRenderer's |