[cairo-commit] src/cairo-font-face.c src/cairoint.h

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Dec 19 22:06:48 PST 2008


 src/cairo-font-face.c |   55 +++++++++-----------------------------------------
 src/cairoint.h        |    2 -
 2 files changed, 11 insertions(+), 46 deletions(-)

New commits:
commit 8bf49b27aeea8179b5862a424fb3ef1934be6e0e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Dec 19 20:46:36 2008 -0500

    [font-face] Use cairo_font_face_t instead of toy, for nil objects
    
    And with a NULL backend.  We are not supposed to read the nil objects
    afterall.
    
    If this causes crashes, the crash site should be fixed.

diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index 88e782b..6161c0c 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -45,79 +45,44 @@ static const cairo_font_face_backend_t _cairo_toy_font_face_backend;
 
 /* #cairo_font_face_t */
 
-const cairo_toy_font_face_t _cairo_font_face_nil = {
-    {
+const cairo_font_face_t _cairo_font_face_nil = {
     { 0 },				/* hash_entry */
     CAIRO_STATUS_NO_MEMORY,		/* status */
     CAIRO_REFERENCE_COUNT_INVALID,	/* ref_count */
     { 0, 0, 0, NULL },			/* user_data */
-    &_cairo_toy_font_face_backend
-    },
-    CAIRO_FONT_FAMILY_DEFAULT,		/* family */
-    TRUE,				/* owns_family */
-    CAIRO_FONT_SLANT_DEFAULT,		/* slant */
-    CAIRO_FONT_WEIGHT_DEFAULT,		/* weight */
-    NULL				/* impl_face */
+    NULL
 };
 
-static const cairo_toy_font_face_t _cairo_font_face_null_pointer = {
-    {
+static const cairo_font_face_t _cairo_font_face_null_pointer = {
     { 0 },				/* hash_entry */
     CAIRO_STATUS_NULL_POINTER,		/* status */
     CAIRO_REFERENCE_COUNT_INVALID,	/* ref_count */
     { 0, 0, 0, NULL },			/* user_data */
-    &_cairo_toy_font_face_backend
-    },
-    CAIRO_FONT_FAMILY_DEFAULT,		/* family */
-    TRUE,				/* owns_family */
-    CAIRO_FONT_SLANT_DEFAULT,		/* slant */
-    CAIRO_FONT_WEIGHT_DEFAULT,		/* weight */
-    NULL				/* impl_face */
+    NULL
 };
 
-static const cairo_toy_font_face_t _cairo_font_face_invalid_string = {
-    {
+static const cairo_font_face_t _cairo_font_face_invalid_string = {
     { 0 },				/* hash_entry */
     CAIRO_STATUS_INVALID_STRING,	/* status */
     CAIRO_REFERENCE_COUNT_INVALID,	/* ref_count */
     { 0, 0, 0, NULL },			/* user_data */
-    &_cairo_toy_font_face_backend
-    },
-    CAIRO_FONT_FAMILY_DEFAULT,		/* family */
-    TRUE,				/* owns_family */
-    CAIRO_FONT_SLANT_DEFAULT,		/* slant */
-    CAIRO_FONT_WEIGHT_DEFAULT,		/* weight */
-    NULL				/* impl_face */
+    NULL
 };
 
-static const cairo_toy_font_face_t _cairo_font_face_invalid_slant = {
-    {
+static const cairo_font_face_t _cairo_font_face_invalid_slant = {
     { 0 },				/* hash_entry */
     CAIRO_STATUS_INVALID_SLANT,		/* status */
     CAIRO_REFERENCE_COUNT_INVALID,	/* ref_count */
     { 0, 0, 0, NULL },			/* user_data */
-    &_cairo_toy_font_face_backend
-    },
-    CAIRO_FONT_FAMILY_DEFAULT,		/* family */
-    TRUE,				/* owns_family */
-    CAIRO_FONT_SLANT_DEFAULT,		/* slant */
-    CAIRO_FONT_WEIGHT_DEFAULT,		/* weight */
-    NULL				/* impl_face */
+    NULL
 };
 
-static const cairo_toy_font_face_t _cairo_font_face_invalid_weight = {
-    {
+static const cairo_font_face_t _cairo_font_face_invalid_weight = {
     { 0 },				/* hash_entry */
     CAIRO_STATUS_INVALID_WEIGHT,	/* status */
     CAIRO_REFERENCE_COUNT_INVALID,	/* ref_count */
     { 0, 0, 0, NULL },			/* user_data */
-    &_cairo_toy_font_face_backend
-    },
-    CAIRO_FONT_FAMILY_DEFAULT,		/* family */
-    TRUE,				/* owns_family */
-    CAIRO_FONT_SLANT_DEFAULT,		/* slant */
-    CAIRO_FONT_WEIGHT_DEFAULT,		/* weight */
-    NULL				/* impl_face */
+    NULL
 };
 
 cairo_status_t
diff --git a/src/cairoint.h b/src/cairoint.h
index e98bac0..f0ce77f 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1368,7 +1368,7 @@ _cairo_color_equal (const cairo_color_t *color_a,
 
 /* cairo-font-face.c */
 
-extern const cairo_private cairo_toy_font_face_t _cairo_font_face_nil;
+extern const cairo_private cairo_font_face_t _cairo_font_face_nil;
 
 cairo_private void
 _cairo_font_face_init (cairo_font_face_t               *font_face,


More information about the cairo-commit mailing list