]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Removed VMI setting which caused pages > 1 to be shifted down for some reason. Looks...
authorJeremias Maerki <jeremias@apache.org>
Thu, 25 May 2006 11:20:48 +0000 (11:20 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 25 May 2006 11:20:48 +0000 (11:20 +0000)
Implemented the break out list for fixed block-containers.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@409362 13f79535-47bb-0310-9956-ffa450edef68

src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java

index 0f3751a6431962b4087b01f7a19439b824a5cf26..01c2bde73d60fec7d93c839db0de30d538fd4589 100644 (file)
@@ -315,6 +315,8 @@ public class PCLRenderer extends PrintRenderer {
         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 @@ public class PCLRenderer extends PrintRenderer {
     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 @@ public class PCLRenderer extends PrintRenderer {
         }
         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 @@ public class PCLRenderer extends PrintRenderer {
             //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 @@ public class PCLRenderer extends PrintRenderer {
             endVParea();
 
             if (breakOutList != null) {
-                //restoreStateStackAfterBreakOut(breakOutList);
+                restoreStateStackAfterBreakOut(breakOutList);
             }
             
             currentIPPosition = saveIP;
@@ -837,6 +837,24 @@ public class PCLRenderer extends PrintRenderer {
         //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);
+        }
+    }
+
     /**
      * @see org.apache.fop.render.AbstractRenderer#renderImage(Image, Rectangle2D)
      */