commit 5215330377e21df600142bc0abea47460249ccf8 Author: Brian Ewins Date: Fri Mar 16 23:09:56 2007 +0000 [atsui] refactor CreateSizedCopyOfStyle This is just to make it easier to use with passed-in matrices, which I'll make use of in a subsequent patch. diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 3b0d031..36b56d7 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -155,24 +155,18 @@ CGAffineTransformMakeWithCairoFontScale(const cairo_matrix_t *scale) } static ATSUStyle -CreateSizedCopyOfStyle(ATSUStyle inStyle, const cairo_matrix_t *scale) +CreateSizedCopyOfStyle(ATSUStyle inStyle, + const Fixed *theSize, + const CGAffineTransform *theTransform) { ATSUStyle style; OSStatus err; - double xscale = 1.0; - double yscale = 1.0; - CGAffineTransform theTransform; - Fixed theSize; - const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag, kATSUFontMatrixTag }; - const ByteCount theFontStyleSizes[] = { sizeof(Fixed), sizeof(CGAffineTransform) }; - ATSUAttributeValuePtr theFontStyleValues[] = { &theSize, &theTransform }; - - /* Set the style's size */ - _cairo_matrix_compute_scale_factors(scale, &xscale, &yscale, 1); - theTransform = CGAffineTransformMake(1.0, 0, - 0, yscale/xscale, - 0, 0); - theSize = FloatToFixed(xscale); + const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag, + kATSUFontMatrixTag }; + const ByteCount theFontStyleSizes[] = { sizeof(Fixed), + sizeof(CGAffineTransform) }; + ATSUAttributeValuePtr theFontStyleValues[] = { (Fixed *)theSize, + (CGAffineTransform *)theTransform }; err = ATSUCreateAndCopyStyle(inStyle, &style); @@ -228,6 +222,10 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face, cairo_atsui_font_t *font = NULL; OSStatus err; cairo_status_t status; + double xscale = 1.0; + double yscale = 1.0; + CGAffineTransform theTransform; + Fixed theSize; font = malloc(sizeof(cairo_atsui_font_t)); if (font == NULL) @@ -236,7 +234,13 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face, _cairo_scaled_font_init(&font->base, font_face, font_matrix, ctm, options, &cairo_atsui_scaled_font_backend); - font->style = CreateSizedCopyOfStyle(style, &font->base.scale); + _cairo_matrix_compute_scale_factors (&font->base.scale, + &xscale, &yscale, 1); + theTransform = CGAffineTransformMake (1.0, 0, + 0, yscale/xscale, + 0, 0); + theSize = FloatToFixed (xscale); + font->style = CreateSizedCopyOfStyle (style, &theSize, &theTransform); { Fixed theSize = FloatToFixed(1.0);