[scribus] Word wrapping algorithm

Andreas Vox avox at arcor.de
Fri Jul 10 16:08:32 UTC 2015


Hi,

no, there is no document describing Scribus' layout algorithm (safe for the
source code :-) )

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.

/Andreas

> -----Ursprüngliche Nachricht-----
> Von: Darius Blaszyk [mailto:dhkblaszyk at zeelandnet.nl]
> Gesendet: Freitag, 10. Juli 2015 16:10
> An: scribus at lists.scribus.net
> Betreff: [scribus] Word wrapping algorithm
> 
>  Hi all,
> 
> I was wondering which algorithm Scribus uses to do word wrapping and where
> to find it in the source code. Is there somewhere a document describing
the
> workings of the render and layout pipeline?
> 
> Regards, Darius
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.scribus.net/pipermail/scribus/attachments/20150710/dc5654dc/
> attachment.html>
> ___
> Scribus Mailing List: scribus at lists.scribus.net Edit your options or
> unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net




More information about the scribus mailing list