[cairo-commit] cairo/src cairo-atsui-font.c, 1.16, 1.17 cairo-font.c, 1.62, 1.63 cairo-ft-font.c, 1.88, 1.89 cairo-win32-font.c, 1.33, 1.34 cairoint.h, 1.179, 1.180

Carl Worth commit at pdx.freedesktop.org
Fri Aug 5 16:44:22 PDT 2005


Committed by: cworth

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

Modified Files:
	cairo-atsui-font.c cairo-font.c cairo-ft-font.c 
	cairo-win32-font.c cairoint.h 
Log Message:

2005-08-05  Carl Worth  <cworth at cworth.org>

        * src/cairoint.h: Rename scaled_font_backend->create to
        create_toy. Move declaration of cairo_simple_font_face_t from
        cairo_font.c to cairoint.h and rename it
        cairo_toy_font_face_t. Rework create_toy to accept a
        cairo_toy_font_face_t rather than separate family, slant, and
        weight.

        * src/cairo-atsui-font.c: (_cairo_atsui_font_create_toy):
        * src/cairo-ft-font.c: (_cairo_ft_scaled_font_create_toy):
        * src/cairo-win32-font.c: (_cairo_win32_scaled_font_create_toy):
        Track change in create_toy interface.

        * src/cairo-font.c: (_cairo_toy_font_face_create_from_cache_key),
        (_cairo_simple_font_cache_create_entry),
        (_cairo_simple_font_face_destroy),
        (_cairo_simple_font_face_create_font):
        Partial rename of simple->toy. It's not complete as this is a step
        in the process of merging in a large patch of mine which actually
        removes most of the affected code.


Index: cairo-atsui-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-atsui-font.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cairo-atsui-font.c	31 Jul 2005 05:21:12 -0000	1.16
+++ cairo-atsui-font.c	5 Aug 2005 23:44:20 -0000	1.17
@@ -105,13 +105,11 @@
 
 
 static cairo_status_t
-_cairo_atsui_font_create(const char *family,
-			 cairo_font_slant_t slant,
-			 cairo_font_weight_t weight,
-			 const cairo_matrix_t *font_matrix,
-			 const cairo_matrix_t *ctm,
-			 const cairo_font_options_t *options,
-			 cairo_scaled_font_t **font_out)
+_cairo_atsui_font_create_toy(const cairo_toy_font_face *toy_face,
+			     const cairo_matrix_t *font_matrix,
+			     const cairo_matrix_t *ctm,
+			     const cairo_font_options_t *options,
+			     cairo_scaled_font_t **font_out)
 {
     cairo_atsui_font_t *font = NULL;
     ATSUStyle style;
@@ -119,11 +117,11 @@
     OSStatus err;
     Boolean isItalic, isBold;
     cairo_matrix_t scale;
+    const char *family = toy_face->family;
 
     err = ATSUCreateStyle(&style);
 
-
-    switch (weight) {
+    switch (toy_face->weight) {
     case CAIRO_FONT_WEIGHT_BOLD:
         isBold = true;
         break;
@@ -133,7 +131,7 @@
         break;
     }
 
-    switch (slant) {
+    switch (toy_face->slant) {
     case CAIRO_FONT_SLANT_ITALIC:
         isItalic = true;
         break;
@@ -214,7 +212,6 @@
     return CAIRO_STATUS_SUCCESS;
 }
 
-
 static void
 _cairo_atsui_font_destroy_font(void *abstract_font)
 {
@@ -691,7 +688,7 @@
 }
 
 const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = {
-    _cairo_atsui_font_create,
+    _cairo_atsui_font_create_toy,
     _cairo_atsui_font_destroy_font,
     _cairo_atsui_font_font_extents,
     _cairo_atsui_font_text_to_glyphs,

Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- cairo-font.c	5 Aug 2005 17:40:32 -0000	1.62
+++ cairo-font.c	5 Aug 2005 23:44:20/xmessage.man/1.2/=//
/xmessage.h/1.1.1.1/=//
/xmessage.c/1.2/=//
/readfile.h/1.1.1.1/=//
/readfile.c/1.2/=//
/makeform.c/1.2/=//
/Xmessage.ad/1.1.1.1/=//
/Xmessage-color.ad/1.2/=//
/Tests/1.1.1.1/=//
/README/1.1.1.1/=//
/Imakefile/1.2/=//
D
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       fcslant = FC_SLANT_ITALIC;
@@ -1457,7 +1456,7 @@
         break;
     }
 
-    if (!FcPatternAddString (pattern, FC_FAMILY, (unsigned char *) family))
+    if (!FcPatternAddString (pattern, FC_FAMILY, family))
 	goto FREE_PATTERN;
     if (!FcPatternAddInteger (pattern, FC_SLANT, fcslant))
 	goto FREE_PATTERN;
@@ -2028,7 +2027,7 @@
 }
 
 const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend = {
-    _cairo_ft_scaled_font_create,
+    _cairo_ft_scaled_font_create_toy,
     _cairo_ft_scaled_font_destroy,
     _cairo_ft_scaled_font_font_extents,
     _cairo_ft_scaled_font_text_to_glyphs,

Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- cairo-win32-font.c	29 Jul 2005 19:45:01 -0000	1.33
+++ cairo-win32-font.c	5 Aug 2005 23:44:20 -0000	1.34
@@ -427,13 +427,11 @@
 /* implement the font backend interface */
 
 static cairo_status_t
-_cairo_win32_scaled_font_create (const char                  *family, 
-				 cairo_font_slant_t          slant, 
-				 cairo_font_weight_t         weight,
-				 const cairo_matrix_t       *font_matrix,
-				 const cairo_matrix_t       *ctm,
-				 const cairo_font_options_t *options,
-				 cairo_scaled_font_t       **scaled_font_out)
+_cairo_win32_scaled_font_create_toy (const cairo_toy_font_face_t *toy_face,
+				     const cairo_matrix_t        *font_matrix,
+				     const cairo_matrix_t        *ctm,
+				     const cairo_font_options_t  *options,
+				     cairo_scaled_font_t        **scaled_font_out)
 {
     LOGFONTW logfont;
     cairo_scaled_font_t *scaled_font;
@@ -441,7 +439,8 @@
     int face_name_len;
     cairo_status_t status;
 
-    status = _cairo_utf8_to_utf16 (family, -1, &face_name, &face_name_len);
+    status = _cairo_utf8_to_utf16 (toy_face->family, -1,
+				   &face_name, &face_name_len);
     if (status)
 	return status;
 
@@ -458,7 +457,7 @@
     logfont.lfEscapement = 0;	/* filled in later */
     logfont.lfOrientation = 0;	/* filled in later */
 
-    switch (weight) {
+    switch (toy_face->weight) {
     case CAIRO_FONT_WEIGHT_NORMAL:
     default:
 	logfont.lfWeight = FW_NORMAL;
@@ -468,7 +467,7 @@
 	break;
     }
 
-    switch (slant) {
+    switch (toy_face->slant) {
     case CAIRO_FONT_SLANT_NORMAL:
     default:
 	logfont.lfItalic = FALSE;
@@ -1272,7 +1271,7 @@
 }
 
 const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend = {
-    _cairo_win32_scaled_font_create,
+    _cairo_win32_scaled_font_create_toy,
     _cairo_win32_scaled_font_destroy,
     _cairo_win32_scaled_font_font_extents,
     _cairo_win32_scaled_font_text_to_glyphs,

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- cairoint.h	5 Aug 2005 05:45:59 -0000	1.179
+++ cairoint.h	5 Aug 2005 23:44:20 -0000	1.180
@@ -559,14 +559,23 @@
 				     cairo_image_glyph_cache_entry_t *entry);
 };
 
+/* cairo_toy_font_face_t - simple family/slant/weight font faces used for
+ * the built-in font API
+ */
+
+typedef struct _cairo_toy_font_face {
+    cairo_font_face_t base;
+    char *family;
+    cairo_font_slant_t slant;
+    cairo_font_weight_t weight;
+} cairo_toy_font_face_t;
+
 struct _cairo_scaled_font_backend {
-    cairo_status_t (*create)         (const char	       *family,
-				      cairo_font_slant_t	slant,
-				      cairo_font_weight_t	weight,
-				      const cairo_matrix_t     *font_matrix,
-				      const cairo_matrix_t     *ctm,
-				      const cairo_font_options_t *options,
-				      cairo_scaled_font_t      **font);
+    cairo_status_t (*create_toy)     (const cairo_toy_font_face_t *toy_face,
+				      const cairo_matrix_t	  *font_matrix,
+				      const cairo_matrix_t	  *ctm,
+				      const cairo_font_options_t  *options,
+				      cairo_scaled_font_t	 **font);
     
     void (*destroy)                   (void		       *font);
 




More information about the cairo-commit mailing list