commit 473709c235833ab96f1fb060e0cb334192b4a02d Author: Brian Ewins Date: Fri Mar 16 02:48:33 2007 +0000 [atsui] correct glyph x/y in text_to_glyphs (#10067) The code calculated the same glyph x, y positions whether or not the ctm was scaled. Change to calculating these coordinates in the same way as the fallback in _cairo_scaled_font_text_to_glyphs. diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index d9fbde3..51a2bff 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -866,6 +866,7 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font, cairo_atsui_font_t *font = abstract_font; ItemCount glyphCount; int i; + cairo_scaled_glyph_t *scaled_glyph; status = _cairo_utf8_to_utf16 ((unsigned char *)utf8, -1, &utf16, &n16); if (status) @@ -894,18 +895,32 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font, for (i = 0; i < *num_glyphs; i++) { (*glyphs)[i].index = layoutRecords[i].glyphID; - (*glyphs)[i].x = x + FixedToFloat(layoutRecords[i].realPos); + (*glyphs)[i].x = x; (*glyphs)[i].y = y; + + status = _cairo_scaled_glyph_lookup (abstract_font, + (*glyphs)[i].index, + CAIRO_SCALED_GLYPH_INFO_METRICS, + &scaled_glyph); + if (status) { + free (*glyphs); + *glyphs = NULL; + goto DONE; + } + + x += scaled_glyph->metrics.x_advance; + y += scaled_glyph->metrics.y_advance; } free (utf16); + DONE: ATSUDirectReleaseLayoutDataArrayPtr(NULL, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, (void *) &layoutRecords); ATSUDisposeTextLayout(textLayout); - return CAIRO_STATUS_SUCCESS; + return status; } #if CAIRO_HAS_QUARTZ_SURFACE