You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Finn Bock <bc...@worldonline.dk> on 2004/12/02 20:42:30 UTC

More questions on line breaking.

Hi

Some more questions.

1) What is inactiveList doing. Nodes are added but never used.

2) If there is no shrink in a line (the case in START alignment) then 
nodes are never removed from activeList until a forced break element is 
found. Is that really the intention of the algorithm? It seems suspect 
that a ration of INFINITE_RATIO is also created when the break is too 
wide to fit within a node.

regards,
finn

Re: More questions on line breaking.

Posted by Finn Bock <bc...@worldonline.dk>.
>>1) What is inactiveList doing. Nodes are added but never used.

[Simon]

> It contains all feasible breakpoints except those that are still
> active, i.e., are still in scope as the start of a line ending at the
> currently considered breakpoint. At the end of the loop the active
> list only contains nodes pertaining to the end of the paragraph. From
> the best one of them the breakpoints of the paragraph are calculated
> by tracing back to the beginning through the inactive list.
> 
> See the code in LineLM after the comment
>         // use the chosen node to determine the optimum breakpoints
> 
> in the line
>             bestActiveNode = bestActiveNode.previous;
> the previous node is held in the inactive list.

Ok, so it isn't really needed when the algorithm is implemented in java. 
Just by having the previous node linked from within bestActiveNode is 
enough to keep the inactive nodes alive.

So inactiveList can be removed.

regards,
finn

Re: More questions on line breaking.

Posted by Simon Pepping <sp...@leverkruid.nl>.
On Thu, Dec 02, 2004 at 08:42:30PM +0100, Finn Bock wrote:
> Hi
> 
> Some more questions.
> 
> 1) What is inactiveList doing. Nodes are added but never used.

It contains all feasible breakpoints except those that are still
active, i.e., are still in scope as the start of a line ending at the
currently considered breakpoint. At the end of the loop the active
list only contains nodes pertaining to the end of the paragraph. From
the best one of them the breakpoints of the paragraph are calculated
by tracing back to the beginning through the inactive list.

See the code in LineLM after the comment
        // use the chosen node to determine the optimum breakpoints

in the line
            bestActiveNode = bestActiveNode.previous;
the previous node is held in the inactive list.

The article with the algorithm was originally published in: Donald
E. Knuth and Michael F. Plass, Breaking Paragraphs into Lines,
Software---Practice and Experience 11 (1981) 1119-1184. It should be
possible to find this journal in academic libraries.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl