[cairo] how to clear the freetype face cache?

Vojtech Fried vfried at opentext.com
Thu Jun 13 02:45:46 PDT 2013


>I would still like to have the possibility to clear cairo's font cache because in my scenario (Lua binding of freetype and cairo) objects are tied to the garbage collector so FT_Done_Library is called automatically when the program ends. Now I have to say in the manual that you are not allowed free a FT_Library object once you tie freetype fonts to cairo, so you better untie it from the garbage collector after you create it. It looks like an unnecessary hack from the user's pov.

There is a function that drops the cache: cairo_debug_reset_static_data, but it is not intended for regular use and be sure to read the warning in the docs.

For my use cases, the global cache is not ideal either. I would prefer to have a local cache in cairo_t (or something more global), that would go away when cairo_t goes away. It would not need any locking, because I would have one cairo_t for each thread.

/Vojtech


More information about the cairo mailing list