[scribus] Word wrapping algorithm

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Sat Jul 18 09:25:24 UTC 2015


 
ale rimoldi schreef op 12 jul '15: 

> hi
> 
>> The line breaking und justification should work like this:
>> 
>> 0. Assume natural glyph width and normal word spacing
>> 1. Fill the line with words until a word spills over the end of the
>> line. 2. If hyphenation is on, hyphenate that word
>> 3. Remember the difference D between the length of the words
>> collected for this line so far and the regular line length.
>> 4. Remember the difference D' between the regular line length and the
>> length of all collected words but the last on (D' > 0)
>> 3. Test if after applying minimal word spacing and minimal glyph
>> stretch the line is shorter or equal to the regular line length
>> 4. If yes and D < D', apply min. glyph stretch and minimal word
>> spacing such that the words fit the line.
>> 5. Otherwise, apply max. glyph stretch and increase word spacing so
>> that the word fit the line.
>> 
>> Of course 5. only happens if justification is on.
> 
> can we have this description in the relevant file?
> if possible (if the file is small enough...) at the top of the file?

Yes please! A technical description in the sources which would end up in
the doxygen documentation would be great! And possibly also implement
the Knuth-Plass algortihm so one can select which one to use and get a
different (better??) result? I have ordered the book _Digital
Typography_ which contains the original paper describing this algorithm.
I would be willing to implement it but I have not enough knowledge on
how to merge this into the Scribus sources. Also some design decisions
need to be taken whether or not we need a global setting or a new align
option in the text properties. I'm hoping I can team up with a core
developer on this and discuss the details a bit more.

Regards, Darius 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20150718/8975edd5/attachment.html>


More information about the scribus mailing list