mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-23 21:00:23 +01:00
[atsui] make text_to_glyphs return positions in user units. (#9568)
text_to_glyphs was returning positions in device units; correct this to use user units.
This commit is contained in:
parent
06a4483927
commit
986b0ff838
1 changed files with 13 additions and 1 deletions
|
|
@ -844,6 +844,9 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font,
|
|||
cairo_atsui_font_t *font = abstract_font;
|
||||
ItemCount glyphCount;
|
||||
int i;
|
||||
CGPoint point;
|
||||
double xscale, yscale;
|
||||
CGAffineTransform device_to_user_scale;
|
||||
|
||||
status = _cairo_utf8_to_utf16 ((unsigned char *)utf8, -1, &utf16, &n16);
|
||||
if (status)
|
||||
|
|
@ -870,9 +873,18 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font,
|
|||
return CAIRO_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
_cairo_matrix_compute_scale_factors (&font->base.ctm, &xscale, &yscale, 1);
|
||||
device_to_user_scale =
|
||||
CGAffineTransformInvert (CGAffineTransformMake (xscale, 0,
|
||||
0, yscale,
|
||||
0, 0));
|
||||
for (i = 0; i < *num_glyphs; i++) {
|
||||
(*glyphs)[i].index = layoutRecords[i].glyphID;
|
||||
(*glyphs)[i].x = x + FixedToFloat(layoutRecords[i].realPos);
|
||||
/* ATSLayoutRecord.realPos is in device units, convert to user units */
|
||||
point = CGPointMake (FixedToFloat (layoutRecords[i].realPos), 0);
|
||||
point = CGPointApplyAffineTransform (point, device_to_user_scale);
|
||||
|
||||
(*glyphs)[i].x = x + point.x;
|
||||
(*glyphs)[i].y = y;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue