[HarfBuzz] Streamlining hb_font_t some more

Behdad Esfahbod behdad at behdad.org
Fri Oct 2 09:51:38 PDT 2015


Hi,

So, with the default scale set to upem, I'm now planning to make the following
changes:

  - Make all fonts have a parent; for fonts created with hb_font_create(),
they will default to the hb_font_get_empty() font as their parent.  This
changes the return value of hb_font_get_parent() for most fonts, but I don't
think any clients rely on that.  The get_parent() for the empty font will
continue to return NULL.

  - Optimize how chaining to parent font happens; this is easy and shouldn't
affect any client.

  - Optimize hb-ot-font.  Make it be *really* fast.

  - Add a "canonical-font" per face, eg, hb_face_get_canonical_font().  This
is a immutable font that works in the upem, ie, design, space of the font.

  - Make the canonical-font parent of all fonts created using
hb_font_create().  This will make hb_ot_font_set_funcs() unnecessary and for
the first time, fonts created using hb_font_create() will actually work
properly without explicit set_funcs needed.  Clients can still set their own
functions and things will work as before.  The only difference here will be in
the behavior of functions not implemented by custom font funcs.

The canonical-font will have optimized functions that avoid scaling
completely.  For applications like Sile that want to work in upem space, they
can get the highest performance possible.

The reference-counting between face and canonical-font will become interesting
since they'd need to reference each other, but I have a rough plan in mind.

So, how does that sound?  I expect that it will only make easier for most
clients.  Like to hear what Jonathan has to say.  Chrome, Android, Pango,
XeTeX, Sile should all either benefit from this or be unaffected.

Cheers,
-- 
behdad
http://behdad.org/


More information about the HarfBuzz mailing list