From 92b3c0695a48dd086ebf605881fcd44dbeeea9b0 Mon Sep 17 00:00:00 2001 From: arved Date: Wed, 27 Dec 2000 03:55:13 +0000 Subject: [PATCH] BodyAreaContainer code more in line with regular AreaContainers git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193927 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/pdf/PDFRenderer.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 615ca7784..275415462 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -301,7 +301,34 @@ public class PDFRenderer implements Renderer { } public void renderBodyAreaContainer(BodyAreaContainer area) { - renderAreaContainer(area.getBeforeFloatReferenceArea()); + int saveY = this.currentYPosition; + int saveX = this.currentAreaContainerXPosition; + + if (area.getPosition() == Position.ABSOLUTE) { + // Y position is computed assuming positive Y axis, adjust for negative postscript one + this.currentYPosition = area.getYPosition(); + this.currentAreaContainerXPosition = area.getXPosition(); + } else if (area.getPosition() == Position.RELATIVE) { + this.currentYPosition -= area.getYPosition(); + this.currentAreaContainerXPosition += area.getXPosition(); + } + + this.currentXPosition = this.currentAreaContainerXPosition; + int w, h; + int rx = this.currentAreaContainerXPosition; + w = area.getContentWidth(); + h = area.getContentHeight(); + int ry = this.currentYPosition; + ColorType bg = area.getBackgroundColor(); + + // I'm not sure I should have to check for bg being null + // but I do + if ((bg != null) && (bg.alpha() == 0)) { + this.addRect(rx, ry, w, -h, new PDFColor(bg), new PDFColor(bg)); + } + + // floats & footnotes stuff + renderAreaContainer(area.getBeforeFloatReferenceArea()); renderAreaContainer(area.getFootnoteReferenceArea()); // main reference area @@ -310,6 +337,13 @@ public class PDFRenderer implements Renderer { Box b = (Box) e.nextElement(); b.render(this); // span areas } + + if (area.getPosition() != Position.STATIC) { + this.currentYPosition = saveY; + this.currentAreaContainerXPosition = saveX; + } else + this.currentYPosition -= area.getHeight(); + } public void renderSpanArea(SpanArea area) { -- 2.39.5