This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Currently working with Andreas Vox on what is needed from shapers to allow paragraph-at-a-time (or page-at-a-time) line breaking to be done.

There are many ways of breaking paragraphs into lines. Let's start with what a simple dynamic programming implementation needs for ragged-end text (i.e. not fully justified, no condensing or expansion of text to make it fit better). It is assumed that we have already gone over the text to find possible line break points (the language-dependent hyphenation points and normal word breaks). The line breaker then needs to know:

If we are also allowed to shrink/extend text to make it better fit the available space (kashidas, JALT table (and FALT table?), perhaps enabling/disabling optional ligatures), then instead of a single width for a given line a..b, we need:

Effect of optical margin adjustment on line-breaking

We haven't yet thought how to handle optical margins (OPBD table) well for doing “width of line a..b” calculations in O(1) time, while handling bidi correctly. (Bidi makes it harder to work out which is the leftmost/rightmost word: bidi reordering ususally takes Ω(n) time in the number of words. But maybe we can still work out the revised leftmost & rightmost word in O(1) time if we're only adding one word since the last query.)

However, assuming that optical margin adjustments can only reduce the needed width of a line rather than increase it (or if at least we know an upper bound as to how much the width can increase), then a reasonable fallback plan is just to ignore these optical margin adjustments for the width calculations when making line-breaking decisions. This would mean that we would occasionally wrongly conclude that a line a..b is too tight to fit well in the available space; it has most effect on line-breaking choices for very narrow columns (e.g. newspapers, tables).


2024-10-23 11:35