[cairo] Problem with text rendering on Win32+ClearType, and possible fix

Tor Lillqvist tml at iki.fi
Wed Oct 4 09:06:51 PDT 2006

 > On Wed, 2006-10-04 at 03:28 +0300, Tor Lillqvist wrote:

 > > [...] starting with 1.0.4, cairo_win32_surface_create() sets the
 > > surface format to CAIRO_FORMAT_ARGB32 if
 > > GetDeviceCaps(hdc,BITSPIXEL) returns 32. (In 1.0.2, the format
 > > was always set to CAIRO_FORMAT_RGB24.)

 > > If I changed cairo_win32_surface_create() to use RGB24 also when
 > > BITSPIXEL is 32, the problem went away, [...] But this seemed
 > > like using a awfully large hammer to fix the problem.

Owen Taylor writes:
 >  > But it may be the right hammer none-the-less.

Heh. I had assumed that the change to use ARGB32 when BITSPIXEL==32
was the result of careful thought, but your mail now seems to say it's
a horrible mistake.

I assume it's this entry in ChangeLog that refers to this change:

> commit ec4b006c162292ea3b2719dc18a4a3bd40a971ab
> Author: Vladimir Vukicevic <vladimir at pobox.com>
> Date:   Fri Feb 17 23:34:51 2006 -0800
>     Win32: Set surface format based on device caps
>     If the DC is a display DC, inspect its depth and set out local format
>     appropriately.  If it's not a display DC, assume RGB24.

 > While the documentation of BITSPIXEL "Number of adjacent color
 > bits for each pixel" makes it sound like like the X concept of
 > "depth" - number of *used* bits per pixel, if you are seeing a value of
 > 32 in normal cases, then it's pretty clearly the X concept of
 > "bits per pixel" - the number of *total* bits per pixel.

Yep. That indeed is the case.

 > I'm not really sure how to extract the diff and commit message
 > for the 1.0.2 => 1.0.4 change.

Dunno about commit messages, but just diffing cairo-win32-surface.c
from 1.0.2 vs. 1.0.4 gives pretty concise output.


More information about the cairo mailing list