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
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?