https://issues.apache.org/bugzilla/show_bug.cgi?id=43166

--- Comment #4 from Matthias Reischenbacher <matthias8...@gmx.at> 2010-12-28 
15:16:28 EST ---
(In reply to comment #3)
> The patch works of course, but it looks a bit like magic. I would like to dig
> deeper into this. I am surprised that the actual value of the index makes such
> a difference. It would be helpful if you would indicate:

You're right, the patch only does magic, but doesn't really fix the problem.
Debugging again I discovered, that the letter space is added to an existing
sequence and then the elements of a new sequence are also added to the existing
sequence. See: InlineKnuthSequence.appendSequence(). Since notifyPos() has
already been called for the positions of the new sequence (see
InlineLayoutManager.getNextKnuthElements() --> sequence.wrapPositions()), the
letter space has a higher index than the positions of the new sequence,
although it is added before it. This causes the positions of the final sequence
to be something like that:
-1 (border)
0
2 (letter spacing)
1
-1 (border)

When hyphenation is used and hyphenation opportunities are found this is no
problem because all positions get a new index when
InlineStackingLayoutManager.applyChanges() is executed.

> 1. where in the code the border is added or not added to the result page,
> depending on the value of the index;

This happens inside:
InlineLayoutManager.addAreas()
--> setTraits(areaCreated, lastPos == null || !isLast(lastPos));

> 2. where in the code the knuth element is replaced instead of being added.

That was just no sense of my part. The letter space is added as a new knuth
element and nothing is replaced.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to