mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-07 15:38:02 +02:00
[atsui] fix scaling of glyph surfaces (#9568)
Atsui glyph surface were clipped incorrectly when the text is scaled, visible in the text-pattern test.
This commit is contained in:
parent
25ddc08004
commit
d2cdd5eba8
1 changed files with 8 additions and 2 deletions
|
|
@ -690,19 +690,25 @@ _cairo_atsui_scaled_font_init_glyph_surface (cairo_atsui_font_t *scaled_font,
|
|||
}
|
||||
|
||||
/* Compute a box to contain the glyph mask. The vertical
|
||||
* sizes come from the font extents; extra pixels are
|
||||
* sizes come from the font extents; extra pixels are
|
||||
* added to account for fractional sizes.
|
||||
*/
|
||||
height = extents.ascent + extents.descent + 2.0;
|
||||
bottom = -extents.descent - 1.0;
|
||||
|
||||
_cairo_matrix_compute_scale_factors (&base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
bbox = CGRectApplyAffineTransform (CGRectMake (1.0, bottom, 1.0, height), CGAffineTransformMakeScale(xscale, yscale));
|
||||
bottom = CGRectGetMinY (bbox);
|
||||
height = bbox.size.height;
|
||||
|
||||
/* Horizontal sizes come from the glyph typographic metrics.
|
||||
* It is possible that this might result in clipped text
|
||||
* in fonts where the typographic bounds don't cover the ink.
|
||||
* The width is recalculated, since metricsH.width is rounded.
|
||||
*/
|
||||
err = ATSUGlyphGetScreenMetrics (scaled_font->style,
|
||||
1, &theGlyph, 0, false,
|
||||
1, &theGlyph, 0, false,
|
||||
false, &metricsH);
|
||||
left = metricsH.sideBearing.x - 1.0;
|
||||
width = metricsH.deviceAdvance.x
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue