From 9dce321a113871ade7de244d3abf9ed08f43dd85 Mon Sep 17 00:00:00 2001 From: Brian Ewins Date: Sun, 11 Feb 2007 01:42:22 +0000 Subject: [PATCH] [ATSUI] scale fonts using font size not font matrix Mozilla bug #327522 - fonts scaled up over 16pt on mac had nonsensical extents. The scaling was being done using the font matrix, it turns out this does not work for 16x scaling and up. This patch switches back to using the font size to scale fonts, with emboldening and condensing effects applied separately using the font matrix. --- src/cairo-atsui-font.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 94f431b8d..cdfb5c05f 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -195,26 +195,22 @@ CGAffineTransformMakeWithCairoFontScale(const cairo_matrix_t *scale) 0, 0); } -static CGAffineTransform -CGAffineTransformMakeWithCairoScaleFactors(const cairo_matrix_t *scale) -{ - double xscale = 1.0; - double yscale = 1.0; - _cairo_matrix_compute_scale_factors(scale, &xscale, &yscale, 1); - return CGAffineTransformMake(xscale, 0, - 0, yscale, - 0, 0); -} - static ATSUStyle CreateSizedCopyOfStyle(ATSUStyle inStyle, const cairo_matrix_t *scale) { ATSUStyle style; OSStatus err; + double xscale = 1.0; + double yscale = 1.0; + CGAffineTransform theTransform; + + _cairo_matrix_compute_scale_factors(scale, &xscale, &yscale, 1); + theTransform = CGAffineTransformMake(1.0, 0, + 0, yscale/xscale, + 0, 0); /* Set the style's size */ - Fixed theSize = FloatToFixed(1.0); - CGAffineTransform theTransform = CGAffineTransformMakeWithCairoScaleFactors(scale); + Fixed theSize = FloatToFixed(xscale); const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag, kATSUFontMatrixTag }; const ByteCount theFontStyleSizes[] = { sizeof(Fixed), sizeof(CGAffineTransform) }; ATSUAttributeValuePtr theFontStyleValues[] = { &theSize, &theTransform };