[HarfBuzz] Fwd: Harfbuzz with linebreaking

Kelvin Ma kelvinsthirteen at gmail.com
Tue Jun 14 02:42:43 UTC 2016


If you mean how does the linebreaking work in Knockout, it places
characters/glyphs (it works 1-to-1 character-to-glyph, no ligatures,
substitutions) until the glyphs overrun the line length. Then it goes
backwards to the last space character and forward to the next space
character to get the word that the line was broken on. Then it iterates
through hyphenation points until one of them is short enough to accommodate
both itself and a hyphen glyph. Because it works with a 1-to-1 relationship
between glyphs and characters it just counts the number of glyphs printed
and uses that as the index offset for laying out the next line.

It’s a slightly more complicated process than that in reality because it
also checks for other breaking characters like em dashes and slashes not
just spaces, and it skips hyphenations that contain more than the original
amount of characters. It can also do pairwise kerning (checks current and
previous glyph to get kerning offset) but it doesn’t work often in practice
because most modern fonts encode the kerning data in a different table than
where freetype knows to look for it, and I’m currently using freetype to do
what harfbuzz should be doing.

It works in normal time which is nice but not ideal because there is no
ligatures, little kerning, no substitutions, etc. So no opentype features
basically. Which is why I need harfbuzz.

On Mon, Jun 13, 2016 at 10:01 PM, Khaled Hosny <khaledhosny at eglug.org>
wrote:

> On Mon, Jun 13, 2016 at 11:00:16AM -0400, Kelvin Ma wrote:
> > So I’ve not received an answer to this anywhere, so, how do I typeset
> > paragraphs with Harfbuzz? How do I use the ‘safe-to-break’ iterator?
>
> How are you doing line breaking right now?
>
> Regards,
> Khaled
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160613/15568f9e/attachment.html>


More information about the HarfBuzz mailing list