gmazza 2004/04/24 21:45:28 Modified: src/java/org/apache/fop/area/inline TextArea.java src/java/org/apache/fop/fo FObj.java src/java/org/apache/fop/layoutmgr AddLMVisitor.java BlockLayoutManager.java TextLayoutManager.java src/java/org/apache/fop/render/pdf PDFRenderer.java src/java/org/apache/fop/render/xml XMLRenderer.java Log: 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.) Revision Changes Path 1.4 +6 -6 xml-fop/src/java/org/apache/fop/area/inline/TextArea.java Index: TextArea.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/TextArea.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TextArea.java 27 Feb 2004 17:40:58 -0000 1.3 +++ TextArea.java 25 Apr 2004 04:45:27 -0000 1.4 @@ -27,7 +27,7 @@ * 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 @@ * * @return the text space adjustment */ - public int getTSadjust() { - return iTSadjust; + public int getTextSpaceAdjust() { + return iTextSpaceAdjust; } /** @@ -67,8 +67,8 @@ * * @param iTSadjust the text space adjustment */ - public void setTSadjust(int iTSadjust) { - this.iTSadjust = iTSadjust; + public void setTextSpaceAdjust(int iTSadjust) { + iTextSpaceAdjust = iTSadjust; } } 1.37 +7 -4 xml-fop/src/java/org/apache/fop/fo/FObj.java Index: FObj.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- FObj.java 27 Feb 2004 17:57:40 -0000 1.36 +++ FObj.java 25 Apr 2004 04:45:28 -0000 1.37 @@ -448,12 +448,15 @@ 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; } - +*/ } 1.39 +2 -6 xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java Index: AddLMVisitor.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- AddLMVisitor.java 22 Apr 2004 21:56:09 -0000 1.38 +++ AddLMVisitor.java 25 Apr 2004 04:45:28 -0000 1.39 @@ -282,11 +282,7 @@ } 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); } 1.16 +24 -21 xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Index: BlockLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- BlockLayoutManager.java 21 Mar 2004 12:03:07 -0000 1.15 +++ BlockLayoutManager.java 25 Apr 2004 04:45:28 -0000 1.16 @@ -28,6 +28,7 @@ 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 @@ 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 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 @@ // 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; 1.15 +1 -1 xml-fop/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java Index: TextLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- TextLayoutManager.java 4 Apr 2004 06:29:44 -0000 1.14 +++ TextLayoutManager.java 25 Apr 2004 04:45:28 -0000 1.15 @@ -499,7 +499,7 @@ 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; 1.42 +7 -6 xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java Index: PDFRenderer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- PDFRenderer.java 24 Apr 2004 05:15:35 -0000 1.41 +++ PDFRenderer.java 25 Apr 2004 04:45:28 -0000 1.42 @@ -939,11 +939,12 @@ // 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 @@ 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(); 1.20 +1 -1 xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java Index: XMLRenderer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- XMLRenderer.java 22 Apr 2004 21:38:41 -0000 1.19 +++ XMLRenderer.java 25 Apr 2004 04:45:28 -0000 1.20 @@ -426,7 +426,7 @@ if (map != null) { prop = " props=\"" + getPropString(map) + "\""; } - writeElement("<text tsadjust=\"" + text.getTSadjust() + "\"" + writeElement("<text tsadjust=\"" + text.getTextSpaceAdjust() + "\"" + prop + ">" + text.getTextArea() + "</text>"); super.renderText(text); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]