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

Tor Lillqvist tml at iki.fi
Thu Oct 5 22:14:14 PDT 2006


Owen Taylor writes:
 > You could probably hack around the breakage by adding some sort of
 > if (!_cairo_matrix_integer_transform(..)) return
 > CAIRO_INT_STATUS_UNSUPPORTED to that function, but I really think
 > reverting that patch is is more right.

Hmm, reverting Stuart's patch is a bit hard when I don't know exactly
what it is, so I did add that _cairo_matrix_is_integer_translation()
test you meant. (And yes, it helped the Rotated Text test.)

Behdad, this would then be my suggested patch: (Or, if you instead
choose just to revert Stuart's patch that Owen referred to, that would
be fine then I guess, instead of the first chunk of the below diff.)

--tml

--- ../1.2.4/src/cairo-win32-surface.c	Thu Aug 10 23:14:46 2006
+++ src/cairo-win32-surface.c	Fri Oct  6 08:05:18 2006
@@ -1018,6 +1018,10 @@ _cairo_win32_surface_show_glyphs (void		
 	(dst->format != CAIRO_FORMAT_RGB24))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
+    /* We can't handle rotated text */
+    if (!_cairo_matrix_is_integer_translation (&source->matrix, NULL, NULL))
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+
     /* If we have a fallback mask clip set on the dst, we have
      * to go through the fallback path */
     if (dst->base.clip &&
@@ -1116,7 +1120,7 @@ cairo_win32_surface_create (HDC hdc)
     if (GetDeviceCaps(hdc, TECHNOLOGY) == DT_RASDISPLAY) {
 	depth = GetDeviceCaps(hdc, BITSPIXEL);
 	if (depth == 32)
-	    format = CAIRO_FORMAT_ARGB32;
+	    format = CAIRO_FORMAT_RGB24;
 	else if (depth == 24)
 	    format = CAIRO_FORMAT_RGB24;
 	else if (depth == 16)



More information about the cairo mailing list