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

Owen Taylor otaylor at redhat.com
Fri Oct 6 06:07:47 PDT 2006


On Fri, 2006-10-06 at 08:14 +0300, Tor Lillqvist wrote:
> 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.)

What I meant by "Stuart's commit of March 10 (59a45f)", was:

commit 59a45f1c4a914c9640bbea37c72b1ec222f56ff3
Author: Stuart Parmenter <pavlov at pavlov.net>
Date:   Fri Mar 10 12:25:07 2006 -0800

    [win32] implement win32 show_glyphs
    (cherry picked from 9c7d0cbde415d02b6e8298a02b3b62cf4513a59e commit)

You can see it with 'git show 59a45f'. In theory, 'git revert 59a45f'
would revert it, though probably that would only work on the head
branch. But it's probably more easily reverted as it with a
pseudo-patch:

     NULL, /* fill */
-    _cairo_win32_surface_show_glyphs
+    NULL /* _cairo_win32_surface_show_glyphs */
 
Alternatively, there was a fix for the problem committed to the
head branch on September 12 (git show f1bd0b9f); you could basically 
just cut-and-paste all of cairo_win32_surface_show_glyphs from the head
branch.

Still, I don't really understand the reasoning behind having
_cairo_win32_surface_show_glyphs at all...

> 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.)

This isn't quite right - it works only coincidentally. You aren't
interested in the source pattern's matrix, but rather
scaled_font->ctm.

> --- ../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