[HarfBuzz] Interaction between shaping and line-breaking

James Clark jjc at jclark.com
Wed Aug 21 04:03:34 PDT 2013


I've just started looking at HarfBuzz and I'm trying to get a better
understanding of how it would work as part of a complete text formatting
system.  In particular I would like to understand how line-breaking is
supposed to interact with HarfBuzz's shaping.

Suppose, for example, I have a paragraph whose content is "This is
difficult."  I'm guessing that the first step is to get HarfBuzz to shape
the entire content.  Now let's suppose that I've decided to break this as:

  This is dif-
  ficult.

In general, this may require reshaping: for example, difficult might have
used an "ffi" ligature.  I can of course do this reshaping just by passing
"This is dif-" and "ficult" again to the Harfbuzz shaper. However, apart
from being inefficient, that would not be workable if I want to do
Knuth-Plass style optimized line-breaking.

Given that I have already shaped "This is difficult.", I would hope that
there would be some way to figure out how many characters on each side of
the break I need to reshape.  For example, probably in this case it is
enough to just reshape the "f-" before and "fi" after the break.  However,
I don't see how I can figure this out from the information that HarfBuzz
supplies.  I can think of various heuristics (eg stopping at whitespace)
but I can't think of algorithm for doing this that will be correct
regardless of the font.

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20130821/78f81410/attachment.html>


More information about the HarfBuzz mailing list