You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2006/05/25 13:20:50 UTC

svn commit: r409362 - /xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java

Author: jeremias
Date: Thu May 25 04:20:48 2006
New Revision: 409362

URL: http://svn.apache.org/viewvc?rev=409362&view=rev
Log:
Removed VMI setting which caused pages > 1 to be shifted down for some reason. Looks like the VMI setting has no influence for the PCL Renderer since we reposition the cursor for each text string.
Implemented the break out list for fixed block-containers.

Modified:
    xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java

Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java?rev=409362&r1=409361&r2=409362&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java Thu May 25 04:20:48 2006
@@ -315,6 +315,8 @@
         gen.writeText("@PJL SET RESOLUTION = " + getResolution() + "\n");
         gen.writeText("@PJL ENTER LANGUAGE = PCL\n");
         gen.resetPrinter();
+        gen.setUnitOfMeasure(getResolution());
+        gen.setRasterGraphicsResolution(getResolution());
     }
 
     /** @see org.apache.fop.render.Renderer#stopRenderer() */
@@ -357,6 +359,7 @@
     private void selectPageFormat(long pagewidth, long pageheight) throws IOException {
         this.currentPageDefinition = PCLPageDefinition.getPageDefinition(
                 pagewidth, pageheight, 1000);
+        
         if (this.currentPageDefinition == null) {
             this.currentPageDefinition = PCLPageDefinition.getDefaultPageDefinition();
             log.warn("Paper type could not be determined. Falling back to: " 
@@ -364,18 +367,15 @@
         }
         log.debug("page size: " + currentPageDefinition.getPhysicalPageSize());
         log.debug("logical page: " + currentPageDefinition.getLogicalPageRect());
-        gen.selectPageSize(this.currentPageDefinition.getSelector());
-        
         if (this.currentPageDefinition.isLandscapeFormat()) {
             gen.writeCommand("&l1O"); //Orientation
         } else {
             gen.writeCommand("&l0O"); //Orientation
         }
+        gen.selectPageSize(this.currentPageDefinition.getSelector());
+        
         gen.clearHorizontalMargins();
         gen.setTopMargin(0);
-        gen.setVMI(0);
-        gen.setUnitOfMeasure(getResolution());
-        gen.setRasterGraphicsResolution(getResolution());
     }
 
     /** Saves the current graphics state on the stack. */
@@ -761,7 +761,7 @@
             //after the block-container has been painted. See below.
             List breakOutList = null;
             if (bv.getPositioning() == Block.FIXED) {
-                //breakOutList = breakOutOfStateStack();
+                breakOutList = breakOutOfStateStack();
             }
             
             CTM tempctm = new CTM(containingIPPosition, containingBPPosition);
@@ -796,7 +796,7 @@
             endVParea();
 
             if (breakOutList != null) {
-                //restoreStateStackAfterBreakOut(breakOutList);
+                restoreStateStackAfterBreakOut(breakOutList);
             }
             
             currentIPPosition = saveIP;
@@ -835,6 +835,24 @@
             currentBPPosition += (int)(bv.getAllocBPD());
         }
         //currentFontName = saveFontName;
+    }
+
+    private List breakOutOfStateStack() {
+        log.debug("Block.FIXED --> break out");
+        List breakOutList = new java.util.ArrayList();
+        while (!this.graphicContextStack.empty()) {
+            breakOutList.add(0, this.graphicContext);
+            restoreGraphicsState();
+        }
+        return breakOutList;
+    }
+
+    private void restoreStateStackAfterBreakOut(List breakOutList) {
+        log.debug("Block.FIXED --> restoring context after break-out");
+        for (int i = 0, c = breakOutList.size(); i < c; i++) {
+            saveGraphicsState();
+            this.graphicContext = (GraphicContext)breakOutList.get(i);
+        }
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org