In the case of white-space-collapse=false in LineArea.AddText the position of
the line feed character is returned. So the next line starts at the position of
the line feed character (bug 1). All white space characters at the begin of a
line are handled as spaces (bug 2). Another bug is that lines with only white
space characters are suppressed. This is a problem in source code listings.

In the fo-file Test 1 - Test 4 and Test 9 are ok, but textdecoration
does not work as expected.

--------------------------------------------------------------------------------

--- Fop-0.19.0-CVS/src/org/apache/fop/layout/LineArea.java      Fri Jun 15 23:25:49 
2001
+++ LineArea.java       Thu Jun 28 21:42:01 2001
@@ -202,7 +202,16 @@
                             spaceWidth += whitespaceWidth;
                         } else if (c == '\n') {
                             // force line break
-                            return i;
+                            if (spaceWidth > 0) {
+                                  InlineSpace is = new InlineSpace(spaceWidth);
+                                  is.setUnderlined(textState.getUnderlined());
+                                  is.setOverlined(textState.getOverlined());
+                                  is.setLineThrough(textState.getLineThrough());
+                                  addChild(is);
+                                  finalWidth += spaceWidth;
+                                  spaceWidth = 0;
+                            }
+                            return i+1;
                         } else if (c == '\t') {
                             spaceWidth += 8 * whitespaceWidth;
                         }
@@ -308,7 +317,7 @@
                             WhiteSpaceCollapse.FALSE) {
                         if (c == '\n') {
                             // force a line break
-                            return i;
+                            return i+1;
                         } else if (c == '\t') {
                             spaceWidth = whitespaceWidth;
                         }
@@ -320,8 +329,19 @@
 
                     if (this.whiteSpaceCollapse ==
                             WhiteSpaceCollapse.FALSE) {
-                        prev = WHITESPACE;
-                        spaceWidth = whitespaceWidth;
+                        if (c == ' ') {
+                            prev = WHITESPACE;
+                            spaceWidth = whitespaceWidth;
+                        } else if (c == '\n') {
+                            // force line break
+                            // textdecoration not used because spaceWidth is 0
+                            InlineSpace is = new InlineSpace(spaceWidth);
+                            addChild(is);
+                            return i+1;
+                        } else if (c == '\t') {
+                             prev = WHITESPACE;
+                             spaceWidth = 8 * whitespaceWidth;
+                        }
                     } else {
                         // skip over it
                         wordStart++;

--------------------------------------------------------------------------------

<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>1234567890123456789012345678901234567890 Test 1 text-align="start"</fo:block>
<fo:block white-space-collapse="false" text-align="start" background-color="yellow">
Start in column 1, one empty line before this line. Line ends with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty line before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, no empty line after this line.
</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 1</fo:block>




<!-- Test 2 -->
<fo:block>1234567890123456789012345678901234567890 Test 2 text-align="end"</fo:block>
<fo:block white-space-collapse="false" text-align="end" background-color="yellow">
Start in column 1, one empty line before this line. Line ends with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty line before this line.

  
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, no empty line after this line.
</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 2</fo:block>




<!-- Test 3 -->
<fo:block>1234567890123456789012345678901234567890 Test 3 text-align="start"</fo:block>
<fo:block white-space-collapse="false" text-align="start" 
background-color="yellow">Start in column 1, no empty line before this line. Line ends 
with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty lines before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, no empty line after this line.</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 3</fo:block>





<!-- Test 4 -->
<fo:block>1234567890123456789012345678901234567890 Test 4 text-align="end"</fo:block>
<fo:block white-space-collapse="false" text-align="end" 
background-color="yellow">Start in column 1, no empty line before this line. Line ends 
with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty line before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, no empty line after this line.</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 4</fo:block>





<!-- Test 5 -->
<fo:block break-before="page">1234567890123456789012345678901234567890 Test 5 
text-align="start"</fo:block>
<fo:block white-space-collapse="false" text-align="start">

<fo:inline text-decoration="underline">
Start in column 1, three empty lines before this line. Line ends with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty lines before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, one empty line after this line.
</fo:inline>
</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 5</fo:block>




<!-- Test 6 -->
<fo:block>1234567890123456789012345678901234567890 Test 6 text-align="end"</fo:block>
<fo:block white-space-collapse="false" text-align="end">

<fo:inline text-decoration="underline">
Start in column 1, three empty lines before this line. Line ends with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty lines before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, one empty line after this line.
</fo:inline>
</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 6</fo:block>




<!-- Test 7 -->
<fo:block>1234567890123456789012345678901234567890 Test 7 text-align="start"</fo:block>
<fo:block white-space-collapse="false" text-align="start"><fo:inline 
text-decoration="underline">
Start in column 1, one empty line before this line. Line ends with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty lines before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, no empty line after this line.</fo:inline></fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 7</fo:block>



<!-- Test 8 -->
<fo:block>1234567890123456789012345678901234567890 Test 8 text-align="end"</fo:block>
<fo:block white-space-collapse="false" text-align="end"><fo:inline 
text-decoration="underline">
Start in column 1, one empty line before this line. Line ends with 3 spaces.   


        Start in column 9 (one tab), two empty lines before this line.
                Start in column 17 (two tab), no empty line before this line.

   
  Start in column 3, one empty line and one with three spaces before this line.
Start in column 1, no empty line after this line.</fo:inline></fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 8</fo:block>



<!-- Test 9 -->
<fo:block>1234567890123456789012345678901234567890 Test 9</fo:block>
<fo:block white-space-collapse="false"></fo:block>
<fo:block white-space-collapse="false"></fo:block>
<fo:block></fo:block>
<fo:block></fo:block>
<fo:block></fo:block>
<fo:block></fo:block>
<fo:block></fo:block>
<fo:block></fo:block>
<fo:block white-space-collapse="false">
</fo:block>
<fo:block>One empty line before this line.</fo:block>
<fo:block>1234567890123456789012345678901234567890 Test 9</fo:block>




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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to