aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-09-22 08:30:21 +0000
committerFinn Bock <bckfnn@apache.org>2004-09-22 08:30:21 +0000
commitec112b9794f6f424aa44e9c859fca495dedc77c7 (patch)
tree1bcf059202edb56b12523be70ef83ff9bfb427e4 /src/java/org/apache/fop/render
parentdb54754167ef28ce8ca2962a732d362501e165ce (diff)
downloadxmlgraphics-fop-ec112b9794f6f424aa44e9c859fca495dedc77c7.tar.gz
xmlgraphics-fop-ec112b9794f6f424aa44e9c859fca495dedc77c7.zip
Use content ipd/bpd instead of allocation width/height.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197959 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/AbstractRenderer.java20
-rw-r--r--src/java/org/apache/fop/render/awt/AWTRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java71
-rw-r--r--src/java/org/apache/fop/render/ps/PSRenderer.java18
-rw-r--r--src/java/org/apache/fop/render/svg/SVGRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/xml/XMLRenderer.java11
6 files changed, 76 insertions, 48 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java
index b7fe955ba..48d46b6b7 100644
--- a/src/java/org/apache/fop/render/AbstractRenderer.java
+++ b/src/java/org/apache/fop/render/AbstractRenderer.java
@@ -457,7 +457,7 @@ public abstract class AbstractRenderer
renderBlocks(bv, children);
currentIPPosition = saveIP;
- currentBPPosition = saveBP + bv.getHeight();
+ currentBPPosition = saveBP + bv.getAllocBPD();
}
}
@@ -491,7 +491,7 @@ public abstract class AbstractRenderer
currentBlockIPPosition =
currentIPPosition + line.getStartIndent();
renderLineArea(line);
- currentBPPosition += line.getHeight();
+ currentBPPosition += line.getAllocBPD();
}
}
}
@@ -506,7 +506,7 @@ public abstract class AbstractRenderer
if (children == null) {
handleBlockTraits(block);
// simply move position
- currentBPPosition += block.getHeight();
+ currentBPPosition += block.getAllocBPD();
} else if (block instanceof BlockViewport) {
renderBlockViewport((BlockViewport) block, children);
} else {
@@ -534,7 +534,7 @@ public abstract class AbstractRenderer
renderBlocks(block, children);
// stacked and relative blocks effect stacking
- currentBPPosition = saveBP + block.getHeight();
+ currentBPPosition = saveBP + block.getAllocBPD();
}
currentIPPosition = saveIP;
}
@@ -576,7 +576,7 @@ public abstract class AbstractRenderer
/** @see org.apache.fop.render.Renderer */
protected void renderCharacter(Character ch) {
- currentBlockIPPosition += ch.getWidth();
+ currentBlockIPPosition += ch.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
@@ -585,17 +585,17 @@ 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.getWidth();
+ currentBlockIPPosition += space.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
protected void renderLeader(Leader area) {
- currentBlockIPPosition += area.getWidth();
+ currentBlockIPPosition += area.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
protected void renderText(TextArea text) {
- currentBlockIPPosition += text.getWidth();
+ currentBlockIPPosition += text.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
@@ -605,7 +605,7 @@ public abstract class AbstractRenderer
while (iter.hasNext()) {
renderInlineArea((InlineArea) iter.next());
}
- currentBlockIPPosition = saveIP + ip.getWidth();
+ currentBlockIPPosition = saveIP + ip.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
@@ -621,7 +621,7 @@ public abstract class AbstractRenderer
} else if (content instanceof ForeignObject) {
renderForeignObject((ForeignObject) content, contpos);
}
- currentBlockIPPosition += viewport.getWidth();
+ currentBlockIPPosition += viewport.getAllocIPD();
currentBPPosition = saveBP;
}
diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java
index 7af9216ce..23fce2b3e 100644
--- a/src/java/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java
@@ -459,7 +459,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
graphics.drawString(s, 220, 200);
// TODO: render text decorations
- currentBlockIPPosition += text.getWidth();
+ currentBlockIPPosition += text.getAllocIPD();
}
/** @see org.apache.fop.render.AbstractRenderer */
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index 38ebf4fd6..73407c088 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -541,20 +541,49 @@ public class PDFRenderer extends PrintRenderer {
float startx = (currentIPPosition + ipMarginOffset) / 1000f;
float starty = (currentBPPosition + bpMarginOffset) / 1000f;
- float width = block.getWidth() / 1000f;
+ float width = block.getIPD() / 1000f;
+ float height = block.getBPD() / 1000f;
Integer spaceStart = (Integer) block.getTrait(Trait.SPACE_START);
if (spaceStart != null) {
startx += spaceStart.floatValue() / 1000;
- width -= spaceStart.floatValue() / 1000;
}
- Integer spaceEnd = (Integer) block.getTrait(Trait.SPACE_END);
- if (spaceEnd != null) {
- width -= spaceEnd.floatValue() / 1000;
+ BorderProps borderStart = (BorderProps) block.getTrait(Trait.BORDER_START);
+ if (borderStart != null) {
+ width += borderStart.width / 1000f;
+ }
+ Integer paddingStart = (Integer) block.getTrait(Trait.PADDING_START);
+ if (paddingStart != null) {
+ width += paddingStart.intValue() / 1000f;
+ }
+ BorderProps borderEnd = (BorderProps) block.getTrait(Trait.BORDER_END);
+ if (borderEnd != null) {
+ width += borderEnd.width / 1000f;
+ }
+ Integer paddingEnd = (Integer) block.getTrait(Trait.PADDING_END);
+ if (paddingEnd != null) {
+ width += paddingEnd.intValue() / 1000f;
+ }
+
+ BorderProps borderBefore = (BorderProps) block.getTrait(Trait.BORDER_BEFORE);
+ if (borderBefore != null) {
+ height += borderBefore.width / 1000f;
+ }
+ Integer paddingBefore = (Integer) block.getTrait(Trait.PADDING_BEFORE);
+ if (paddingBefore != null) {
+ height += paddingBefore.intValue() / 1000f;
+ }
+ BorderProps borderAfter = (BorderProps) block.getTrait(Trait.BORDER_AFTER);
+ if (borderAfter != null) {
+ height += borderAfter.width / 1000f;
+ }
+ Integer paddingAfter = (Integer) block.getTrait(Trait.PADDING_AFTER);
+ if (paddingAfter != null) {
+ height += paddingAfter.intValue() / 1000f;
}
drawBackAndBorders(block, startx, starty,
- width, block.getHeight() / 1000f);
+ width, height);
}
/**
@@ -740,8 +769,8 @@ public class PDFRenderer extends PrintRenderer {
float x = (float)(bv.getXOffset() + containingIPPosition) / 1000f;
float y = (float)(bv.getYOffset() + containingBPPosition) / 1000f;
- float width = (float)bv.getWidth() / 1000f;
- float height = (float)bv.getHeight() / 1000f;
+ float width = (float)bv.getIPD() / 1000f;
+ float height = (float)bv.getBPD() / 1000f;
drawBackAndBorders(bv, x, y, width, height);
@@ -776,11 +805,11 @@ public class PDFRenderer extends PrintRenderer {
double[] vals = ctm.toArray();
//boolean aclock = vals[2] == 1.0;
if (vals[2] == 1.0) {
- ctm = ctm.translate(-saveBP - bv.getHeight(), -saveIP);
+ ctm = ctm.translate(-saveBP - bv.getBPD(), -saveIP);
} else if (vals[0] == -1.0) {
- ctm = ctm.translate(-saveIP - bv.getWidth(), -saveBP - bv.getHeight());
+ ctm = ctm.translate(-saveIP - bv.getIPD(), -saveBP - bv.getBPD());
} else {
- ctm = ctm.translate(saveBP, saveIP - bv.getWidth());
+ ctm = ctm.translate(saveBP, saveIP - bv.getIPD());
}
}
@@ -792,8 +821,8 @@ public class PDFRenderer extends PrintRenderer {
saveGraphicsState();
float x = (float)bv.getXOffset() / 1000f;
float y = (float)bv.getYOffset() / 1000f;
- float width = (float)bv.getWidth() / 1000f;
- float height = (float)bv.getHeight() / 1000f;
+ float width = (float)bv.getIPD() / 1000f;
+ float height = (float)bv.getBPD() / 1000f;
clip(x, y, width, height);
}
@@ -821,7 +850,7 @@ public class PDFRenderer extends PrintRenderer {
currentIPPosition = saveIP;
currentBPPosition = saveBP;
- currentBPPosition += (int)(bv.getHeight());
+ currentBPPosition += (int)(bv.getAllocBPD());
}
currentFontName = saveFontName;
}
@@ -862,8 +891,8 @@ public class PDFRenderer extends PrintRenderer {
public void renderInlineParent(InlineParent ip) {
float start = (currentBlockIPPosition + ipMarginOffset) / 1000f;
float top = (ip.getOffset() + currentBPPosition + bpMarginOffset) / 1000f;
- float width = ip.getWidth() / 1000f;
- float height = ip.getHeight() / 1000f;
+ float width = ip.getIPD() / 1000f;
+ float height = ip.getBPD() / 1000f;
drawBackAndBorders(ip, start, top, width, height);
// render contents
@@ -956,7 +985,7 @@ public class PDFRenderer extends PrintRenderer {
+ (ch.getTextWordSpaceAdjust() / 1000f) + " Tw [" + startText);
textOpen = true;
}
- prevWordWidth = ch.getWidth();
+ prevWordWidth = ch.getIPD();
prevWordX = rx;
String s = ch.getChar();
@@ -1027,7 +1056,7 @@ public class PDFRenderer extends PrintRenderer {
+ (text.getTextWordSpaceAdjust() / 1000f) + " Tw [" + startText);
textOpen = true;
}
- prevWordWidth = text.getWidth();
+ prevWordWidth = text.getIPD();
prevWordX = rx;
String s = text.getTextArea();
@@ -1314,8 +1343,8 @@ public class PDFRenderer extends PrintRenderer {
float x = currentBlockIPPosition / 1000f;
float y = (currentBPPosition + viewport.getOffset()) / 1000f;
- float width = viewport.getWidth() / 1000f;
- float height = viewport.getHeight() / 1000f;
+ float width = viewport.getIPD() / 1000f;
+ float height = viewport.getBPD() / 1000f;
drawBackAndBorders(viewport, x, y, width, height);
endTextObject();
@@ -1362,7 +1391,7 @@ public class PDFRenderer extends PrintRenderer {
}
float startx = ((float) currentBlockIPPosition) / 1000f;
float starty = ((currentBPPosition + area.getOffset()) / 1000f);
- float endx = (currentBlockIPPosition + area.getWidth()) / 1000f;
+ float endx = (currentBlockIPPosition + area.getIPD()) / 1000f;
if (!alt) {
currentStream.add(area.getRuleThickness() / 1000f + " w\n");
drawLine(startx, starty, endx, starty);
diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java
index 904a1183c..4d5cd074b 100644
--- a/src/java/org/apache/fop/render/ps/PSRenderer.java
+++ b/src/java/org/apache/fop/render/ps/PSRenderer.java
@@ -522,8 +522,8 @@ public class PSRenderer extends AbstractRenderer {
saveGraphicsState();
int x = bv.getXOffset() + containingIPPosition;
int y = bv.getYOffset() + containingBPPosition;
- int width = bv.getWidth();
- int height = bv.getHeight();
+ int width = bv.getIPD();
+ int height = bv.getBPD();
clip(x, y, width, height);
}
@@ -556,11 +556,11 @@ public class PSRenderer extends AbstractRenderer {
double[] vals = ctm.toArray();
//boolean aclock = vals[2] == 1.0;
if (vals[2] == 1.0) {
- ctm = ctm.translate(-saveBP - bv.getHeight(), -saveIP);
+ ctm = ctm.translate(-saveBP - bv.getBPD(), -saveIP);
} else if (vals[0] == -1.0) {
- ctm = ctm.translate(-saveIP - bv.getWidth(), -saveBP - bv.getHeight());
+ ctm = ctm.translate(-saveIP - bv.getIPD(), -saveBP - bv.getBPD());
} else {
- ctm = ctm.translate(saveBP, saveIP - bv.getWidth());
+ ctm = ctm.translate(saveBP, saveIP - bv.getIPD());
}
}
@@ -573,8 +573,8 @@ public class PSRenderer extends AbstractRenderer {
saveGraphicsState();
int x = bv.getXOffset();
int y = bv.getYOffset();
- int width = bv.getWidth();
- int height = bv.getHeight();
+ int width = bv.getIPD();
+ int height = bv.getBPD();
clip(x, y, width, height);
}
@@ -599,7 +599,7 @@ public class PSRenderer extends AbstractRenderer {
currentIPPosition = saveIP;
currentBPPosition = saveBP;
- currentBPPosition += (int)(bv.getHeight());
+ currentBPPosition += (int)(bv.getAllocBPD());
}
currentFontName = saveFontName;
}
@@ -663,7 +663,7 @@ public class PSRenderer extends AbstractRenderer {
float startx = currentIPPosition;
float starty = currentBPPosition;
drawBackAndBorders(block, startx, starty,
- block.getWidth(), block.getHeight());
+ block.getIPD(), block.getBPD());
}
/**
diff --git a/src/java/org/apache/fop/render/svg/SVGRenderer.java b/src/java/org/apache/fop/render/svg/SVGRenderer.java
index 55c34dd1a..b10c6b902 100644
--- a/src/java/org/apache/fop/render/svg/SVGRenderer.java
+++ b/src/java/org/apache/fop/render/svg/SVGRenderer.java
@@ -380,7 +380,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
currentBlockIPPosition / 1000,
(currentBPPosition + area.getOffset()
- area.getRuleThickness() / 2) / 1000,
- (currentBlockIPPosition + area.getWidth()) / 1000,
+ (currentBlockIPPosition + area.getIPD()) / 1000,
(currentBPPosition + area.getOffset()
- area.getRuleThickness() / 2) / 1000);
line.setAttributeNS(null, "style", style);
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java
index 5d8212384..c38cf47e2 100644
--- a/src/java/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java
@@ -331,9 +331,8 @@ public class XMLRenderer extends AbstractRenderer {
* @see org.apache.fop.render.AbstractRenderer#renderBlock(Block)
*/
protected void renderBlock(Block block) {
- String prop = " width=\"" + block.getWidth() +
- "\" ipd=\"" + block.getIPD() +
- "\" height=\"" + block.getHeight() + "\"";
+ String prop = " ipd=\"" + block.getIPD() +
+ "\" bpd=\"" + block.getBPD() + "\"";
Map map = block.getTraits();
if (map != null) {
prop = prop + " props=\"" + getPropString(map) + "\"";
@@ -352,7 +351,7 @@ public class XMLRenderer extends AbstractRenderer {
if (map != null) {
prop = " props=\"" + getPropString(map) + "\"";
}
- writeStartTag("<lineArea height=\"" + line.getHeight() + "\""
+ writeStartTag("<lineArea bpd=\"" + line.getBPD() + "\""
+ prop + ">");
super.renderLineArea(line);
writeEndTag("</lineArea>");
@@ -414,7 +413,7 @@ public class XMLRenderer extends AbstractRenderer {
* @see org.apache.fop.render.Renderer#renderInlineSpace(Space)
*/
protected void renderInlineSpace(Space space) {
- writeElement("<space width=\"" + space.getWidth() + "\"/>");
+ writeElement("<space ipd=\"" + space.getIPD() + "\"/>");
}
/**
@@ -470,7 +469,7 @@ public class XMLRenderer extends AbstractRenderer {
style = "ridge";
break;
}
- writeElement("<leader width=\"" + area.getWidth()
+ writeElement("<leader ipd=\"" + area.getIPD()
+ "\" ruleStyle=\"" + style
+ "\" ruleThickness=\"" + area.getRuleThickness()
+ "\"/>");