On Jan 11, 2006, at 17:56, Andreas L Delmelle wrote:

On Jan 10, 2006, at 14:02, Manuel Mall wrote:

I got the lastest svn version of fop and then commented out the
removeElementsForTrailingSpaces() method in LineLayoutManager as
theoretically your patch should make this unnecessary. However, we get a erroneous trailing space in the block_white-space-collapse_1.xml test
case.

Just a quick FYI: I think I've found the problem, and almost solved it... Almost, since now the mentioned testcase works fine, but in inline_border_padding.xml, I now get an error, and the reason for it completely eludes me. On the one hand, the error indicates an inlineParent area with an IPD that is *less* than the expected value. On the other hand, that same inlineParent apparently has an offending trailing space area --while the conditions in the FOTree are identical AFAICT (it's the last inline in the last block).

Once I succeed in tracking this one down, I'll commit again.

OK. So apparently, this has nothing to do with refinement white-space- handling, IIC.

I tried commenting out removeElementsForTrailingSpaces() and ran a FO containing the following two blocks:

<fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">
  <fo:inline background-color="orange">
  inline level
    <fo:inline background-color="red">
    nested inline level
    </fo:inline>
  </fo:inline>
</fo:block>
<fo:block background-color="silver" margin="3pt 0pt 3pt 0pt">
  Demonstrates nested
<fo:inline background-color="yellow" border="solid 2pt red" padding-start="2pt" padding-end="2pt" >inlines <fo:inline background-color="orange" border="solid 1pt green" padding-start="2pt" padding-end="2pt" >finishing together
    </fo:inline>
  </fo:inline>
</fo:block>

and for the two inner inlines, I get the following area tree fragments:

<inlineparent ...>
  <text ...>
  <space offset="0"> </space>
  <word offset="0">nested</word>
  <space offset="0"> </space>
  <word offset="0">inline</word>
  <space offset="0"> </space>
  <word offset="0">level</word>
  </text>
</inlineparent>

<inlineparent ...>
  <text ...>
  <word offset="0">finishing</word>
  <space offset="0"> </space>
  <word offset="0">together</word>
  <space offset="0"> </space>
  </text>
</inlineparent>

If I remove the border-* and padding-* properties, the trailing space area for the latter disappears...?

Of course, the expected result could simply be modified, but it would be much better if this were fixed in the related code. No idea where precisely.

=> Q: Disable it FTM, or alter the expectation to make it pass?

Also, I got an error on testcase table_width.xml:

[junit] Testcase: table_width.xml (org.apache.fop.layoutengine.LayoutEngineTestSuite$1): Caused an ERROR
[junit] java.lang.IndexOutOfBoundsException: Index: 6, Size: 6
[junit] ; SystemID: file:///Developer/javatools/xml-fop/test/ layoutengine/testcase2fo.xsl; Line#: 34; Column#: 60 [junit] javax.xml.transform.TransformerException: java.lang.IndexOutOfBoundsException: Index: 6, Size: 6
...
[junit] Caused by: java.lang.IndexOutOfBoundsException: Index: 6, Size: 6
[junit]     at java.util.ArrayList.RangeCheck(ArrayList.java:507)
[junit]     at java.util.ArrayList.get(ArrayList.java:324)
[junit] at org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints (BreakingAlgorithm.java:367) [junit] at org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints (BreakingAlgorithm.java:339)
[junit]     at org.apache.fop.layoutmgr.inline.LineLayoutManager
$LineBreakingAlgorithm.findBreakingPoints (LineLayoutManager.java:537)
[junit]     at org.apache.fop.layoutmgr.inline.LineLayoutManager
                .findOptimalBreakingPoints(LineLayoutManager.java:1000)

I changed the related code in BreakingAlgorithm from:

while(alignment != EN_CENTER
  && ! ((KnuthElement) par.get(firstBoxIndex)).isBox()) {
  firstBoxIndex++;
...

to:

if(alignment != EN_CENTER
  while(par.size() > firstBoxIndex
    && ! ((KnuthElement) par.get(firstBoxIndex)).isBox()) {
    firstBoxIndex++;
...

That solved this particular little problem, but it is more of a quick fix, I guess.

All other tests pass, so if my above tiny question is answered, and no-one objects to the described change in BreakingAlgorithm.java, I'll do the commit.


Cheers,

Andreas

Reply via email to