[HarfBuzz] HarfBuzz API design

Behdad Esfahbod behdad at behdad.org
Wed Aug 19 14:46:31 PDT 2009

On 08/19/2009 05:38 PM, Ed Trager wrote:
>> Thanks Adam.  So far the focus has been to unify the shaping logic (most
>> important for Indic).  Itemization, while pretty well defined, is something
>> everyone does slightly differently.  It requires:
>>    - Applying Unicode Bidi Algorithm,
>>    - Script tagging heuristic for Script=Common characters
>>    - Language tagging heuristic
>>    - Font assignment
>> Except for the first item which is well-defined by Unicode, the other steps
>> are less well-defined and different usecases require slightly different
>> solutions.  For example, web browsers have very strict font assignment rules
>> that follow the CSS spec.  Other applications, less so.  It would be harder to
>> justify using a unified itemizer.  At least initially.  But yes, that's one of
>> the logical next step
>> behdad
> I agree that different itemization use cases often require different
> solutions, so HarfBuzz should make it easy for users to use whatever
> itemization they want. At the same time, is there justification for
> providing within HarfBuzz a "default" general itemizer that can be
> used by people when they really don't need anything fancier?
> So when you mention that "logical next step", does that in fact mean
> that HarfBuzz will eventually include an itemizer for general use?

As things fall into place and we figure out the right API to expose, sure, why 

Script tagging heuristic is not hard.  Both pango and ICU use the same 
algorithm.  We may include that in HarfBuzz very early on actually and use it 
if user passes Script=Common.

Language tagging is more delicate, but pango has a solid base.  It would 
require moving the language structures into HarfBuzz, but that's something I'm 
afraid I have to do anyway (in that case, Pango will start having a hard 
dependency on HarfBuzz).  I'll move the language sample texts also then, so 
more people can use those.

For bidi, we can add a compile-time dependency of FriBidi.

Font assignment, I'm reluctant to do in HarfBuzz.  So the itemizer will be 
like the one Adam pointed out, doing all except for font.

But this is not high priority at this time.  I want to finish the minimal API 
first to call it a stable release.


> - Ed

More information about the HarfBuzz mailing list