On Fri, 16 Dec 2005 11:40 pm, Adam Strzelecki wrote:
> Hi Jeremias,
> > All test cases pass, so it's a special situation. Please send a
> > test file. Thanks.
> Attached.
> Seems that I'm all of special situations  ;)

It is not a special situation at all. Simply having a   in your 
text is enough to trigger this regression. And yes, it is an regression 
caused by the "fix" for the disappearing empty line problem: 

We don't have test cases in our test suite for non breaking spaces and 
therefore this regression wasn't caught.

After some debugging it is obvious to me what is happening. However, it 
is much less obvious how to fix it. In brief:

The fix added a zero width Knuth box to the element list created for a 
nbsp. This was done for two reasons:
a) to avoid it being removed by the removeElementsForTrailingSpaces() 
method. That method is wrong in the first place as it knowingly tries 
to remove non breaking spaces which IMO should never be removed. 
b) However, changing that method to not remove nbsp would give us Knuth 
paragraphs containing only Glue and Penalty elements. This then causes 
our implementation of the Knuth algorithm to 'spit the dummy'. Luca, 
why does our line breaking algorithm insist on having at least one Box 
in a paragraph? Is that inherent in the Knuth algorithm, i.e. can't it 
deal with empty paragraphs, that is paragraphs containing only Glue/Pen 

However, this now causes consecutive Knuth boxes being created when the 
nbsp is for example between two words. This then triggers the 
addALetterSpaceMethod but it fails because the Knuth sequences are not 
any more like what it expects.

It is well documented and acknowledged in other threads on this mailing 
list that the design of this area of the code (generating of the Knuth 
sequences for inline's) is flawed and this is just another 
manifestation of the inherent design problems here.

I'll see if I can find another hack to workaround this particular 
problem but I don't feel comfortable with the whole scenario.

> BTW. Maybe it is worth to put some special message at
> src\java\org\apache\fop\cli\Main.java line 185
> options.getLogger().error("This is probably bug of FOP version blah
> bla... contact us at blah blah or send bug report at blah blah.", e);
> e.printStackTrace();
> instead options.getLogger().error("Exception", e);
> .. coz I needed to modify Main.java in order to see the stack trace.
> Cheers,


Reply via email to