cairo_ft_font_face_create_for_ft_face Subtlety
Lawrence D'Oliveiro <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Organization | Geek Central |
| Message-ID | <[email protected]> |
The doc for cairo_ft_font_face_create_for_ft_face <http://cairographics.org/manual/cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-ft-face> says it “creates a new font face ... from a pre-opened FreeType face”. What it doesn’t say is that, if you give it the same FT_Face twice, it will return the same font_face_t. You need to watch out for this, because the set_user_data dance will be incorrect if you blindly do it every time. You need to call get_user_data first to check if you have already attached a destroy callback to this font_face_t, and skip doing it again if so. I discovered this in the process of messing about with Multiple Master/TrueType GX fonts. It looks like Cairo’s caching interferes somewhat with the behaviour of these: to get around this, you have to load the same font multiple times so that you can set different values for the design coordinates on each copy. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo