On 02/01/11 09:56, Tom Hacohen wrote: > Dear all, > > I ran a test application in callgrind and noticed that the calls to > FT_Load_Glyph are what slows everything down. We already have glyph > cache in EFL and I would really like to be able to use it with harfbuzz. > At first glance, it seems like I can't override harfbuzz's > hb_ft_get_glyph_advance from the outside, but I have to implement my own > class and put it in harfbuzz, which is less than convinient.
The way this is supposed to work is that you create your own font callbacks that *wrap* the original ones. You hb_font_funcs_t *new_funcs, *orig_funcs; hb_destroy_func_t orig_destroy; void *orig_user_data; new_funcs = hb_font_funcs_create (); /* set funcs in new_funcs */ hb_font_unset_funcs (font, &orig_funcs, &orig_destroy, &orig_user_data); /* save orig_funcs, orig_destroy, and orig_user_data in new_user_data */ hb_font_set_funcs (font, new_funcs, new_user_data, new_destroy); Then in your callbacks, you can use orig_funcs and orig_user_data to call into harfbuzz to get the value, and cache it. I'm not quite satisfied with this scheme. The problem with it is that if/when new callbacks are added to hb_font_funcs_t, your code needs to be updated to relay those. Would have been much nicer if they falled through automatically (so you could in essence really subclass a font_funcs_t). I'll think more about it to see if I can make that happen. behdad > I'd very much like to be able to do that, because using my cache will > make everything a lot faster. > > Are my observations correct? > > How do you guys (that use harfbuzz in other projects) solve it? > > Thanks, > Tom. > > _______________________________________________ > HarfBuzz mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/harfbuzz > _______________________________________________ HarfBuzz mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/harfbuzz
