diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index 0a84dc455..929a80d60 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -988,11 +988,12 @@ _cairo_win32_surface_show_glyphs (void *surface, int *dx_buf = dx_buf_stack; BOOL win_result = 0; - int i, last_y_offset = 0; + int i; double last_y = glyphs[0].y; cairo_solid_pattern_t *solid_pattern; COLORREF color; + int output_count = 0; /* We can only handle win32 fonts */ if (cairo_scaled_font_get_type (scaled_font) != CAIRO_SCALED_FONT_TYPE_WIN32) @@ -1033,6 +1034,8 @@ _cairo_win32_surface_show_glyphs (void *surface, } for (i = 0; i < num_glyphs; ++i) { + output_count++; + glyph_buf[i] = glyphs[i].index; if (i == num_glyphs - 1) dx_buf[i] = 0; @@ -1041,20 +1044,21 @@ _cairo_win32_surface_show_glyphs (void *surface, if (i == num_glyphs - 1 || glyphs[i].y != glyphs[i+1].y) { + const int offset = (i - output_count) + 1; win_result = ExtTextOutW(dst->dc, - glyphs[last_y_offset].x * WIN32_FONT_LOGICAL_SCALE, + glyphs[offset].x * WIN32_FONT_LOGICAL_SCALE, last_y * WIN32_FONT_LOGICAL_SCALE, ETO_GLYPH_INDEX, NULL, - glyph_buf + last_y_offset, - (i - last_y_offset) + 1, - dx_buf + last_y_offset); + glyph_buf + offset, + output_count, + dx_buf + offset); if (!win_result) { _cairo_win32_print_gdi_error("_cairo_win32_surface_show_glyphs(ExtTextOutW failed)"); goto FAIL; } - last_y_offset = i; + output_count = 0; } last_y = glyphs[i].y;