Author: jeremias
Date: Thu Apr 16 09:35:11 2009
New Revision: 765539

URL: http://svn.apache.org/viewvc?rev=765539&view=rev
Log:
Bugfix: Previous simplification requires keeping track of whether we are in a 
marked content sequence.
Removed unused variable accessEnabled in PDFContentGenerator.

Modified:
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
    
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java?rev=765539&r1=765538&r2=765539&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java
 Thu Apr 16 09:35:11 2009
@@ -50,13 +50,13 @@
 
     /** 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 @@
      * @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 @@
         };
 
         this.currentState = new PDFPaintingState();
-        this.accessEnabled = accessibilityEnabled;
     }
 
     /**
@@ -173,6 +171,7 @@
      * @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 @@
             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 @@
     protected void restoreGraphicsStateAccess() {
         endTextObject();
         currentStream.add("Q\n");
-        endMarkedContentSequence();
+        if (this.inMarkedContentSequence) {
+            endMarkedContentSequence();
+        }
         currentState.restore();
     }
 
@@ -265,7 +268,9 @@
     /** Indicates the end of a text object. */
     protected void endTextObject() {
         if (textutil.isInTextObject()) {
-            endMarkedContentSequence();
+            if (this.inMarkedContentSequence) {
+                endMarkedContentSequence();
+            }
             textutil.endTextObject();
         }
     }

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java?rev=765539&r1=765538&r2=765539&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
 Thu Apr 16 09:35:11 2009
@@ -372,7 +372,7 @@
         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);

Modified: 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java?rev=765539&r1=765538&r2=765539&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFRenderer.java
 Thu Apr 16 09:35:11 2009
@@ -461,8 +461,7 @@
         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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to