[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
<http://cairographics.org/manual/cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-ft-face>.
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
purpose
<http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Reference_Face>!
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