[cairo] API to disable subpixel antialiasing per-surface
Bill Spitzak
spitzak at gmail.com
Mon Jan 10 19:24:37 PST 2011
Robert O'Callahan wrote:
> Sometimes we're setting font options to
> CAIRO_ANTIALIAS_SUBPIXEL explicitly (e.g. downloaded fonts need
> Cleartype in Windows XP even if the user hasn't enabled Cleartype)
If the fonts won't render without cleartype than it would seem the font
backend should use cleartype automatically without the program having to
request it!
> If, at layout time, we know that the font needs to be grayscale-AA, we
> will make it so when we construct the font and we don't need this
> additional control. But sometimes we don't know until after layout is
> done whether we can use subpixel AA or not, because that actually
> depends on layout! For example, if text overlaps a GPU-accelerated
> video, we may need to place it in an RGBA layer. In that case, rendering
> the glyphs of the grayscale-AA font using glyph positions of the
> subpixel-AA font seems to give better results than mangling the
> subpixel-AA alpha channels into a single alpha value as cairo does
> today, especially when the text isn't black. We can't handle a circular
> dependency where layout depends on the antialiasing of the text and the
> antialiasing of the text depends on layout.
If just the A channel of the RGBA subpixel font is correct then you
could perhaps draw the text into a temporary transparent image and
decide at the last moment whether to "over" this image (getting subpixel
aa) or use it as a mask to put the constant color through.
More information about the cairo
mailing list