[HarfBuzz] Caching of glyphmetrics and cmap data

Keith Stribley devel at thanlwinsoft.org
Thu Sep 23 21:08:52 PDT 2010


Hi Behdad,

Thanks for your quick response.

On 23/09/10 21:10, Behdad Esfahbod wrote:
> Another, perhaps better, option is to do the caching in hb-ft.c.  I think I
> like that even more.
>    

In this case, there will will need to be a way to store a handle to the 
cache data somehow. The hb_ft_face_create_cached, which is already 
marked as not thread-safe, stores the hb_face pointer directly in 
ft_face->generic.data. One option would be to change the generic.data to 
a pointer to a publicly defined struct holding the hb_face, glyphmetric 
and cmap caches. The cmap cache could probably remain opaque, but the 
glyphmetric cache (just an array of hb_glyph_metrics_t of length 
ft_face->num_glyphs) would potentially be modifiable by the client.

The glyphmetric cache could either be filled in on demand, in which case 
the client would need to zero it after modifying the size of a ft_face 
or else perhaps a method should be added to pre-populate it with all 
glyph metric data, which would make it easier for the client to 
scale/swap in and out the data when the ft_face is resized.

How does that sound?

Keith




More information about the HarfBuzz mailing list