You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Rainer Garus <ra...@nexgo.de> on 2001/09/02 20:10:42 UTC

[Patch] fo:leader with start indent

If start-indent <> 0 the computed value of the remaining width of a line area is not correct, because the value of getContentWidth contains start-indent and end-indent. I have changed the public method getRemainingWidth in LineArea.java but only tested with the following fo-file.

Rainer Garus



<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
         xmlns:svg="http://www.w3.org/2000/svg"
         font-family="Courier"
         font-size="10pt">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="one"
                           page-height="297mm"
                           page-width="210mm">
      <fo:region-body/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-name="one">
    <fo:flow flow-name="xsl-region-body">

<!-- Test 1 -->
<fo:block start-indent="0cm" end-indent="0cm">
start-indent = 0 cm, end-indent = 0 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 2 -->
<fo:block start-indent="1.9cm" end-indent="0cm">
start-indent = 2 cm, end-indent = 0 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 3 -->
<fo:block start-indent="4cm" end-indent="0cm">
start-indent = 4 cm, end-indent = 0 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 4 -->
<fo:block start-indent="0cm" end-indent="2cm">
start-indent = 0 cm, end-indent = 2 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 5 -->
<fo:block start-indent="0cm" end-indent="4cm">
start-indent = 0 cm, end-indent = 4 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 6 -->
<fo:block start-indent="2cm" end-indent="2cm">
start-indent = 2 cm, end-indent = 2 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 7 -->
<fo:block start-indent="4cm" end-indent="2cm">
start-indent = 4 cm, end-indent = 2 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 8 -->
<fo:block start-indent="2cm" end-indent="4cm">
start-indent = 2 cm, end-indent = 4 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

<!-- Test 9 -->
<fo:block start-indent="4cm" end-indent="4cm">
start-indent = 4 cm, end-indent = 4 cm
    <fo:leader leader-pattern="dots"
               leader-pattern-width="8pt"
               leader-alignment="reference-area"
               leader-length.maximum="21cm"/>
</fo:block>

    </fo:flow>
  </fo:page-sequence>
</fo:root>






--- Fop-0.20.1/src/org/apache/fop/layout/LineArea.java	Mon Aug 13 23:28:29 2001
+++ Fop-0.20.1/build/src/org/apache/fop/layout/LineArea.java	Sun Sep  2 18:39:01 2001
@@ -507,8 +507,7 @@
         int whitespaceWidth =
             currentFontState.width(currentFontState.mapChar(whitespaceIndex));
 
-        int remainingWidth = this.getContentWidth()
-                             - this.getCurrentXPosition();
+        int remainingWidth = this.getRemainingWidth();
 
         /**
          * checks whether leaderLenghtOptimum fits into rest of line;
@@ -1008,7 +1007,7 @@
     }
 
     public int getRemainingWidth() {
-        return this.getContentWidth() - this.getCurrentXPosition();
+        return this.getContentWidth() + startIndent - this.getCurrentXPosition();
     }
 
     public void setLinkSet(LinkSet ls) {}
@@ -1031,8 +1030,7 @@
      */
     public int addCharacter(char data, LinkSet ls, boolean ul) {
         WordArea ia = null;
-        int remainingWidth = this.getContentWidth()
-                             - this.getCurrentXPosition();
+        int remainingWidth = this.getRemainingWidth();
         int width =
             this.currentFontState.width(currentFontState.mapChar(data));
         // if it doesn't fit, return