[cairo] Issue with Cairo Font Cache

Jian Ye jiany at cdpcom.com
Wed Mar 18 14:16:29 PDT 2015

If doing so can resolve my problem, I would be happy. But the center of 
the issue is that I want to control when the c_ftLibrary can be 
released.  When a document is closed, I want to release its font objects 
and its c_ftLibrary. If FT_Done_Face( ) is left to Cairo, the 
c_ftLibrary can not be released. That is why I hope Cairo has an 
interface that allow user to remove a font from Cairo's font cache. That 
will free the FT_Face and give new document a fresh start.


The interface may look like:
      unsigned int cairo_cache_release_font (cairo_font_face_t
      unsigned int cairo_cache_release_scaled_font (cairo_scaled_font_t
Both functions return the reference count on  the font after the release.


On 3/18/2015 4:59 PM, Lawrence D'Oliveiro wrote:
> You must. And remember that, as a result of that, Cairo has stolen the
> reference to the FT_Face (which it will dispose of with FT_Done_Face
> that you gave it to call when it is done). So if you want to keep
> working with the same FT_Face object, you must call FT_Reference_Face
> on it to get your own reference (and balance that with your own call to
> FT_Done_Face when you are done).

More information about the cairo mailing list