[cairo] text on win32
daniel.amelang at gmail.com
Sun Feb 11 03:35:32 PST 2007
On 2/10/07, JORDAN MINER <jminer2613 at students.pcci.edu> wrote:
> > I'm sorry to hear that you can't
> > build cairo versions any faster than a couple of hours each, (why is
> > that by the way?).
> I have been compiling it with Microsoft's free complier. (The first one
> they gave away.) I write my own makefile that defines certain constants,
> such as cairo_public=__declspec(dllexport). I include all .c files in the
> makefile, remove ones that I know aren't needed, then remove more when
> they cause compile errors. With previous versions of cairo, sometimes I've
> also had to fix files to compile with Microsoft's compiler. Except for
> fixing the files, I don't mind spending time upgrading, as I only need to
> every year or so.
Ouch, man. You know that we've now got win32 makefiles that do all
that for you, right? They are a little out of date at the moment, but
I just fixed them up and will post a patch shortly. It should make it
into the upcoming 1.4, so hopefully your days of pain are numbered.
> However, even though I had never looked at cairo's code, I've have managed
> to track down the problem, which is really easy to fix.
> 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.
> Thank you for considering this bug as important to fix as I do. Here is
> the patch, generated with git.
So this patch doesn't apply cleanly to the what's currently in git
because Vlad has touched that same part of the code lately:
Thu, 25 Jan 2007 20:01:50 +0000 (12:01 -0800)
[win32] regression with win32 glyph y-offsets (mozbug#365021)
Notice that he was fixing a glyph offsets bug...yet it didn't fix the
problem that you and I are still seeing. Anyway, I did a quick and
dirty manual application of your patch and it fixes the problem on my
end. I'm attaching the updated patch.
But shouldn't this break the mozilla text spacing? And why wasn't the
mozilla spacing broken already?
-------------- next part --------------
From f07b4977068902a6b19dc74210016bbc6550435f Mon Sep 17 00:00:00 2001
From: Dan Amelang <dan at amelang.net>
Date: Sun, 11 Feb 2007 03:34:27 -0800
Subject: [PATCH] Fix Win32 text spacing problem
Thanks to Jordan Miner for reporting the problem and a fix.
src/cairo-win32-surface.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 4025b94..6899c95 100644
@@ -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 ((next_logical_y - logical_y) * WIN32_FONT_LOGICAL_SCALE);
+ dxy_buf[j] = _cairo_lround (next_logical_x - logical_x);
+ dxy_buf[j+1] = _cairo_lround (next_logical_y - logical_y);
logical_x = next_logical_x;
logical_y = next_logical_y;
More information about the cairo