[HarfBuzz] Passing full text to HarfBuzz

Behdad Esfahbod behdad at behdad.org
Fri Oct 28 10:29:43 PDT 2011


On 10/28/2011 01:24 PM, ext-naja.naja at nokia.com wrote:
> Hi Guys,
> 
> I have noticed that *HB_ShaperItem* (or *HB_ShaperItem_*) has an object
> *HB_ScriptItem *contains position and length field. My understanding this
> would allow the HarfBuzz adaptation layer to specify only a subset of the of
> string (passed to the shaper) to be actually shaped.
> 
> Why is this feature implemented ? is there any situation\language where
> HarfBuzz needs to know the broader context of the string to be shaped (e.g.
> look at the characters before or after the string) ?

I'm not well-versed in the old HarfBuzz code, but I can answer your question
generally.

There are two reasons that I know, for what you noted:

1.  Having offset allows HarfBuzz to set the 'cluster' field of the output to
the actual offset into your text, not offset into the run.  Makes it easier
for the user.

2.  There are situations where the context helps shaping better.  Arabic for
example.  Say, if you want to embolden part of an Arabic word, it kicks in a
different font, and hence different run.  But for Arabic contextual shaping to
work, you need to see neighboring text.  Pango doesn't do this right now.  Not
sure about any other implementation.

In HarfBuzz-ng, that's how the API is design.  Right now we don't save the
context, but the API allows for changing that in the future with no API changes.

behdad


> Regards,
> 
> Jamil



More information about the HarfBuzz mailing list