[cairo-commit] cairo/src cairo-atsui-font.c,1.27,1.28

Anders Carlsson commit at pdx.freedesktop.org
Tue Jan 10 07:54:20 PST 2006


Committed by: andersca

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv24547/src

Modified Files:
	cairo-atsui-font.c 
Log Message:
2006-01-10  Anders Carlsson  <andersca at imendio.com>

        * src/cairo-atsui-font.c:
        (CGAffineTransformMakeWithCairoFontScale):
        (CreateSizedCopyOfStyle):        
        (_cairo_atsui_font_create_scaled):
        (_cairo_atsui_font_old_show_glyphs):
        Remove old scale matrix since it exists in our base class.

        (_cairo_atsui_font_set_metrics):
        Fix descent calculation.



Index: cairo-atsui-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-atsui-font.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cairo-atsui-font.c	10 Jan 2006 13:29:00 -0000	1.27
+++ cairo-atsui-font.c	10 Jan 2006 15:54:17 -0000	1.28
@@ -54,7 +54,6 @@
 struct _cairo_atsui_font {
     cairo_scaled_font_t base;
 
-    cairo_matrix_t scale;
     ATSUStyle style;
     ATSUStyle unscaled_style;
     ATSUFontID fontID;
@@ -120,7 +119,7 @@
 
 
 static CGAffineTransform
-CGAffineTransformMakeWithCairoFontScale(cairo_matrix_t *scale)
+CGAffineTransformMakeWithCairoFontScale(const cairo_matrix_t *scale)
 {
     return CGAffineTransformMake(scale->xx, scale->yx,
                                  scale->xy, scale->yy,
@@ -128,7 +127,7 @@
 }
 
 static ATSUStyle
-CreateSizedCopyOfStyle(ATSUStyle inStyle, cairo_matrix_t *scale)
+CreateSizedCopyOfStyle(ATSUStyle inStyle, const cairo_matrix_t *scale)
 {
     ATSUStyle style;
     OSStatus err;
@@ -168,17 +167,17 @@
                                         &metrics);
 
         if (err == noErr) {
-	    cairo_font_extents_t extents;
+	    	cairo_font_extents_t extents;
 	    
             extents.ascent = metrics.ascent;
-            extents.descent = metrics.descent;
+            extents.descent = -metrics.descent;
             extents.height = metrics.capHeight;
             extents.max_x_advance = metrics.maxAdvanceWidth;
 
             // The FT backend doesn't handle max_y_advance either, so we'll ignore it for now. 
             extents.max_y_advance = 0.0;
 
-	    _cairo_scaled_font_set_metrics (&font->base, &extents);
+	    	_cairo_scaled_font_set_metrics (&font->base, &extents);
 
             return CAIRO_STATUS_SUCCESS;
         }
@@ -197,7 +196,6 @@
 				 cairo_scaled_font_t **font_out)
 {
     cairo_atsui_font_t *font = NULL;
-    cairo_matrix_t scale;
     OSStatus err;
     cairo_status_t status;
 
@@ -206,8 +204,7 @@
     _cairo_scaled_font_init(&font->base, font_face, font_matrix, ctm, options,
 			    &cairo_atsui_scaled_font_backend);
 
-    cairo_matrix_multiply(&scale, font_matrix, ctm);
-    font->style = CreateSizedCopyOfStyle(style, &scale);
+    font->style = CreateSizedCopyOfStyle(style, &font->base.scale);
 
     Fixed theSize = FloatToFixed(1.0);
     const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag };
@@ -221,7 +218,6 @@
     font->unscaled_style = style;
 
     font->fontID = font_id;
-    font->scale = scale;
 
     *font_out = &font->base;
 
@@ -588,7 +584,7 @@
     CGContextSetFont(myBitmapContext, cgFont);
 
     CGAffineTransform textTransform =
-        CGAffineTransformMakeWithCairoFontScale(&font->scale);
+        CGAffineTransformMakeWithCairoFontScale(&font->base.scale);
 
     textTransform = CGAffineTransformScale(textTransform, 1.0f, -1.0f);
 



More information about the cairo-commit mailing list