[cairo-commit] src/cairo-win32-font.c

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Mon Mar 30 11:48:28 PDT 2009


 src/cairo-win32-font.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 77ee65fd03d06064be023f022d565c5038fe26df
Author: Jonathan Kew <jfkthame at gmail.com>
Date:   Mon Mar 30 14:45:48 2009 -0400

    [win32] Fix horizontal glyph positioning bug
    
    The _cairo_win32_scaled_font_backend version of show_glyphs collects
    glyph runs to hand to ExtTextOutW until the y-offset changes, then flushes the
    glyphs buffered so far. As each glyph is buffered, it also calculates and
    buffers the dx value for the preceding glyph.
    
    However, when it sees a change in dy and decides to flush, it should *not*
    append an entry to the dx buffer, as this would be the "dx" of the previous
    glyph, and instead the new start_x value will be used for the new glyph run
    that's being collected. This bug means that after any vertically-offset glyph,
    the remaining glyphs in the run will get incorrect dx values (horizontal
    escapement).
    
    Mozilla bug #475092

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index e9abfda..e0ece5b 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -1180,12 +1180,12 @@ _add_glyph (cairo_glyph_state_t *state,
 	    if (status)
 		return status;
 	    state->start_x = logical_x;
+	} else {
+	    dx = logical_x - state->last_x;
+	    status = _cairo_array_append (&state->dx, &dx);
+	    if (status)
+		return status;
 	}
-
-	dx = logical_x - state->last_x;
-	status = _cairo_array_append (&state->dx, &dx);
-	if (status)
-	    return status;
     } else {
 	state->start_x = logical_x;
     }


More information about the cairo-commit mailing list