[cairo-commit] src/cairo-atsui-font.c

Brian Ewins brianewins at kemper.freedesktop.org
Sun Jan 7 05:46:55 PST 2007


 src/cairo-atsui-font.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

New commits:
diff-tree d30b1bf157126668c4309731022b2ded2ad09571 (from ded08256ef7fdc9e9468342cf5635c5e99d4d64d)
Author: Brian Ewins <Brian.Ewins at gmail.com>
Date:   Thu Jan 4 01:36:32 2007 +0000

    [ATSUI] Scale glyphs using _cairo_matrix_compute_scale_factor (#9350)
    This bug shows up in the text-rotate test.

diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index 75530d3..c5e2d36 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -145,6 +145,17 @@ CGAffineTransformMakeWithCairoFontScale(
                                  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)
 {
@@ -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 = CGAffineTransformMakeWithCairoScaleFactors(scale);
+    const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag, kATSUFontMatrixTag };
+    const ByteCount theFontStyleSizes[] = { sizeof(Fixed), sizeof(CGAffineTransform) };
+    ATSUAttributeValuePtr theFontStyleValues[] = { &theSize, &theTransform };
 
     err = ATSUCreateAndCopyStyle(inStyle, &style);
 


More information about the cairo-commit mailing list