[cairo] Cairo 1.9.2 performance

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 17 23:14:45 PDT 2009


On Wed, 2009-06-17 at 20:38 -0400, cu wrote:
> I ran application through profiler and found that vast majority of the
> slowdown is attributable to text drawing. Specifically, profiler shows
> enormous amount of time spent in cairo_show_text

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?
-ickle



More information about the cairo mailing list