[cairo-commit] cairo/src cairo-font.c, 1.58, 1.59 cairo-ft-font.c, 1.83, 1.84 cairo-win32-font.c, 1.32, 1.33 cairoint.h, 1.174, 1.175

Owen Taylor commit at pdx.freedesktop.org
Fri Jul 29 12:45:04 PDT 2005


Committed by: otaylor

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

Modified Files:
	cairo-font.c cairo-ft-font.c cairo-win32-font.c cairoint.h 
Log Message:
2005-07-29  Owen Taylor  <otaylor at redhat.com>

        * src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c
        src/cairoint.h: Move the font options into the base
        cairo_scaled_font_t object so that we have them available
        to use when we are removing a scaled font from the cache.
        (http://bugzilla.gnome.org/show_bug.cgi?id=#311299,
        Ali Akcaagac, Behdad Esfahbod)


Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- cairo-font.c	28 Jul 2005 16:29:46 -0000	1.58
+++ cairo-font.c	29 Jul 2005 19:45:01 -0000	1.59
@@ -466,6 +466,10 @@
     { 1., 0., 0., 1., 0, 0},	/* font_matrix */
     { 1., 0., 0., 1., 0, 0},	/* ctm */
     { 1., 0., 0., 1., 0, 0},	/* scale */
+    { CAIRO_ANTIALIAS_DEFAULT,	/* options */
+      CAIRO_SUBPIXEL_ORDER_DEFAULT,
+      CAIRO_HINT_STYLE_DEFAULT,
+      CAIRO_HINT_METRICS_DEFAULT} ,
     NULL,			/* font_face */
     CAIRO_SCALED_FONT_BACKEND_DEFAULT,
 };
@@ -864,6 +868,7 @@
 _cairo_scaled_font_init (cairo_scaled_font_t               *scaled_font, 
 			 const cairo_matrix_t              *font_matrix,
 			 const cairo_matrix_t              *ctm,
+			 const cairo_font_options_t        *options,
 			 const cairo_scaled_font_backend_t *backend)
 {
     scaled_font->status = CAIRO_STATUS_SUCCESS;
@@ -871,6 +876,8 @@
     scaled_font->font_matrix = *font_matrix;
     scaled_font->ctm = *ctm;
     cairo_matrix_multiply (&scaled_font->scale, &scaled_font->font_matrix, &scaled_font->ctm);
+
+    scaled_font->options = *options;
     
     scaled_font->ref_count = 1;
     scaled_font->backend = backend;
@@ -1071,6 +1078,7 @@
 	key.font_face = scaled_font->font_face;
 	key.font_matrix = &scaled_font->font_matrix;
 	key.ctm = &scaled_font->ctm;
+	key.options = scaled_font->options;
 	
 	_cairo_cache_remove (cache, &key);
 	_unlock_global_font_cache ();

Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- cairo-ft-font.c	28 Jul 2005 18:46:01 -0000	1.83
+++ cairo-ft-font.c	29 Jul 2005 19:45:01 -0000	1.84
@@ -1218,7 +1218,6 @@
 typedef struct {
     cairo_scaled_font_t base;
     int load_flags;
-    cairo_font_options_t options;
     ft_unscaled_font_t *unscaled;
 } cairo_ft_scaled_font_t;
 
@@ -1385,14 +1384,12 @@
     f->unscaled = unscaled;
     _cairo_unscaled_font_reference (&unscaled->base);
     
-    f->options = *options;
-
     if (options->hint_metrics != CAIRO_HINT_METRICS_OFF)
 	load_flags |= PRIVATE_FLAG_HINT_METRICS;
 
     f->load_flags = load_flags;
 
-    _cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_ft_scaled_font_backend);
+    _cairo_scaled_font_init (&f->base, font_matrix, ctm, options, &cairo_ft_scaled_font_backend);
 
     return (cairo_scaled_font_t *)f;
 }
@@ -1611,7 +1608,7 @@
      * Get to unscaled metrics so that the upper level can get back to
      * user space
      */
-    if (scaled_font->options.hint_metrics != CAIRO_HINT_METRICS_OFF) {
+    if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) {
 	double x_factor, y_factor;
 
 	if (scaled_font->unscaled->x_scale == 0)

Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cairo-win32-font.c	28 Jul 2005 17:37:41 -0000	1.32
+++ cairo-win32-font.c	29 Jul 2005 19:45:01 -0000	1.33
@@ -58,7 +58,6 @@
     cairo_scaled_font_t base;
 
     LOGFONTW logfont;
-    cairo_font_options_t options;
 
     BYTE quality;
 
@@ -227,7 +226,6 @@
 	return NULL;
 
     f->logfont = *logfont;
-    f->options = *options;
 
     /* We don't have any control over the hinting style or subpixel
      * order in the Win32 font API, so we ignore those parts of
@@ -263,7 +261,7 @@
     cairo_matrix_multiply (&scale, font_matrix, ctm);
     _compute_transform (f, &scale);
 
-    _cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_win32_scaled_font_backend);
+    _cairo_scaled_font_init (&f->base, font_matrix, ctm, options, &cairo_win32_scaled_font_backend);
 
     return &f->base;
 }

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- cairoint.h	28 Jul 2005 17:41:08 -0000	1.174
+++ cairoint.h	29 Jul 2005 19:45:01 -0000	1.175
@@ -458,13 +458,22 @@
     const cairo_unscaled_font_backend_t *backend;
 };
 
+struct _cairo_font_options {
+    cairo_antialias_t antialias;
+    cairo_subpixel_order_t subpixel_order;
+    cairo_hint_style_t hint_style;
+    cairo_hint_metrics_t hint_metrics;
+};
+
 struct _cairo_scaled_font {
     cairo_status_t status;
     int ref_count;
     cairo_matrix_t font_matrix;	  /* font space => user space */
     cairo_matrix_t ctm;	          /* user space => device space */
     cairo_matrix_t scale;	  /* font space => device space */
+    cairo_font_options_t options;
     cairo_font_face_t *font_face; /* may be NULL */
+
     const cairo_scaled_font_backend_t *backend;
 };
 
@@ -475,13 +484,6 @@
     const cairo_font_face_backend_t *backend;
 };
 
-struct _cairo_font_options {
-    cairo_antialias_t antialias;
-    cairo_subpixel_order_t subpixel_order;
-    cairo_hint_style_t hint_style;
-    cairo_hint_metrics_t hint_metrics;
-};
-
 /* cairo_font.c is responsible for a global glyph cache: 
  *  
  *   - glyph entries: [[[base], cairo_unscaled_font_t, scale, flags, index],
@@ -1320,6 +1322,7 @@
 _cairo_scaled_font_init (cairo_scaled_font_t 	           *scaled_font, 
 			 const cairo_matrix_t              *font_matrix,
 			 const cairo_matrix_t              *ctm,
+			 const cairo_font_options_t        *options,
 			 const cairo_scaled_font_backend_t *backend);
 
 cairo_private void




More information about the cairo-commit mailing list