diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-01-17 10:38:02 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-01-17 10:38:02 +0000 |
commit | bb9e6ae01aadf341fc0afd50a4fd1ce7fac9ac29 (patch) | |
tree | 8200c2b9d74f2e8acd6f75f0b7d3a04ac790441f /src/java/org/apache/fop/render | |
parent | b82d35988890de566b9848cd57aadafb845c0666 (diff) | |
download | xmlgraphics-fop-bb9e6ae01aadf341fc0afd50a4fd1ce7fac9ac29.tar.gz xmlgraphics-fop-bb9e6ae01aadf341fc0afd50a4fd1ce7fac9ac29.zip |
block-containers improved/fixed. The following features are implemented and testcases exist:
left, right, top, bottom, width, height, block-progression-dimension (partial), inline-progression-dimension (partial), borders, padding, indents, reference-orientation.
autoheight works only for in-flow BCs ATM.
start-indent calculation fixed: uses inherited value if rules in 5.3.2 don't apply.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198272 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r-- | src/java/org/apache/fop/render/AbstractRenderer.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pdf/PDFRenderer.java | 52 |
2 files changed, 38 insertions, 16 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index ccad31883..25db6080b 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -466,7 +466,7 @@ public abstract class AbstractRenderer int saveBP = currentBPPosition; // Calculate the position of the content rectangle. - if (parent != null) { + if (parent != null && !Boolean.TRUE.equals(parent.getTrait(Trait.IS_VIEWPORT_AREA))) { currentBPPosition += parent.getBorderAndPaddingWidthBefore(); /* This is unnecessary now as we're going to use the *-indent traits currentIPPosition += parent.getBorderAndPaddingWidthStart(); diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 223ebdd81..01c21e8b9 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -675,6 +675,11 @@ public class PDFRenderer extends PrintRenderer { String saveFontName = currentFontName; CTM ctm = bv.getCTM(); + int borderPaddingStart = bv.getBorderAndPaddingWidthStart(); + int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore(); + float x,y; + x = (float)(bv.getXOffset() + containingIPPosition) / 1000f; + y = (float)(bv.getYOffset() + containingBPPosition) / 1000f; if (bv.getPositioning() == Block.ABSOLUTE || bv.getPositioning() == Block.FIXED) { @@ -684,28 +689,30 @@ public class PDFRenderer extends PrintRenderer { ctm = tempctm.multiply(ctm); getLogger().debug("tempctm=" + tempctm + " ctm=" + ctm); - float x,y; - x = (float)(bv.getXOffset() + containingIPPosition) / 1000f; - y = (float)(bv.getYOffset() + containingBPPosition) / 1000f; + //This is the content-rect float width = (float)bv.getIPD() / 1000f; float height = (float)bv.getBPD() / 1000f; getLogger().debug("renderBlockViewport: x=" + x + " y=" + y + " width=" + width + " height=" + height); - int borderPaddingStart = bv.getBorderAndPaddingWidthStart(); - int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore(); - + //Adjust for spaces (from margin or indirectly by start-indent etc. Integer spaceStart = (Integer) bv.getTrait(Trait.SPACE_START); if (spaceStart != null) { x += spaceStart.floatValue() / 1000; } + Integer spaceBefore = (Integer) bv.getTrait(Trait.SPACE_BEFORE); + if (spaceBefore != null) { + y += spaceBefore.floatValue() / 1000; + } - width += borderPaddingStart / 1000f; - width += bv.getBorderAndPaddingWidthEnd() / 1000f; - height += borderPaddingBefore / 1000f; - height += bv.getBorderAndPaddingWidthAfter() / 1000f; + float bpwidth = (borderPaddingStart + bv.getBorderAndPaddingWidthEnd()) / 1000f; + float bpheight = (borderPaddingBefore + bv.getBorderAndPaddingWidthAfter()) / 1000f; - drawBackAndBorders(bv, x, y, width, height); + drawBackAndBorders(bv, x, y, width + bpwidth, height + bpheight); + //Now adjust for border/padding + x += borderPaddingStart / 1000f; + y += borderPaddingBefore / 1000f; + if (bv.getClip()) { saveGraphicsState(); clip(x, y, width, height); @@ -729,6 +736,17 @@ public class PDFRenderer extends PrintRenderer { currentBPPosition = saveBP; } else { + Integer spaceBefore = (Integer)bv.getTrait(Trait.SPACE_BEFORE); + if (spaceBefore != null) { + currentBPPosition += spaceBefore.intValue(); + } + + //borders and background in the old coordinate system + handleBlockTraits(bv); + + CTM tempctm = new CTM(containingIPPosition, currentBPPosition + containingBPPosition); + ctm = tempctm.multiply(ctm); + /* if (ctm != null) { double[] vals = ctm.toArray(); //boolean aclock = vals[2] == 1.0; @@ -737,21 +755,25 @@ public class PDFRenderer extends PrintRenderer { } else if (vals[0] == -1.0) { ctm = ctm.translate(-saveIP - bv.getIPD(), -saveBP - bv.getBPD()); } else { - ctm = ctm.translate(saveBP, saveIP - bv.getIPD()); + //ctm = ctm.translate(saveBP, saveIP - bv.getIPD()); + //ctm = ctm.translate(saveIP, saveBP); } } + ctm = new CTM().translate(saveIP, saveBP).multiply(ctm); + */ + + //Now adjust for border/padding + x += borderPaddingStart / 1000f; + y += borderPaddingBefore / 1000f; // clip if necessary if (bv.getClip()) { saveGraphicsState(); - float x = (float)bv.getXOffset() / 1000f; - float y = (float)bv.getYOffset() / 1000f; float width = (float)bv.getIPD() / 1000f; float height = (float)bv.getBPD() / 1000f; clip(x, y, width, height); } - handleBlockTraits(bv); if (ctm != null) { startVParea(ctm); currentIPPosition = 0; |