[cairo] text on win32

Hans Breuer hans at breuer.org
Sun Feb 11 02:07:05 PST 2007


On 11.02.2007 02:32, JORDAN MINER wrote:
> commit bf78be63fc35dc13899209ee818f37fe3f564fed
> Author: U-JONATHAN-X60S\jonathan <jonathan at Jonathan-X60s.(none)>
> Date:   Fri Dec 15 00:48:54 2006 +0100
> 
>     Fix a couple of character spacing issues on Windows
> 
> It partially rewrote the way glyphs are shown. Previously, the difference
> in user coordinates between two adjacent glyphs was taken, then converted
> to logical coordinates by multiplying by WIN32_FONT_LOGICAL_SCALE, and
> then passed to Windows. The current code first converts the two adjacent
> glyphs' coordinates from user to logical, then takes the difference of
> them, then converts them to logical again (even though they are already in
> logical coordinates), and then passes them to Windows. Since 1 user equals
> 32 logical, the characters end up being 32 times too far apart.
> 
>> It is the toy API, but it still really needs to work. And this would
>> obviously be a big regression between major releases, so it's
>> something we should fix before cairo 1.4.0.
> 
> Since the bug is in _cairo_win32_surface_show_glyphs, I suppose the bug is
> not limited to the toy API after all.
> 
You are right it screwed gtk+ text rendering trough Pango as well.

>> Consider it filed. I added a note about this to cairo/ROADMAP.
> 
Just yesterday I've filed a real bug report, see:
https://bugs.freedesktop.org/show_bug.cgi?id=9938

> Thank you for considering this bug as important to fix as I do. Here is
> the patch, generated with git.
> 

> --- a/src/cairo-win32-surface.c
> +++ b/src/cairo-win32-surface.c
> @@ -1580,8 +1580,8 @@ _cairo_win32_surface_show_glyphs (void			*surface,
>              next_logical_x = _cairo_lround (next_user_x);
>              next_logical_y = _cairo_lround (next_user_y);
> 
> -            dxy_buf[j] = _cairo_lround ((next_logical_x - logical_x) *
> WIN32_FONT_LOGICAL_SCALE);
> -            dxy_buf[j+1] = _cairo_lround ((logical_y - start_y) *
> WIN32_FONT_LOGICAL_SCALE);
> +            dxy_buf[j] = _cairo_lround (next_logical_x - logical_x);
> +            dxy_buf[j+1] = _cairo_lround (logical_y - start_y);
> 
>              logical_x = next_logical_x;
>              logical_y = next_logical_y;
> 

Thanks for the patch. Indeed it fixes the issue. This make me wonder if the
former code was tested at all before commit ...

Thanks,
	Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert


More information about the cairo mailing list