[cairo] font lifetime

Alexander Larsson alexl at redhat.com
Wed Jan 26 07:17:21 PST 2005


On Wed, 2005-01-26 at 09:49 -0500, Owen Taylor wrote:

> I'm not using cairo_ft_font_create_for_ft_face() in Pango at the moment,
> so I'd be interested in knowing what you need out of it for the Xpdf
> backend... other than the destroy notifier issue, is it doing what
> you want?

Its a bit sucky to use actually. You can create a cairo_font_t using it,
and then set it using cairo_set_font(). However, any time you change any
state in the cairo_t "_cairo_gstate_unset_font (gstate)" will be called,
and the next time you render text cairo_gstate_ensure_font() will try
create a new font using _cairo_font_create() instead of your own font.

Also, I'm not sure things are actually working right for me with several
sizes of a font. On the xpdf side i have an object that basically refers
to an scaled font, which owns the FT_Face. When i set the cairo font i
create a new cairo_font from this face, which in turn creates an
unscaled cairo font. When i do this twice for different sizes, won't i
get two cairo_unscaled_font_t referencing the same FT_Face? Won't this
break, since the unscaled font sets the size of the FT_Face?

What you really want is a way to create a cairo_unscaled_font_t from the
face, and then scaled versions from that. I think.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's a notorious sweet-toothed hairdresser haunted by memories of 'Nam. She's 
a scantily clad French-Canadian wrestler living homeless in New York's sewers. 
They fight crime! 




More information about the cairo mailing list