[cairo] Why Doesn’t Cairo Use FT_Reference_Face?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Fri Mar 6 20:28:11 PST 2015

There is some really peculiar behaviour in the
cairo_ft_font_face_create_for_ft_face call
Cairo wants to keep a reference to the FT_Face, but it seems unable to
use the FT_Reference_Face call which is provided specifically for that
So the caller is forced to go through some weird contortions to avoid
leaking FT_Face objects, or disposing of them prematurely.

Cairo should call FT_Reference_Face on FT_Face objects that are passed
to it, and balance these with FT_Done_Face calls when it no longer
needs these references.

This would be backward-compatible: the user_data shenanigans documented
on the Cairo API page would not become problematic, they would simply no
longer be necessary.

More information about the cairo mailing list