[cairo] cairo 1.3.16 with quartz and atsui

Baz brian.ewins at gmail.com
Mon Mar 5 14:00:40 PST 2007


On 05/03/07, Behdad Esfahbod <behdad at behdad.org> wrote:
> Humm, actually I want to revert that.  No backends in cairo should ever
> be exclusive.  In fact for 1.4.2, I want to make sure that no font
> backend is tied to any particular surface, and any font backend can be
> used with any surface.

Ok, mea culpa. If any-with-any is wanted, how about the patch below
(for 1.4.2). It makes quartz and atsui independent again. Doesn't fix
the quartz-xlib issue in cairo-backend.

This produces nice results with quartz+ft, the known rotation/scaling
errors in quartz+atsui, and works with image+atsui (no quartz). It may
even work with xlib+atsui once the other issues are sorted. Previously
I've tried using atsui glyph surfaces in firefox, and I got no text on
controls though, so there might be problems I havent seen with
quartz+ft. The only other issue is that I don't think old_show_glyphs
in atsui is used any more, it could just be removed (in a separate
patch).

-Baz

PS I won't be so quick off the mark pushing this one, sorry :)

diff --git a/configure.in b/configure.in
index 8608f10..b023c4c 100644
--- a/configure.in
+++ b/configure.in
@@ -269,13 +269,9 @@ CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [
 dnl ===========================================================================

 CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
-  if test "x$use_xlib" = "xyes"; then
-    use_quartz="no (requires --disable-xlib)";
-  else
-    dnl There is no pkgconfig for quartz; lets do a header check
-    AC_CHECK_HEADER(Carbon/Carbon.h, , [use_quartz="no (Carbon
headers not found)"])
-    quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
-  fi
+  dnl There is no pkgconfig for quartz; lets do a header check
+  AC_CHECK_HEADER(Carbon/Carbon.h, , [use_quartz="no (Carbon headers
not found)"])
+  quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
 ])

 dnl ===========================================================================
@@ -572,9 +568,10 @@ dnl
===========================================================================
 dnl This check should default to 'auto' once we have code to actually
 dnl check for the atsui font backend.

-CAIRO_BACKEND_ENABLE(atsui, ATSUI font, atsui, ATSUI_FONT, auto, [
-  dnl Quartz requires and is required by atsui.
-  use_atsui=$use_quartz
+CAIRO_BACKEND_ENABLE(atsui, ATSUI font, atsui, ATSUI_FONT, no, [
+  dnl There is no pkgconfig for atsui; lets do a header check
+  AC_CHECK_HEADER(Carbon/Carbon.h, , [use_atsui="no (Carbon headers
not found)"])
+  atsui_LIBS="-Xlinker -framework -Xlinker Carbon"
 ])

 dnl ===========================================================================
diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index fff7a22..1eb95b7 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -908,6 +908,7 @@ _cairo_atsui_font_text_to_glyphs (void
 *abstract_font,
     return CAIRO_STATUS_SUCCESS;
 }

+#if CAIRO_HAS_QUARTZ_SURFACE
 static cairo_int_status_t
 _cairo_atsui_font_old_show_glyphs (void                       *abstract_font,
                                   cairo_operator_t     op,
@@ -1024,6 +1025,7 @@ _cairo_atsui_font_old_show_glyphs (void
        *abstract_font,

     return CAIRO_STATUS_SUCCESS;
 }
+#endif /* CAIRO_HAS_QUARTZ_SURFACE */

 cairo_bool_t
 _cairo_scaled_font_is_atsui (cairo_scaled_font_t *sfont)
@@ -1078,7 +1080,11 @@ const cairo_scaled_font_backend_t
cairo_atsui_scaled_font_backend = {
     _cairo_atsui_font_scaled_glyph_init,
     _cairo_atsui_font_text_to_glyphs,
     NULL, /* ucs4_to_index */
+#if CAIRO_HAS_QUARTZ_SURFACE
     _cairo_atsui_font_old_show_glyphs,
+#else
+    NULL,
+#endif /* CAIRO_HAS_QUARTZ_SURFACE */
     _cairo_atsui_load_truetype_table,
     NULL, /* map_glyphs_to_unicode */
 };
diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h
index 1000e73..d3c9c6b 100644
--- a/src/cairo-quartz-private.h
+++ b/src/cairo-quartz-private.h
@@ -39,6 +39,8 @@
 #define CAIRO_QUARTZ_PRIVATE_H

 #include <cairoint.h>
+
+#ifdef CAIRO_HAS_QUARTZ_SURFACE
 #include <cairo-quartz.h>

 typedef struct cairo_nquartz_surface {
@@ -59,7 +61,9 @@ typedef struct cairo_nquartz_surface {
     CGShadingRef sourceShading;
     CGPatternRef sourcePattern;
 } cairo_nquartz_surface_t, cairo_quartz_surface_t;
+#endif /* CAIRO_HAS_QUARTZ_SURFACE */

+#if CAIRO_HAS_ATSUI_FONT
 cairo_bool_t
 _cairo_scaled_font_is_atsui (cairo_scaled_font_t *sfont);

@@ -68,5 +72,6 @@ _cairo_atsui_scaled_font_get_atsu_style
(cairo_scaled_font_t *sfont);

 ATSUFontID
 _cairo_atsui_scaled_font_get_atsu_font_id (cairo_scaled_font_t *sfont);
+#endif /* CAIRO_HAS_ATSUI_FONT */

 #endif /* CAIRO_QUARTZ_PRIVATE_H */
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 86b39f9..d601aae 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1239,6 +1239,7 @@ _cairo_nquartz_surface_stroke (void *abstract_surface,
     return rv;
 }

+#if CAIRO_HAS_ATSUI_FONT
 static cairo_int_status_t
 _cairo_nquartz_surface_show_glyphs (void *abstract_surface,
                                    cairo_operator_t op,
@@ -1351,6 +1352,7 @@ _cairo_nquartz_surface_show_glyphs (void
*abstract_surface,

     return rv;
 }
+#endif /* CAIRO_HAS_ATSUI_FONT */

 static cairo_int_status_t
 _cairo_nquartz_surface_mask (void *abstract_surface,
@@ -1455,7 +1457,11 @@ static const struct _cairo_surface_backend
cairo_nquartz_surface_backend = {
     _cairo_nquartz_surface_mask,
     _cairo_nquartz_surface_stroke,
     _cairo_nquartz_surface_fill,
+#if CAIRO_HAS_ATSUI_FONT
     _cairo_nquartz_surface_show_glyphs,
+#else
+    NULL, /* surface_show_glyphs */
+#endif /* CAIRO_HAS_ATSUI_FONT */

     NULL, /* snapshot */
 };


More information about the cairo mailing list