[cairo] how to clear the freetype face cache?
Vojtech Fried
vfried at opentext.com
Thu Jun 13 00:18:10 PDT 2013
>So my question is: is there any way to tell cairo to clear its font cache and release those cairo_font_face_t objects?
I am not sure if this is what you want, but...
You can register a "destructor" function (calling FT_Done_Face) after you create cairo_font_face_t with cairo_font_face_set_user_data. I am not sure about multithreaded scenario, however. Can thread A use a cached cairo_font_face_t created by a thread B? Can A kick B's cairo_font_face_t out of the cache?
You have also to be careful about your FT_Libraries and only free them after all its faces are freed. Which means you can keep it alive with something like a shared_ptr held with the cairo_font_face_t destructor function above.
Vojtech
More information about the cairo
mailing list