From: Jeremias Maerki Date: Thu, 25 May 2006 11:20:48 +0000 (+0000) Subject: Removed VMI setting which caused pages > 1 to be shifted down for some reason. Looks... X-Git-Tag: fop-0_93~216 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b3ccc681bf2c13922bd0c9f7a3fa175f9c0cbb95;p=xmlgraphics-fop.git 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. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@409362 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java b/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java index 0f3751a64..01c2bde73 100644 --- a/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java +++ b/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java @@ -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) */