[cairo] Cairo 1.9.2 performance

David Björkevik david at bjorkevik.se
Thu Jun 18 05:55:59 PDT 2009


Chris Wilson wrote:
> cairo_show_text() is the toy text interface interface, which now lazily
> resolves the font (if it has been changed on the context) on every call
> (since the resolved font can in fact change between calls). Consider
> this a strong hint not to use this in a non-demonstration application
> and use a full layout library like Pango instead. 
> 
> Alternatively you can always query the font chosen for a particular
> face, family, size, slant and weight by calling
> cairo_get_scaled_font(cr) after setting up the font parameters. Then to
> restore that particular resolved font, use cairo_set_scaled_font().
> 
> Did I mention use Pango?

I fully understand the philosophy of the "toy" API - it's a great way to
fight off bloating feature requests for more advanced text layout features.

However, the text api in cairo is good enough for many applications.
Telling the developers of those apps to include Pango (and GLib etc)
just for performance reasons isn't very nice IMHO. As others have
pointed out, adding Pango and Glib to an app has portability and
licensing issues.

/David


More information about the cairo mailing list