[cairo-commit] cairo/src cairo-ft-font.c,1.112,1.113

Keith Packard commit at pdx.freedesktop.org
Fri Sep 2 13:38:09 EST 2005


Committed by: keithp

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

Modified Files:
	cairo-ft-font.c 
Log Message:
2005-09-01  Keith Packard  <keithp at keithp.com>

	reviewed by: otaylor deserves credit for noticing a problem

	* src/cairo-ft-font.c: (_cairo_ft_scaled_font_create):
	Oops. Call _cairo_scaled_font_set_metrics to set user-space
	metrics for scaled fonts.


Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- cairo-ft-font.c	1 Sep 2005 02:11:22 -0000	1.112
+++ cairo-ft-font.c	2 Sep 2005 03:38:07 -0000	1.113
@@ -1398,6 +1398,7 @@
     cairo_ft_scaled_font_t *scaled_font = NULL;
     FT_Face face;
     FT_Size_Metrics *metrics;
+    cairo_font_extents_t fs_metrics;
 
     face = _cairo_ft_unscaled_font_lock_face (unscaled);
     if (!face)
@@ -1444,24 +1445,25 @@
 	else
 	    y_factor = 1 / unscaled->y_scale;
 
-	scaled_font->base.extents.ascent =        DOUBLE_FROM_26_6(metrics->ascender) * y_factor;
-	scaled_font->base.extents.descent =       DOUBLE_FROM_26_6(- metrics->descender) * y_factor;
-	scaled_font->base.extents.height =        DOUBLE_FROM_26_6(metrics->height) * y_factor;
-	scaled_font->base.extents.max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) * x_factor;
+	fs_metrics.ascent =        DOUBLE_FROM_26_6(metrics->ascender) * y_factor;
+	fs_metrics.descent =       DOUBLE_FROM_26_6(- metrics->descender) * y_factor;
+	fs_metrics.height =        DOUBLE_FROM_26_6(metrics->height) * y_factor;
+	fs_metrics.max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) * x_factor;
     } else {
 	double scale = face->units_per_EM;
 
-	scaled_font->base.extents.ascent =        face->ascender / scale;
-	scaled_font->base.extents.descent =       - face->descender / scale;
-	scaled_font->base.extents.height =        face->height / scale;
-	scaled_font->base.extents.max_x_advance = face->max_advance_width / scale;
+	fs_metrics.ascent =        face->ascender / scale;
+	fs_metrics.descent =       - face->descender / scale;
+	fs_metrics.height =        face->height / scale;
+	fs_metrics.max_x_advance = face->max_advance_width / scale;
     }
 
     
     /* FIXME: this doesn't do vertical layout atm. */
-    scaled_font->base.extents.max_y_advance = 0.0;
-
+    fs_metrics.max_y_advance = 0.0;
     
+    _cairo_scaled_font_set_metrics (&scaled_font->base, &fs_metrics);
+
     return &scaled_font->base;
 }
 



More information about the cairo-commit mailing list