On 27.03.2006 13:29:49 Joachim Pfaff wrote:
> Okay Commander,
> 
> bring me there ;)

hehe

> I have already taken a look at the 
> org.apache.fop.layoutmgr.inline.InlineLayoutManager. Is it correct 
> that most of the work has to be done  in this class (especially 
> mustKeepTogether() and getNextKnuthElements())?

Yes, although I've just seen that mustKeepTogether() should be treated
with care. The reason: There are two dimensions, 1. keeps in
block-progression-direction (keep-together.within-page="always", implemented)
and 2. keeps in inline-progression-dimension
(keep-together.within-line="always", not implemented). Since fo:inline
can have fo:block as child, I think the mustKeepTogether() is used here
for block-p-d. That means, we need something else for inline-p-d.

But yes, the construction of the element list happens in
getNextKnuthElements(). That's where all the fun happens (or in
submethods called from there.

> But I do not understand how a Knuth-Sequence is marked to keep 
> together. 

That's where Donald Knuth's book helps a lot. :-) Here's a Knuth element
model crash course (doesn't replace the book!):

There are three elements:
- box
- glue
- penalty

There are two possibilities where a line-break can occur:
1. at a penalty, if the penalty value is < infinity
2. at a glue, if the previous element is a box

To implement a keep, all you need to do is make sure there are no break
possibilities. :-) For case 1: set the penalty value to "infinity". For
case 2: insert an infinite penalty before the glue.

Since inline element list build is a complicated thing and we require
them anyway, it's a VERY good idea to create layout engine test cases 
(see test/layoutengine/standard-testcases) where you define the expected
outcome. A guide to creating layout engine test cases can be found here:
http://wiki.apache.org/xmlgraphics-fop/HowToCreateLayoutEngineTests

That's it for now. If you need more we should really move this to the
fop-dev mailing list. It gets a little inappropriate for fop-users. If
you don't mind...

> I think that you are right about the last-line-end-indent. I thought 
> this property has the same context as end-indent. Thats not correct,  
> even though the name could implicate this.
> 
> Greetings!
> Joachim
> 
> 
> On 24 Mar 2006 at 14:47, Jeremias Maerki wrote:
> > Obviously, you don't need to implement last-line-end-indent, but if you
> > want to take a stab at inline keep-together, that should also not be too
> > difficult. The only problem is that you need to have some basic
> > knowledge about the Knuth element model. Implementing keeps simply means
> > switching off break possibilities in terms of the Knuth model. The
> > absolutely essential basics are here: 
> > http://wiki.apache.org/xmlgraphics-fop/KnuthsModel
> > But the paper referenced on that page helps much more. If you're serious
> > about it I can point you to the right places in the code.


Jeremias Maerki


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

Reply via email to