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/11/30 11:24:02 UTC

Knuth linebreaking questions

Hi Luca (and others),

I've been trying to get my head around the line breaking code and during
that process some questions has come up. I urge you *not* to take
anything I ask as a sign of criticism or as a request for changes. I 
don't have the Knuth paper where the algorithm is described so perhaps 
the answers would be obvious if I read it.

1) What is the purpose of 2 glues for a normal space in END and START 
alignment:

new KnuthGlue(0, 3 * wordSpaceIPD.opt, 0, , false));
new KnuthPenalty(0, 0, false, , true));
new KnuthGlue(wordSpaceIPD.opt, - 3 * wordSpaceIPD.opt, 0, , true));

and why isn't the min and max of wordspaceIPD used.

2) What does the threshold parameter to findBreakingPoints controll?
It seems to be a performance parameter which control the number of 
active nodes, rather than a quality parameter. Or to frame my question 
differently, if threshold=1 finds a set of breaks, will threshold=5 
always pick the same set of breaks? Or can threshold=5 find a better set 
of breaks?

3) What is the reasoning for doing hyphenation only after threshold=1 
fails. Naive common sense tells me that if the user specify hyphenation 
we should do hyphenation before finding line breaks.

4) I've compared your code to tex_wrap
    http://oedipus.sourceforge.net/texlib/
and the main difference is in the way new KnuthNodes are added to the 
active list. Is the BestRecords part of Knuth or is it your own 
invention? Why is it only fitness_class'es in BestRecord that is higher 
then minDemerits + incompatibleFitnessDemerit that is added to 
activeList? Why not all fitness_class'es in BestRecords?

regards,
finn


Re: Knuth linebreaking questions

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Finn Bock wrote:
> 3) What is the reasoning for doing hyphenation only after threshold=1 
> fails. Naive common sense tells me that if the user specify hyphenation 
> we should do hyphenation before finding line breaks.

The purpose of professional typography and layout is to
assist the reader: provide an easy reading with minimal
distractions. Typographic concepts reflect this. Justified
text makes it easier to identify paragraphs. Unfortunately,
long words may cause word spaces to be stretched into large
white blobs which disrupt reading. Hyphenation is essential
to cut down on space allocated for text justification,
especially for languages which can form arbitrary long
compound words. Hyphenation has of course it's own drawback:
words are mostly identified by the letters at the beginning
and the end, and hyphenation disrupts this. Several lines
ending in hyphenated words may also cause the reader to pick
up the wrong continuation line (that's the reason for having
the hyphenation-ladder-count property). This tradeoff between
using hyphenation in order to avoid visual artefacts and
having lots of hyphenated words disrupting the flow has to be
balanced.

J.Pietschmann