aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-04-25 04:45:28 +0000
committerGlen Mazza <gmazza@apache.org>2004-04-25 04:45:28 +0000
commit333a1dc61ccb85e4a68f484c8cb2e6b8aa734a67 (patch)
tree7a4349e7f8489ce445f88d8901441db387c5c738 /src/java/org/apache/fop
parent89b2a81f40aaa909bba0194f7418567f44d5c6c3 (diff)
downloadxmlgraphics-fop-333a1dc61ccb85e4a68f484c8cb2e6b8aa734a67.tar.gz
xmlgraphics-fop-333a1dc61ccb85e4a68f484c8cb2e6b8aa734a67.zip
For area.Blocks created in BlockLayoutManager.getParentArea(), I set the
width of the Block to that of its parent block. This fixes a layout problem where <fo:table-cell><fo:block border-bottom="1pt solid black">some text</ ></ > was causing a line to draw across the entire page, because the cell width present in fo:table-cell's Block was not copied into the inner fo:block's Block. (This problem did not occur if the border-bottom attribute was set in fo:table-cell.) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197539 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/area/inline/TextArea.java10
-rw-r--r--src/java/org/apache/fop/fo/FObj.java11
-rw-r--r--src/java/org/apache/fop/layoutmgr/AddLMVisitor.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java45
-rw-r--r--src/java/org/apache/fop/layoutmgr/TextLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java13
-rw-r--r--src/java/org/apache/fop/render/xml/XMLRenderer.java2
7 files changed, 46 insertions, 43 deletions
diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/java/org/apache/fop/area/inline/TextArea.java
index 077769a1d..110eaa03f 100644
--- a/src/java/org/apache/fop/area/inline/TextArea.java
+++ b/src/java/org/apache/fop/area/inline/TextArea.java
@@ -27,7 +27,7 @@ public class TextArea extends InlineArea {
* The text for this inline area
*/
protected String text;
- private int iTSadjust = 0;
+ private int iTextSpaceAdjust = 0;
/**
* Create a text inline area
@@ -58,8 +58,8 @@ public class TextArea extends InlineArea {
*
* @return the text space adjustment
*/
- public int getTSadjust() {
- return iTSadjust;
+ public int getTextSpaceAdjust() {
+ return iTextSpaceAdjust;
}
/**
@@ -67,8 +67,8 @@ public class TextArea extends InlineArea {
*
* @param iTSadjust the text space adjustment
*/
- public void setTSadjust(int iTSadjust) {
- this.iTSadjust = iTSadjust;
+ public void setTextSpaceAdjust(int iTSadjust) {
+ iTextSpaceAdjust = iTSadjust;
}
}
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 8a66a2f7d..db2bc953d 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -448,12 +448,15 @@ public class FObj extends FONode implements Constants {
fotv.serveFObj(this);
}
- /**
- * Return a string representation of the fo element.
+
+ /*
+ * Return a string representation of the fo element.
+ * Deactivated in order to see precise ID of each fo element created
+ * (helpful for debugging)
*/
- public String toString() {
+/* public String toString() {
return getName() + " at line " + line + ":" + column;
}
-
+*/
}
diff --git a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
index c180a7e95..990dbafe6 100644
--- a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
+++ b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
@@ -282,11 +282,7 @@ public class AddLMVisitor implements FOTreeVisitor {
}
public void serveBlock(Block node) {
- BlockLayoutManager blm = new BlockLayoutManager();
- blm.setUserAgent(node.getUserAgent());
- blm.setFObj(node);
- TextInfo ti = node.getPropertyManager().getTextLayoutProps(node.getFOTreeControl());
- blm.setBlockTextInfo(ti);
+ BlockLayoutManager blm = new BlockLayoutManager(node);
currentLMList.add(blm);
}
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 490f731d4..3929fc4cb 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -28,6 +28,7 @@ import org.apache.fop.fo.TextInfo;
import org.apache.fop.fo.PropertyManager;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
+import org.apache.fop.area.BlockParent;
import org.apache.fop.area.LineArea;
import org.apache.fop.traits.LayoutProps;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
@@ -68,6 +69,20 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
protected List childBreaks = new java.util.ArrayList();
+ public BlockLayoutManager(org.apache.fop.fo.flow.Block inBlock) {
+ super.setFObj(inBlock);
+ childLMiter = new BlockLMiter(this, childLMiter);
+ userAgent = inBlock.getUserAgent();
+ setBlockTextInfo(inBlock.getPropertyManager().getTextLayoutProps(
+ inBlock.getFOTreeControl()));
+ }
+
+ private void setBlockTextInfo(TextInfo ti) {
+ lead = ti.fs.getAscender();
+ follow = -ti.fs.getDescender();
+ lineHeight = ti.lineHeight;
+ }
+
/**
* Iterator for Block layout.
* This iterator combines consecutive inline areas and
@@ -126,25 +141,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
}
- public BlockLayoutManager() {
- }
-
- /**
- * Set the FO object for this layout manager
- *
- * @param fo the fo for this layout manager
- */
- public void setFObj(FObj fo) {
- super.setFObj(fo);
- childLMiter = new BlockLMiter(this, childLMiter);
- }
-
- public void setBlockTextInfo(TextInfo ti) {
- lead = ti.fs.getAscender();
- follow = -ti.fs.getDescender();
- lineHeight = ti.lineHeight;
- }
-
/**
* This method provides a hook for a LayoutManager to intialize traits
* for the areas it will create, based on Properties set on its FO.
@@ -325,10 +321,17 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
// Set up dimensions
// Must get dimensions from parent area
Area parentArea = parentLM.getParentArea(curBlockArea);
+
+ // Get reference IPD from parentArea
int referenceIPD = parentArea.getIPD();
curBlockArea.setIPD(referenceIPD);
- curBlockArea.setWidth(referenceIPD);
- // Get reference IPD from parentArea
+
+ // Set the width of the block based on the parent block
+ if (parentArea instanceof BlockParent) {
+ curBlockArea.setWidth(((BlockParent) parentArea).getWidth());
+ } else {
+ curBlockArea.setWidth(referenceIPD);
+ }
setCurrentArea(curBlockArea); // ??? for generic operations
}
return curBlockArea;
diff --git a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
index ae6987258..f7badde2f 100644
--- a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
@@ -499,7 +499,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
if (iWScount > 0) {
//getLogger().error("Adjustment per word-space= " +
// iAdjust / iWScount);
- t.setTSadjust(iAdjust / iWScount);
+ t.setTextSpaceAdjust(iAdjust / iWScount);
//System.err.println("TextLayoutManager> word spaces= " + iWScount + " adjustment per word space= " + (iAdjust/iWScount));
}
word = t;
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index a5570351b..ed35a16fe 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -939,11 +939,12 @@ public class PDFRenderer extends PrintRenderer {
// where previous line area failed to take up entire allocated space
int rx = currentBlockIPPosition + ipMarginOffset;
int bl = currentBPPosition + bpMarginOffset + text.getOffset();
-/*
- System.out.println("\nBlockIP Position: " + currentBlockIPPosition +
+
+/* System.out.println("Text = " + text.getTextArea() +
+ "; text width: " + text.getWidth() +
+ "; BlockIP Position: " + currentBlockIPPosition +
"; currentBPPosition: " + currentBPPosition +
- "; offset: " + text.getOffset() +
- "; Text = " + text.getTextArea());
+ "; offset: " + text.getOffset());
*/
// Set letterSpacing
//float ls = fs.getLetterSpacing() / this.currentFontSize;
@@ -953,14 +954,14 @@ public class PDFRenderer extends PrintRenderer {
closeText();
pdf.append("1 0 0 -1 " + (rx / 1000f) + " " + (bl / 1000f) + " Tm "
- + (text.getTSadjust()/1000f) + " Tw [" + startText);
+ + (text.getTextSpaceAdjust()/1000f) + " Tw [" + startText);
prevWordY = bl;
textOpen = true;
} else {
closeText();
pdf.append("1 0 0 -1 " + (rx / 1000f) + " " + (bl / 1000f) + " Tm "
- + (text.getTSadjust()/1000f) + " Tw [" + startText);
+ + (text.getTextSpaceAdjust()/1000f) + " Tw [" + startText);
textOpen = true;
}
prevWordWidth = text.getWidth();
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java
index c50bf4398..c3b7340c4 100644
--- a/src/java/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java
@@ -426,7 +426,7 @@ public class XMLRenderer extends AbstractRenderer {
if (map != null) {
prop = " props=\"" + getPropString(map) + "\"";
}
- writeElement("<text tsadjust=\"" + text.getTSadjust() + "\""
+ writeElement("<text tsadjust=\"" + text.getTextSpaceAdjust() + "\""
+ prop + ">" + text.getTextArea() + "</text>");
super.renderText(text);
}