Calculate ATSUI font sizes using both x and y scale factors. --- commit 80a69892d7b438b33927aa9ef1a7228ada9accbc tree 0d38990bde4a4145ee6f3baa4b31ebc8f754ffc5 parent 1ec443933ed41e434eb213d85b38349f3d76b575 author Brian Ewins Sun, 17 Dec 2006 10:06:36 +0000 committer Brian Ewins Sun, 17 Dec 2006 10:06:36 +0000 src/cairo-atsui-font.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index ad2233c..423141d 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -145,6 +145,17 @@ CGAffineTransformMakeWithCairoFontScale( 0, 0); } +static CGAffineTransform +CGAffineTransformMakeWithScaleFactors(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) { @@ -152,14 +163,11 @@ CreateSizedCopyOfStyle(ATSUStyle inStyle OSStatus err; /* Set the style's size */ - CGAffineTransform theTransform = - CGAffineTransformMakeWithCairoFontScale(scale); - Fixed theSize = - FloatToFixed(CGSizeApplyAffineTransform - (CGSizeMake(1.0, 1.0), theTransform).height); - const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag }; - const ByteCount theFontStyleSizes[] = { sizeof(Fixed) }; - ATSUAttributeValuePtr theFontStyleValues[] = { &theSize }; + Fixed theSize = FloatToFixed(1.0); + CGAffineTransform theTransform = CGAffineTransformMakeWithScaleFactors(scale); + const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag, kATSUFontMatrixTag }; + const ByteCount theFontStyleSizes[] = { sizeof(Fixed), sizeof(CGAffineTransform) }; + ATSUAttributeValuePtr theFontStyleValues[] = { &theSize, &theTransform }; err = ATSUCreateAndCopyStyle(inStyle, &style);