From d2cdd5eba801fc5f696d1095f237ae53c54b4e2a Mon Sep 17 00:00:00 2001 From: Brian Ewins Date: Sat, 24 Mar 2007 13:25:03 +0000 Subject: [PATCH] [atsui] fix scaling of glyph surfaces (#9568) Atsui glyph surface were clipped incorrectly when the text is scaled, visible in the text-pattern test. --- src/cairo-atsui-font.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 7873808a6..8a82a7ffb 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -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