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
* The text for this inline area
*/
protected String text;
- private int iTSadjust = 0;
+ private int iTextSpaceAdjust = 0;
/**
* Create a text inline area
*
* @return the text space adjustment
*/
- public int getTSadjust() {
- return iTSadjust;
+ public int getTextSpaceAdjust() {
+ return iTextSpaceAdjust;
}
/**
*
* @param iTSadjust the text space adjustment
*/
- public void setTSadjust(int iTSadjust) {
- this.iTSadjust = iTSadjust;
+ public void setTextSpaceAdjust(int iTSadjust) {
+ iTextSpaceAdjust = iTSadjust;
}
}
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;
}
-
+*/
}
}
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);
}
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;
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
}
}
- 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.
// 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;
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;
// 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;
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();
if (map != null) {
prop = " props=\"" + getPropString(map) + "\"";
}
- writeElement("<text tsadjust=\"" + text.getTSadjust() + "\""
+ writeElement("<text tsadjust=\"" + text.getTextSpaceAdjust() + "\""
+ prop + ">" + text.getTextArea() + "</text>");
super.renderText(text);
}