[win32] fix win32_show_glyphs glyph offsets

(cherry picked from 947a4a1bc6a0a0ee78c44b71fef32c924ebc9397 commit)
This commit is contained in:
Stuart Parmenter 2006-03-15 14:20:35 -08:00 committed by Carl Worth
parent 59a45f1c4a
commit a9c42e8fc2

View file

@ -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;