[cairo] Cairo text anti-aliasing

Andrea Canciani ranma42 at gmail.com
Mon Feb 21 01:55:45 PST 2011


On Mon, Feb 21, 2011 at 10:19 AM, cooolheater <cooolheater at gmail.com> wrote:
> I tested about how anti-alias options affect text drawing performance.
>
> I used cairo_font_options_set_antialias and  CAIRO_ANTIALIAS_NONE,
> CAIRO_ANTIALIAS_GRAY, CAIRO_ANTIALIAS_SUBPIXEL.
>
> But measured time of  drawing text for CAIRO_ANTIALIAS_NONE
> & CAIRO_ANTIALIAS_GRAY was almost same!

Even if this might look weird to you, it doesn't look that surprising to me.
Please check where the time is spent.

>
> I think these options affect CGContextSetShouldAntialias,
> CGContextSetShouldSmoothFonts, but I can't find definitions of these
> functions.

These functions are used in:
http://cgit.freedesktop.org/cairo/tree/src/cairo-quartz-surface.c
and
http://cgit.freedesktop.org/cairo/tree/src/cairo-quartz-font.c

They are defined here:
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CGContext/Reference/reference.html

>
> If CGContextSetShouldAntialias, CGContextSetShouldSmoothFonts are set to
> TRUE/FALSE, are they affect to performance much?
Those are quartz-specific functions that the quartz backend already uses and
which would therefore be pointless to set externally, as your setting would be
overridden by cairo.

Speed probably depends on many other factors (for example the glyphs might be
cached). Please profile your application and/or provide a cairo-trace.

http://www.cairographics.org/FAQ/#profiling

Andrea


More information about the cairo mailing list