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

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Dec 17 15:19:27 PST 2008


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

New commits:
commit 5ee6aad471d460f960a5e7a5a8e35aca0f0af60e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Dec 17 18:05:51 2008 -0500

    [toy] Use twin font if font backend returns UNSUPPORTED

diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index 8a1b292..88e782b 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -402,26 +402,23 @@ _cairo_toy_font_face_create_impl_face (cairo_toy_font_face_t *font_face)
 {
     const cairo_font_face_backend_t * backend = CAIRO_FONT_FACE_BACKEND_DEFAULT;
     cairo_font_face_t *impl_font_face;
-    cairo_status_t status;
+    cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED;
 
     if (font_face->base.status)
 	return NULL;
 
-    if (backend->create_for_toy == NULL ||
-	(CAIRO_FONT_FACE_BACKEND_DEFAULT != &_cairo_user_font_face_backend &&
-	 0 == strncmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT,
-		       strlen (CAIRO_USER_FONT_FAMILY_DEFAULT))))
+    if (backend->create_for_toy != NULL &&
+	0 != strncmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT,
+		      strlen (CAIRO_USER_FONT_FAMILY_DEFAULT)))
     {
-	backend = &_cairo_user_font_face_backend;
+	status = backend->create_for_toy (font_face, &impl_font_face);
     }
 
-    if (backend->create_for_toy == NULL) {
-	ASSERT_NOT_REACHED;
-	return NULL;
+    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+	backend = &_cairo_user_font_face_backend;
+	status = backend->create_for_toy (font_face, &impl_font_face);
     }
 
-    status = backend->create_for_toy (font_face, &impl_font_face);
-
     if (_cairo_font_face_set_error (&font_face->base, status))
 	return NULL;
 
commit eb069094ea4471b3e63881fe0f8b958ad8924c7d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Dec 17 17:30:34 2008 -0500

    Treat any toy family starting with "@cairo:" as request for twin

diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index 8481b12..8a1b292 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -409,7 +409,8 @@ _cairo_toy_font_face_create_impl_face (cairo_toy_font_face_t *font_face)
 
     if (backend->create_for_toy == NULL ||
 	(CAIRO_FONT_FACE_BACKEND_DEFAULT != &_cairo_user_font_face_backend &&
-	 0 == strcmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT)))
+	 0 == strncmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT,
+		       strlen (CAIRO_USER_FONT_FAMILY_DEFAULT))))
     {
 	backend = &_cairo_user_font_face_backend;
     }
diff --git a/src/cairoint.h b/src/cairoint.h
index 6ae68d0..55752f5 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -968,7 +968,7 @@ typedef struct _cairo_traps {
 #define CAIRO_WIN32_FONT_FAMILY_DEFAULT "Arial"
 #define CAIRO_QUARTZ_FONT_FAMILY_DEFAULT  "Helvetica"
 #define CAIRO_FT_FONT_FAMILY_DEFAULT     ""
-#define CAIRO_USER_FONT_FAMILY_DEFAULT     "<cairo>"
+#define CAIRO_USER_FONT_FAMILY_DEFAULT     "@cairo:"
 
 #if   CAIRO_HAS_WIN32_FONT
 


More information about the cairo-commit mailing list