[cairo] Pango+Cario : proper font rendering under Win32

Timothée Lecomte timothee.lecomte at ens.fr
Fri Jan 13 07:39:23 PST 2006

Owen Taylor wrote:

>On Thu, 2006-01-05 at 13:09 +0100, Timothée Lecomte wrote:
>>Under Linux, the result is good, the fonts are properly antialiased.
>>However, under MS-Windows (with binary snapshots of 
>>cairo1.0.2/pango1.10.1 distributed at 
>>ftp://ftp.gtk.org/pub/gtk/v2.8/win32/), the same code gives uglier 
>>results, with black text "over-antialiased" with a subpixel method.
>>Here are screenshots :
>>http://tipote.free.fr/wxt15.png (linux, various fonts, result satisfying)
>>http://tipote.free.fr/wxt_windows4.png (windows, using font "Sans", size 15)
>I don't see huge problems with your results, actually.
>But there's a general problem that text rendering antialiasing only
>works fully correctly in Windows if you draw directly to a no-alpha
>target surface with a mode of OVER and a solid color. Anything else,
>Pango needs to extract a mask from the windows text and draw with that,
>and then the Gamma correction that Windows text gets in the way
>rather than helping.
>(You'll see far worse results for white-on-black generally than 
>for black-on-white.)
>I'd try writing the simplest possible Cairo program that draws text
>and see how the text there looks ... if it looks OK, you are probably
>running into the above problem. If not, I don't know what is going
>Most of the font options aren't honored in the Windows backend, but
>even if they were, the defaults should give you text that matches
>the system when possible.
>					Owen
Thanks for your answer. I finally uses a win32 backend
(cairo_win32_surface_create) and get the perfect fonts as I would have
expected. So the "problem", if it is really one, is with the image
surface. (By the way, I realised that when creating the image surface, I
used format RGB24 instead of ARGB32, so unintentionally I was not using
alpha). Anyway, this is ok now for me.

Thanks again for your detailed answer,and for the great work done on
Cairo and Pango !

Best regards,


More information about the cairo mailing list