]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Gets rid of currentBlockIPPosition. Use currentIPPosition instead and
authorFinn Bock <bckfnn@apache.org>
Wed, 22 Sep 2004 13:12:38 +0000 (13:12 +0000)
committerFinn Bock <bckfnn@apache.org>
Wed, 22 Sep 2004 13:12:38 +0000 (13:12 +0000)
restore it after each block-level area.

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

src/java/org/apache/fop/render/AbstractRenderer.java
src/java/org/apache/fop/render/awt/AWTRenderer.java
src/java/org/apache/fop/render/pdf/PDFRenderer.java
src/java/org/apache/fop/render/ps/PSRenderer.java
src/java/org/apache/fop/render/svg/SVGRenderer.java

index 48d46b6b7cddb62ea3c702c1a62e9f84fd52390a..cc340fc70cd04f01e475dc1a5497c30ba8fccf3a 100644 (file)
@@ -97,11 +97,6 @@ public abstract class AbstractRenderer
      */
     protected int currentIPPosition = 0;
 
-    /**
-     * current inline progression position in block
-     */
-    protected int currentBlockIPPosition = 0;
-
     /**
      * the block progression position of the containing block used for
      * absolutely positioned blocks
@@ -264,7 +259,6 @@ public abstract class AbstractRenderer
             // set origin for the region to 0,0.
             currentBPPosition = 0;
             currentIPPosition = 0;
-            currentBlockIPPosition = currentIPPosition;
 
             RegionReference region = port.getRegion();
             handleRegionTraits(port);
@@ -469,6 +463,8 @@ public abstract class AbstractRenderer
      * @param blocks  The block areas
      */
     protected void renderBlocks(Block parent, List blocks) {
+        int saveIP = currentIPPosition;
+        
         // the position of the containing block is used for
         // absolutely positioned areas
         int contBP = currentBPPosition;
@@ -479,6 +475,7 @@ public abstract class AbstractRenderer
         for (int count = 0; count < blocks.size(); count++) {
             Object obj = blocks.get(count);
             if (obj instanceof Block) {
+                currentIPPosition = saveIP;
                 containingBPPosition = contBP;
                 containingIPPosition = contIP;
                 renderBlock((Block) obj);
@@ -488,11 +485,11 @@ public abstract class AbstractRenderer
                 // a line area is rendered from the top left position
                 // of the line, each inline object is offset from there
                 LineArea line = (LineArea) obj;
-                currentBlockIPPosition =
-                        currentIPPosition + line.getStartIndent();
+                currentIPPosition = saveIP + line.getStartIndent();
                 renderLineArea(line);
                 currentBPPosition += line.getAllocBPD();
             }
+            currentIPPosition = saveIP;
         }
     }
 
@@ -534,9 +531,9 @@ public abstract class AbstractRenderer
                 renderBlocks(block, children);
 
                 // stacked and relative blocks effect stacking
+                currentIPPosition = saveIP;
                 currentBPPosition = saveBP + block.getAllocBPD();
             }
-            currentIPPosition = saveIP;
         }
     }
 
@@ -576,7 +573,7 @@ public abstract class AbstractRenderer
 
     /** @see org.apache.fop.render.Renderer */
     protected void renderCharacter(Character ch) {
-        currentBlockIPPosition += ch.getAllocIPD();
+        currentIPPosition += ch.getAllocIPD();
     }
 
     /** @see org.apache.fop.render.Renderer */
@@ -585,27 +582,27 @@ public abstract class AbstractRenderer
         // for the current block by the width or height of the space
         // it may also have styling (only on this object) that needs
         // handling
-        currentBlockIPPosition += space.getAllocIPD();
+        currentIPPosition += space.getAllocIPD();
     }
 
     /** @see org.apache.fop.render.Renderer */
     protected void renderLeader(Leader area) {
-        currentBlockIPPosition += area.getAllocIPD();
+        currentIPPosition += area.getAllocIPD();
     }
 
     /** @see org.apache.fop.render.Renderer */
     protected void renderText(TextArea text) {
-        currentBlockIPPosition += text.getAllocIPD();
+        currentIPPosition += text.getAllocIPD();
     }
 
     /** @see org.apache.fop.render.Renderer */
     protected void renderInlineParent(InlineParent ip) {
-        int saveIP = currentBlockIPPosition;
+        int saveIP = currentIPPosition;
         Iterator iter = ip.getChildAreas().iterator();
         while (iter.hasNext()) {
             renderInlineArea((InlineArea) iter.next()); 
         }
-        currentBlockIPPosition = saveIP + ip.getAllocIPD();
+        currentIPPosition = saveIP + ip.getAllocIPD();
     }
 
     /** @see org.apache.fop.render.Renderer */
@@ -621,7 +618,7 @@ public abstract class AbstractRenderer
         } else if (content instanceof ForeignObject) {
             renderForeignObject((ForeignObject) content, contpos);
         }
-        currentBlockIPPosition += viewport.getAllocIPD();
+        currentIPPosition += viewport.getAllocIPD();
         currentBPPosition = saveBP;
     }
 
@@ -640,14 +637,11 @@ public abstract class AbstractRenderer
     /** @see org.apache.fop.render.Renderer */
     public void renderContainer(Container cont) {
         int saveIP = currentIPPosition;
-        currentIPPosition = currentBlockIPPosition;
-        int saveBlockIP = currentBlockIPPosition;
         int saveBP = currentBPPosition;
 
         List blocks = cont.getBlocks();
         renderBlocks(null, blocks);
         currentIPPosition = saveIP;
-        currentBlockIPPosition = saveBlockIP;
         currentBPPosition = saveBP;
     }
 
index 23fce2b3e2f63cc7ffda165a852e1939cb2752ae..e6ce03acbe912cdd6bd1603a0fb2fdd627f32872 100644 (file)
@@ -448,7 +448,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
         graphics.setFont(new java.awt.Font("monospaced", java.awt.Font.PLAIN,
             10));
         
-        int rx = currentBlockIPPosition;
+        int rx = currentIPPosition;
         int bl = currentBPPosition + text.getOffset();
 
         int newx = (int) (rx + 500) / 1000;
@@ -459,7 +459,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
         graphics.drawString(s, 220, 200);
 
         // TODO: render text decorations
-        currentBlockIPPosition += text.getAllocIPD();
+        currentIPPosition += text.getAllocIPD();
     }
 
     /** @see org.apache.fop.render.AbstractRenderer */
index 73407c0883f4f6cb5bf0b88ed74a4b6e936dda6f..25e17b201e9401885026616bb30ce7687d77073e 100644 (file)
@@ -889,7 +889,7 @@ public class PDFRenderer extends PrintRenderer {
      * @param ip the inline parent area
      */
     public void renderInlineParent(InlineParent ip) {
-        float start = (currentBlockIPPosition + ipMarginOffset) / 1000f;
+        float start = (currentIPPosition + ipMarginOffset) / 1000f;
         float top = (ip.getOffset() + currentBPPosition + bpMarginOffset) / 1000f;
         float width = ip.getIPD() / 1000f;
         float height = ip.getBPD() / 1000f;
@@ -956,7 +956,7 @@ public class PDFRenderer extends PrintRenderer {
         // word.getOffset() = only height of text itself
         // currentBlockIPPosition: 0 for beginning of line; nonzero
         //  where previous line area failed to take up entire allocated space
-        int rx = currentBlockIPPosition + ipMarginOffset;
+        int rx = currentIPPosition + ipMarginOffset;
         int bl = currentBPPosition + bpMarginOffset + ch.getOffset();
 
 /*        System.out.println("Text = " + ch.getTextArea() +
@@ -1027,7 +1027,7 @@ public class PDFRenderer extends PrintRenderer {
         // word.getOffset() = only height of text itself
         // currentBlockIPPosition: 0 for beginning of line; nonzero
         //  where previous line area failed to take up entire allocated space
-        int rx = currentBlockIPPosition + ipMarginOffset;
+        int rx = currentIPPosition + ipMarginOffset;
         int bl = currentBPPosition + bpMarginOffset + text.getOffset();
 
 /*        System.out.println("Text = " + text.getTextArea() +
@@ -1283,7 +1283,7 @@ public class PDFRenderer extends PrintRenderer {
         saveGraphicsState();
         currentStream.add(((float) w) + " 0 0 "
                           + ((float) -h) + " "
-                          + (((float) currentBlockIPPosition + ipMarginOffset) / 1000f + x) + " "
+                          + (((float) currentIPPosition + ipMarginOffset) / 1000f + x) + " "
                           + (((float)(currentBPPosition + bpMarginOffset + 1000 * h)) / 1000f
                           + y) + " cm\n" + "/Im" + xobj + " Do\n");
         restoreGraphicsState();
@@ -1318,7 +1318,7 @@ public class PDFRenderer extends PrintRenderer {
         context.setProperty(PDFXMLHandler.PDF_CONTEXT, currentContext);
         context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
         context.setProperty(PDFXMLHandler.PDF_XPOS,
-                            new Integer(currentBlockIPPosition + (int) pos.getX()));
+                            new Integer(currentIPPosition + (int) pos.getX()));
         context.setProperty(PDFXMLHandler.PDF_YPOS,
                             new Integer(currentBPPosition + (int) pos.getY()));
         context.setProperty(PDFXMLHandler.PDF_FONT_INFO, fontInfo);
@@ -1341,7 +1341,7 @@ public class PDFRenderer extends PrintRenderer {
     public void renderViewport(Viewport viewport) {
         closeText();
 
-        float x = currentBlockIPPosition / 1000f;
+        float x = currentIPPosition / 1000f;
         float y = (currentBPPosition + viewport.getOffset()) / 1000f;
         float width = viewport.getIPD() / 1000f;
         float height = viewport.getBPD() / 1000f;
@@ -1389,9 +1389,9 @@ public class PDFRenderer extends PrintRenderer {
                 alt = true;
             break;
         }
-        float startx = ((float) currentBlockIPPosition) / 1000f;
+        float startx = ((float) currentIPPosition) / 1000f;
         float starty = ((currentBPPosition + area.getOffset()) / 1000f);
-        float endx = (currentBlockIPPosition + area.getIPD()) / 1000f;
+        float endx = (currentIPPosition + area.getIPD()) / 1000f;
         if (!alt) {
             currentStream.add(area.getRuleThickness() / 1000f + " w\n");
             drawLine(startx, starty, endx, starty);
index 4d5cd074b749a05552f844e38320d0fc8756abab..88d313f06933ef340d76d09e04bb4769b4b48d6b 100644 (file)
@@ -452,7 +452,7 @@ public class PSRenderer extends AbstractRenderer {
         Typeface f = (Typeface) fontInfo.getFonts().get(fontname);
 
         //Determine position
-        int rx = currentBlockIPPosition;
+        int rx = currentIPPosition;
         int bl = currentBPPosition + area.getOffset();
 
         useFont(fontname, fontsize);
@@ -830,7 +830,7 @@ public class PSRenderer extends AbstractRenderer {
         context.setProperty(PSXMLHandler.PS_HEIGHT,
                             new Integer((int) pos.getHeight()));
         context.setProperty(PSXMLHandler.PS_XPOS,
-                            new Integer(currentBlockIPPosition + (int) pos.getX()));
+                            new Integer(currentIPPosition + (int) pos.getX()));
         context.setProperty(PSXMLHandler.PS_YPOS,
                             new Integer(currentBPPosition + (int) pos.getY()));
         //context.setProperty("strokeSVGText", options.get("strokeSVGText"));
index b10c6b90201d6f6c057baa95bbd3509763438da0..8d3db34f39b52b0cd1ffdd7efebd1fa2d49485e7 100644 (file)
@@ -337,8 +337,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
             Element view = svgDocument.createElementNS(SVG_NAMESPACE, "svg");
             Node newsvg = svgDocument.importNode(svg, true);
             //view.setAttributeNS(null, "viewBox", "0 0 ");
-            view.setAttributeNS(null, "x",
-                                "" + currentBlockIPPosition / 1000f);
+            view.setAttributeNS(null, "x", "" + currentIPPosition / 1000f);
             view.setAttributeNS(null, "y", "" + currentBPPosition / 1000f);
 
             // this fixes a problem where the xmlns is repeated sometimes
@@ -377,10 +376,10 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
                 break;
         }
         Element line = SVGUtilities.createLine(svgDocument,
-                        currentBlockIPPosition / 1000,
+                        currentIPPosition / 1000,
                         (currentBPPosition + area.getOffset()
                             - area.getRuleThickness() / 2) / 1000,
-                        (currentBlockIPPosition + area.getIPD()) / 1000,
+                        (currentIPPosition + area.getIPD()) / 1000,
                         (currentBPPosition + area.getOffset()
                             - area.getRuleThickness() / 2) / 1000);
         line.setAttributeNS(null, "style", style);
@@ -394,7 +393,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
      */
     public void renderText(TextArea text) {
         Element textElement = SVGUtilities.createText(svgDocument,
-                                               currentBlockIPPosition / 1000,
+                                               currentIPPosition / 1000,
                                                (currentBPPosition + text.getOffset()) / 1000,
                                                text.getTextArea());
         currentPageG.appendChild(textElement);
@@ -407,7 +406,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
      */
     public void renderCharacter(org.apache.fop.area.inline.Character ch) {
         Element text = SVGUtilities.createText(svgDocument,
-                                               currentBlockIPPosition / 1000,
+                                               currentIPPosition / 1000,
                                                (currentBPPosition + ch.getOffset()) / 1000,
                                                "" + ch.getChar());
         currentPageG.appendChild(text);