[cairo-commit] 3 commits - configure.in src/cairo-atsui-font.c src/cairo-atsui.h src/cairo-deprecated.h src/cairo.h src/cairoint.h src/cairo-quartz.h src/cairo-quartz-private.h src/cairo-quartz-surface.c src/Makefile.am test/clip-operator-quartz-ref.png test/clip-operator-quartz-rgb24-ref.png test/dash-curve-quartz-ref.png test/dash-state-quartz-ref.png test/degenerate-path-quartz-ref.png test/degenerate-path-quartz-rgb24-ref.png test/Makefile.am test/operator-source-quartz-ref.png test/operator-source-quartz-rgb24-ref.png test/unbounded-operator-quartz-ref.png test/unbounded-operator-quartz-rgb24-ref.png

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Mon Mar 17 17:38:21 PDT 2008


 configure.in                                 |   35 ++------
 src/Makefile.am                              |   17 +--
 src/cairo-atsui-font.c                       |   39 +++-----
 src/cairo-atsui.h                            |   58 -------------
 src/cairo-deprecated.h                       |    2 
 src/cairo-quartz-private.h                   |   14 ---
 src/cairo-quartz-surface.c                   |  118 +++++++++++++++++----------
 src/cairo-quartz.h                           |   15 +++
 src/cairo.h                                  |    4 
 src/cairoint.h                               |   10 +-
 test/Makefile.am                             |   10 ++
 test/clip-operator-quartz-ref.png            |binary
 test/clip-operator-quartz-rgb24-ref.png      |binary
 test/dash-curve-quartz-ref.png               |binary
 test/dash-state-quartz-ref.png               |binary
 test/degenerate-path-quartz-ref.png          |binary
 test/degenerate-path-quartz-rgb24-ref.png    |binary
 test/operator-source-quartz-ref.png          |binary
 test/operator-source-quartz-rgb24-ref.png    |binary
 test/unbounded-operator-quartz-ref.png       |binary
 test/unbounded-operator-quartz-rgb24-ref.png |binary
 21 files changed, 144 insertions(+), 178 deletions(-)

New commits:
commit 1ab804891bb71fd742ccc7a228483c53aee282a4
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Mar 17 17:37:24 2008 -0700

    [quartz] Additional test reference images for quartz

diff --git a/test/Makefile.am b/test/Makefile.am
index ce5f031..61edb73 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -280,6 +280,8 @@ REFERENCE_IMAGES = \
 	clip-operator-pdf-argb32-ref.png \
 	clip-operator-ps-argb32-ref.png	\
 	clip-operator-rgb24-ref.png	\
+	clip-operator-quartz-ref.png	\
+	clip-operator-quartz-rgb24ref.png	\
 	clip-push-group-ps-argb32-ref.png	\
 	clip-push-group-ps-rgb24-ref.png	\
 	clip-push-group-quartz-ref.png	\
@@ -305,6 +307,7 @@ REFERENCE_IMAGES = \
 	dash-caps-joins-ref.png	\
 	dash-curve-ref.png	\
 	dash-curve-ps-ref.png \
+	dash-curve-quartz-ref.png \
 	dash-no-dash-ref.png	\
 	dash-offset-negative-ref.png	\
 	dash-scale-ps-argb32-ref.png	\
@@ -313,6 +316,7 @@ REFERENCE_IMAGES = \
 	dash-scale-ref.png	\
 	dash-state-ps-ref.png	\
 	dash-state-ref.png	\
+	dash-state-quartz-ref.png	\
 	dash-zero-length-ps-ref.png	\
 	dash-zero-length-ps-rgb24-ref.png	\
 	dash-zero-length-ref.png	\
@@ -324,6 +328,8 @@ REFERENCE_IMAGES = \
 	degenerate-path-ps-rgb24-ref.png	\
 	degenerate-path-ref.png	\
 	degenerate-path-rgb24-ref.png	\
+	degenerate-path-quartz-ref.png	\
+	degenerate-path-quartz-rgb24-ref.png	\
 	device-offset-positive-ref.png	\
 	device-offset-positive-rgb24-ref.png	\
 	device-offset-ref.png	\
@@ -461,6 +467,8 @@ REFERENCE_IMAGES = \
 	operator-source-ps-rgb24-ref.png	\
 	operator-source-ref.png	\
 	operator-source-rgb24-ref.png	\
+	operator-source-quartz-ref.png \
+	operator-source-quartz-rgb24-ref.png \
 	over-above-source-ps-argb32-ref.png       \
 	over-above-source-quartz-ref.png	  \
 	over-above-source-quartz-rgb24-ref.png	  \
@@ -607,6 +615,8 @@ REFERENCE_IMAGES = \
 	unantialiased-shapes-quartz-ref.png \
 	unbounded-operator-ref.png	\
 	unbounded-operator-rgb24-ref.png	\
+	unbounded-operator-quartz-ref.png	\
+	unbounded-operator-quartz-rgb24-ref.png	\
 	xlib-surface-source-ref.png \
 	zero-alpha-ref.png
 
diff --git a/test/clip-operator-quartz-ref.png b/test/clip-operator-quartz-ref.png
new file mode 100644
index 0000000..329f684
Binary files /dev/null and b/test/clip-operator-quartz-ref.png differ
diff --git a/test/clip-operator-quartz-rgb24-ref.png b/test/clip-operator-quartz-rgb24-ref.png
new file mode 100644
index 0000000..f539baf
Binary files /dev/null and b/test/clip-operator-quartz-rgb24-ref.png differ
diff --git a/test/dash-curve-quartz-ref.png b/test/dash-curve-quartz-ref.png
new file mode 100644
index 0000000..18a506e
Binary files /dev/null and b/test/dash-curve-quartz-ref.png differ
diff --git a/test/dash-state-quartz-ref.png b/test/dash-state-quartz-ref.png
new file mode 100644
index 0000000..f5f712a
Binary files /dev/null and b/test/dash-state-quartz-ref.png differ
diff --git a/test/degenerate-path-quartz-ref.png b/test/degenerate-path-quartz-ref.png
new file mode 100644
index 0000000..d1d8f2f
Binary files /dev/null and b/test/degenerate-path-quartz-ref.png differ
diff --git a/test/degenerate-path-quartz-rgb24-ref.png b/test/degenerate-path-quartz-rgb24-ref.png
new file mode 100644
index 0000000..d6ff7eb
Binary files /dev/null and b/test/degenerate-path-quartz-rgb24-ref.png differ
diff --git a/test/operator-source-quartz-ref.png b/test/operator-source-quartz-ref.png
new file mode 100644
index 0000000..d02f513
Binary files /dev/null and b/test/operator-source-quartz-ref.png differ
diff --git a/test/operator-source-quartz-rgb24-ref.png b/test/operator-source-quartz-rgb24-ref.png
new file mode 100644
index 0000000..7dc8d80
Binary files /dev/null and b/test/operator-source-quartz-rgb24-ref.png differ
diff --git a/test/unbounded-operator-quartz-ref.png b/test/unbounded-operator-quartz-ref.png
new file mode 100644
index 0000000..69c0d5e
Binary files /dev/null and b/test/unbounded-operator-quartz-ref.png differ
diff --git a/test/unbounded-operator-quartz-rgb24-ref.png b/test/unbounded-operator-quartz-rgb24-ref.png
new file mode 100644
index 0000000..a7a0b0e
Binary files /dev/null and b/test/unbounded-operator-quartz-rgb24-ref.png differ
commit df5087992be5f0f1e42d968559c47bf43de9cfb7
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Mar 17 17:37:22 2008 -0700

    [quartz] Fix bogus CGContextGetType warning that's printed on the console
    
    This is caused by 0x0 surfaces being special, and not having an
    associated cgContext.

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index c0e8a6e..93ad82c 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -156,6 +156,9 @@ static void quartz_ensure_symbols(void)
 
 static inline cairo_bool_t
 _cairo_quartz_is_cgcontext_bitmap_context (CGContextRef cgc) {
+    if (cgc == NULL)
+	return FALSE;
+
     if (CGContextGetTypePtr) {
 	/* 4 is the type value of a bitmap context */
 	if (CGContextGetTypePtr(cgc) == 4)
@@ -682,53 +685,65 @@ CreateRepeatingGradientFunction (cairo_quartz_surface_t *surface,
 
 /* Obtain a CGImageRef from a #cairo_surface_t * */
 
-static CGImageRef
+static cairo_status_t
 _cairo_surface_to_cgimage (cairo_surface_t *target,
-			   cairo_surface_t *source)
+			   cairo_surface_t *source,
+			   CGImageRef *image_out)
 {
+    cairo_status_t status = CAIRO_STATUS_SUCCESS;
     cairo_surface_type_t stype = cairo_surface_get_type (source);
     cairo_image_surface_t *isurf;
-    CGImageRef image, image2;
+    CGImageRef image;
     void *image_extra;
 
     if (stype == CAIRO_SURFACE_TYPE_QUARTZ_IMAGE) {
 	cairo_quartz_image_surface_t *surface = (cairo_quartz_image_surface_t *) source;
-	return CGImageRetain (surface->image);
+	*image_out = CGImageRetain (surface->image);
+	return CAIRO_STATUS_SUCCESS;
     }
 
     if (stype == CAIRO_SURFACE_TYPE_QUARTZ) {
 	cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) source;
+	if (IS_EMPTY(surface)) {
+	    *image_out = NULL;
+	    return CAIRO_STATUS_SUCCESS;
+	}
+
 	if (_cairo_quartz_is_cgcontext_bitmap_context (surface->cgContext)) {
-	    image = CGBitmapContextCreateImage (surface->cgContext);
-	    if (image)
-		return image;
+	    *image_out = CGBitmapContextCreateImage (surface->cgContext);
+	    if (*image_out)
+		return CAIRO_STATUS_SUCCESS;
 	}
     }
 
     if (stype != CAIRO_SURFACE_TYPE_IMAGE) {
-	cairo_status_t status =
-	    _cairo_surface_acquire_source_image (source, &isurf, &image_extra);
+	status = _cairo_surface_acquire_source_image (source, &isurf, &image_extra);
 	if (status)
-	    return NULL;
+	    return status;
     } else {
 	isurf = (cairo_image_surface_t *) source;
     }
 
-    image2 = _cairo_quartz_create_cgimage (isurf->format,
-					   isurf->width,
-					   isurf->height,
-					   isurf->stride,
-					   isurf->data,
-					   TRUE,
-					   NULL, NULL, NULL);
+    if (isurf->width == 0 || isurf->height == 0) {
+	*image_out = NULL;
+    } else {
+	image = _cairo_quartz_create_cgimage (isurf->format,
+					      isurf->width,
+					      isurf->height,
+					      isurf->stride,
+					      isurf->data,
+					      TRUE,
+					      NULL, NULL, NULL);
 
-    image = CGImageCreateCopy (image2);
-    CGImageRelease (image2);
+	/* Create a copy to ensure that the CGImageRef doesn't depend on the image surface's backing store */
+	*image_out = CGImageCreateCopy (image);
+	CGImageRelease (image);
+    }
 
     if ((cairo_surface_t*) isurf != source)
 	_cairo_surface_release_source_image (source, isurf, image_extra);
 
-    return image;
+    return status;
 }
 
 /* Generic #cairo_pattern_t -> CGPattern function */
@@ -814,10 +829,13 @@ _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (cairo_quartz_surface_t
     if (status)
 	return status;
 
-    image = _cairo_surface_to_cgimage ((cairo_surface_t*) dest, pat_surf);
-    if (image == NULL)
+    status = _cairo_surface_to_cgimage ((cairo_surface_t*) dest, pat_surf, &image);
+    if (status != CAIRO_STATUS_SUCCESS)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
+    if (image == NULL)
+	return CAIRO_INT_STATUS_NOTHING_TO_DO;
+
     info = malloc(sizeof(SurfacePatternDrawInfo));
     if (!info)
 	return CAIRO_STATUS_NO_MEMORY;
@@ -900,6 +918,8 @@ _cairo_quartz_setup_fallback_source (cairo_quartz_surface_t *surface,
     cairo_t *fallback_cr;
     CGImageRef img;
 
+    cairo_status_t status;
+
     if (clipBox.size.width == 0.0f ||
 	clipBox.size.height == 0.0f)
 	return DO_NOTHING;
@@ -929,7 +949,11 @@ _cairo_quartz_setup_fallback_source (cairo_quartz_surface_t *surface,
     cairo_paint (fallback_cr);
     cairo_destroy (fallback_cr);
 
-    img = _cairo_surface_to_cgimage ((cairo_surface_t*) surface, fallback);
+    status = _cairo_surface_to_cgimage ((cairo_surface_t*) surface, fallback, &img);
+    if (status == CAIRO_STATUS_SUCCESS && img == NULL)
+	return DO_NOTHING;
+    if (status)
+	return DO_UNSUPPORTED;
 
     surface->sourceImageRect = CGRectMake (0.0, 0.0, w, h);
     surface->sourceImage = img;
@@ -1100,8 +1124,10 @@ _cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
 	CGRect srcRect;
 	cairo_fixed_t fw, fh;
 
-	img = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf);
-	if (!img)
+	status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
+	if (status == CAIRO_STATUS_SUCCESS && img == NULL)
+	    return DO_NOTHING;
+	if (status)
 	    return DO_UNSUPPORTED;
 
 	surface->sourceImage = img;
@@ -1162,6 +1188,8 @@ _cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
 	cairo_int_status_t status;
 
 	status = _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (surface, source, &pattern);
+	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
+	    return DO_NOTHING;
 	if (status)
 	    return DO_UNSUPPORTED;
 
@@ -1451,6 +1479,7 @@ _cairo_quartz_surface_clone_similar (void *abstract_surface,
     cairo_quartz_surface_t *new_surface = NULL;
     cairo_format_t new_format;
     CGImageRef quartz_image = NULL;
+    cairo_status_t status;
 
     *clone_out = NULL;
 
@@ -1477,8 +1506,8 @@ _cairo_quartz_surface_clone_similar (void *abstract_surface,
 	}
     }
 
-    quartz_image = _cairo_surface_to_cgimage ((cairo_surface_t*) abstract_surface, src);
-    if (!quartz_image)
+    status = _cairo_surface_to_cgimage ((cairo_surface_t*) abstract_surface, src, &quartz_image);
+    if (status)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     new_format = CAIRO_FORMAT_ARGB32;  /* assumed */
@@ -1488,6 +1517,10 @@ _cairo_quartz_surface_clone_similar (void *abstract_surface,
 
     new_surface = (cairo_quartz_surface_t *)
 	cairo_quartz_surface_create (new_format, width, height);
+
+    if (quartz_image == NULL)
+	goto FINISH;
+
     if (!new_surface || new_surface->base.status) {
 	CGImageRelease (quartz_image);
 	return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1506,7 +1539,8 @@ _cairo_quartz_surface_clone_similar (void *abstract_surface,
     CGContextRestoreGState (new_surface->cgContext);
 
     CGImageRelease (quartz_image);
-    
+
+FINISH:    
     *clone_out = (cairo_surface_t*) new_surface;
 
     return CAIRO_STATUS_SUCCESS;
@@ -2044,13 +2078,13 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
 
     // everything would be masked out, so do nothing
     if (extents.width == 0 || extents.height == 0)
-	goto BAIL;
+	return CAIRO_STATUS_SUCCESS;
 
-    img = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf);
-    if (!img) {
-	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
-	goto BAIL;
-    }
+    status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
+    if (status == CAIRO_STATUS_SUCCESS && img == NULL)
+	return CAIRO_STATUS_SUCCESS;
+    if (status)
+	return status;
 
     rect = CGRectMake (0.0f, 0.0f, extents.width, extents.height);
 
@@ -2082,7 +2116,7 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
     }
 
     CGImageRelease (img);
-  BAIL:
+
     return status;
 }
 
commit 9d61f7db8082baf3a223c4ea41a53de372676e40
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Mar 17 17:37:19 2008 -0700

    [quartz] Rename ATSUI font to Quartz font

diff --git a/configure.in b/configure.in
index a47c193..0c6d8bd 100644
--- a/configure.in
+++ b/configure.in
@@ -360,14 +360,12 @@ CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
   quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
 ])
 
+CAIRO_BACKEND_ENABLE(quartz_font, Quartz font, quartz-font, QUARTZ_FONT, auto, [
+  use_quartz_font=$use_quartz
+])
+
 CAIRO_BACKEND_ENABLE(quartz_image, Quartz Image, quartz-image, QUARTZ_IMAGE_SURFACE, no, [
-  dnl There is no pkgconfig for quartz; lets do a header check
-  if test "x$use_quartz" != "xyes"; then
-    use_quartz_image="no (requires --enable-quartz)"
-  else
-    dnl we already have the header check and libs required from the quartz surface
-    use_quartz_image="yes"
-  fi
+  use_quartz_image=$use_quartz
 ])
 
 dnl ===========================================================================
@@ -703,17 +701,6 @@ AC_SUBST(LIBRSVG_CFLAGS)
 AC_SUBST(LIBRSVG_LIBS)
 
 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, 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 ===========================================================================
 dnl dump backend checking results
 AC_CACHE_SAVE
 
@@ -1102,7 +1089,7 @@ echo ""
 echo "the following font backends:"
 echo "  FreeType:      $use_ft"
 echo "  Win32:         $use_win32_font"
-echo "  ATSUI:         $use_atsui"
+echo "  Quartz:        $use_quartz_font"
 echo ""
 echo "the following features:"
 echo "  PNG functions: $use_png"
@@ -1121,9 +1108,9 @@ echo "using CFLAGS:"
 echo $CAIRO_CFLAGS
 echo ""
 
-if test x"$use_ft"         != "xyes" && \
-   test x"$use_win32_font" != "xyes" && \
-   test x"$use_atsui"      != "xyes" ; then
+if test x"$use_ft"          != "xyes" && \
+   test x"$use_win32_font"  != "xyes" && \
+   test x"$use_quartz_font" != "xyes" ; then
 
    AC_MSG_ERROR([Cairo requires at least one font backend.
 		  Please install freetype and fontconfig, then try again:
@@ -1154,10 +1141,6 @@ if test x"$use_quartz_image" = "xyes" ; then
    echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Quartz Image/'
 fi
 
-if test x"$use_atsui" = "xyes" ; then
-   echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/ATSUI/'
-fi
-
 if test x"$use_os2" = "xyes" ; then
    echo "$WARNING_MESSAGE" | sed 's, at BACKEND@,OS/2,'
 fi
diff --git a/src/Makefile.am b/src/Makefile.am
index 79e3877..f16fd87 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -185,12 +185,18 @@ cairo_headers += $(quartz_headers)
 cairo_sources += $(quartz_sources)
 backend_pkgconfigs += cairo-quartz.pc
 endif
-
 if CAIRO_HAS_QUARTZ_IMAGE_SURFACE
 cairo_headers += cairo-quartz-image.h
 backend_pkgconfigs += cairo-quartz-image.pc
 endif
 
+quartz_font_sources = cairo-atsui-font.c
+cairo_all_sources += $(quartz_font_sources)
+if CAIRO_HAS_QUARTZ_FONT
+cairo_sources += $(quartz_font_sources)
+backend_pkgconfigs += cairo-quartz-font.pc
+endif
+
 os_win32_sources = cairo-win32.c
 cairo_all_sources += $(os_win32_sources)
 if OS_WIN32
@@ -265,15 +271,6 @@ cairo_sources += $(ft_sources)
 backend_pkgconfigs += cairo-ft.pc
 endif
 
-atsui_headers = cairo-atsui.h
-atsui_sources = cairo-atsui-font.c
-cairo_all_sources += $(atsui_headers) $(atsui_sources)
-if CAIRO_HAS_ATSUI_FONT
-cairo_headers += $(atsui_headers)
-cairo_sources += $(atsui_sources)
-backend_pkgconfigs += cairo-atsui.pc
-endif
-
 # These names match automake style variable definition conventions so
 # without these lines, automake will complain during the handling of 
 # the libcairo_la_LIBADD below.  (The INCLUDES is an autoconf only
diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index 2d585ea..6866bb5 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -37,7 +37,7 @@
 #include "cairoint.h"
 
 #include "cairo.h"
-#include "cairo-atsui.h"
+#include "cairo-quartz.h"
 #include "cairo-quartz-private.h"
 
 /*
@@ -140,7 +140,7 @@ _cairo_atsui_font_face_scaled_font_create (void	*abstract_face,
 }
 
 static const cairo_font_face_backend_t _cairo_atsui_font_face_backend = {
-    CAIRO_FONT_TYPE_ATSUI,
+    CAIRO_FONT_TYPE_QUARTZ,
     _cairo_atsui_font_face_destroy,
     _cairo_atsui_font_face_scaled_font_create
 };
@@ -149,17 +149,17 @@ static const cairo_font_face_backend_t _cairo_atsui_font_face_backend = {
  * cairo_atsui_font_face_create_for_atsu_font_id
  * @font_id: an ATSUFontID for the font.
  *
- * Creates a new font for the ATSUI font backend based on an
+ * Creates a new font for the Quartz font backend based on an
  * #ATSUFontID. This font can then be used with
  * cairo_set_font_face() or cairo_scaled_font_create().
  *
  * Return value: a newly created #cairo_font_face_t. Free with
  *  cairo_font_face_destroy() when you are done using it.
  *
- * Since: 1.4
+ * Since: 1.6
  **/
 cairo_font_face_t *
-cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id)
+cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id)
 {
   cairo_atsui_font_face_t *font_face;
 
@@ -176,6 +176,15 @@ cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id)
     return &font_face->base;
 }
 
+/* This is the old name for the above function, exported for compat purposes */
+cairo_font_face_t *cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id);
+
+cairo_font_face_t *
+cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id)
+{
+    return cairo_quartz_font_face_create_for_atsu_font_id (font_id);
+}
+
 static OSStatus
 CreateSizedCopyOfStyle(ATSUStyle inStyle, 
 		       const Fixed *theSize, 
@@ -968,24 +977,8 @@ _cairo_atsui_font_text_to_glyphs (void		*abstract_font,
     return status;
 }
 
-ATSUStyle
-_cairo_atsui_scaled_font_get_atsu_style (cairo_scaled_font_t *sfont)
-{
-    cairo_atsui_font_t *afont = (cairo_atsui_font_t *) sfont;
-
-    return afont->style;
-}
-
-ATSUFontID
-_cairo_atsui_scaled_font_get_atsu_font_id (cairo_scaled_font_t *sfont)
-{
-    cairo_atsui_font_t *afont = (cairo_atsui_font_t *) sfont;
-
-    return afont->fontID;
-}
-
 CGFontRef
-_cairo_atsui_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont)
+_cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont)
 {
     cairo_atsui_font_t *afont = (cairo_atsui_font_t *) sfont;
 
@@ -1022,7 +1015,7 @@ _cairo_atsui_load_truetype_table (void	           *abstract_font,
 }
 
 const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = {
-    CAIRO_FONT_TYPE_ATSUI,
+    CAIRO_FONT_TYPE_QUARTZ,
     _cairo_atsui_font_create_toy,
     _cairo_atsui_font_fini,
     _cairo_atsui_font_scaled_glyph_init,
diff --git a/src/cairo-atsui.h b/src/cairo-atsui.h
deleted file mode 100644
index 9f39176..0000000
--- a/src/cairo-atsui.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2004 Calum Robinson
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Calum Robinson
- *
- * Contributor(s):
- *	Calum Robinson <calumr at mac.com>
- */
-
-#ifndef CAIRO_ATSUI_H
-#define CAIRO_ATSUI_H
-
-#include <cairo.h>
-
-#if CAIRO_HAS_ATSUI_FONT
-
-/* ATSUI platform-specific font interface */
-
-#include <Carbon/Carbon.h>
-
-CAIRO_BEGIN_DECLS
-
-cairo_public cairo_font_face_t *
-cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id);
-
-CAIRO_END_DECLS
-
-#else  /* CAIRO_HAS_ATSUI_FONT */
-# error Cairo was not compiled with support for the atsui font backend
-#endif /* CAIRO_HAS_ATSUI_FONT */
-
-#endif /* CAIRO_ATSUI_H */
diff --git a/src/cairo-deprecated.h b/src/cairo-deprecated.h
index 35a4eb9..49aab8b 100644
--- a/src/cairo-deprecated.h
+++ b/src/cairo-deprecated.h
@@ -104,6 +104,8 @@
 #define cairo_ps_surface_set_dpi	cairo_ps_surface_set_dpi_REPLACED_BY_cairo_surface_set_fallback_resolution
 #define cairo_pdf_surface_set_dpi	cairo_pdf_surface_set_dpi_REPLACED_BY_cairo_surface_set_fallback_resolution
 #define cairo_svg_surface_set_dpi	cairo_svg_surface_set_dpi_REPLACED_BY_cairo_surface_set_fallback_resolution
+#define cairo_atsui_font_face_create_for_atsu_font_id  cairo_atsui_font_face_create_for_atsu_font_id_REPLACED_BY_cairo_quartz_font_face_create_for_atsu_font_id
+#define CAIRO_FONT_TYPE_ATSUI		CAIRO_FONT_TYPE_ATSUI_replaced_by_CAIRO_FONT_TYPE_QUARTZ
 
 #define cairo_current_path	     cairo_current_path_DEPRECATED_BY_cairo_copy_path
 #define cairo_current_path_flat	     cairo_current_path_flat_DEPRECATED_BY_cairo_copy_path_flat
diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h
index 41732fb..0ab9bc0 100644
--- a/src/cairo-quartz-private.h
+++ b/src/cairo-quartz-private.h
@@ -92,17 +92,9 @@ _cairo_quartz_create_cgimage (cairo_format_t format,
 			      CGDataProviderReleaseDataCallback releaseCallback,
 			      void *releaseInfo);
 
-#endif /* CAIRO_HAS_QUARTZ_SURFACE */
-
-#if CAIRO_HAS_ATSUI_FONT
-ATSUStyle
-_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);
-
 CGFontRef
-_cairo_atsui_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
-#endif /* CAIRO_HAS_ATSUI_FONT */
+_cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
+
+#endif /* CAIRO_HAS_QUARTZ_SURFACE */
 
 #endif /* CAIRO_QUARTZ_PRIVATE_H */
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 257c5da..c0e8a6e 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1817,7 +1817,7 @@ _cairo_quartz_surface_stroke (void *abstract_surface,
     return rv;
 }
 
-#if CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_QUARTZ_FONT
 static cairo_int_status_t
 _cairo_quartz_surface_show_glyphs (void *abstract_surface,
 				   cairo_operator_t op,
@@ -1852,7 +1852,7 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
     if (op == CAIRO_OPERATOR_DEST)
 	return CAIRO_STATUS_SUCCESS;
 
-    if (cairo_scaled_font_get_type (scaled_font) != CAIRO_FONT_TYPE_ATSUI)
+    if (cairo_scaled_font_get_type (scaled_font) != CAIRO_FONT_TYPE_QUARTZ)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     CGContextSaveGState (surface->cgContext);
@@ -1872,7 +1872,7 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
     CGContextSetCompositeOperation (surface->cgContext, _cairo_quartz_cairo_operator_to_quartz (op));
 
     /* this doesn't addref */
-    cgfref = _cairo_atsui_scaled_font_get_cg_font_ref (scaled_font);
+    cgfref = _cairo_quartz_scaled_font_get_cg_font_ref (scaled_font);
     CGContextSetFont (surface->cgContext, cgfref);
     CGContextSetFontSize (surface->cgContext, 1.0);
 
@@ -2023,7 +2023,7 @@ BAIL:
 
     return rv;
 }
-#endif /* CAIRO_HAS_ATSUI_FONT */
+#endif /* CAIRO_HAS_QUARTZ_FONT */
 
 static cairo_int_status_t
 _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
@@ -2256,11 +2256,11 @@ static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
     _cairo_quartz_surface_mask,
     _cairo_quartz_surface_stroke,
     _cairo_quartz_surface_fill,
-#if CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_QUARTZ_FONT
     _cairo_quartz_surface_show_glyphs,
 #else
-    NULL, /* surface_show_glyphs */
-#endif /* CAIRO_HAS_ATSUI_FONT */
+    NULL, /* show_glyphs */
+#endif
 
     NULL, /* snapshot */
     NULL, /* is_similar */
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index 5d78d39..b5c20e6 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -57,10 +57,23 @@ cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext,
 cairo_public CGContextRef
 cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
 
+/*
+ * Quartz font support
+ */
+
+#ifdef CAIRO_HAS_QUARTZ_FONT
+
+cairo_public cairo_font_face_t *
+cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id);
+
+#endif /* CAIRO_HAS_QUARTZ_FONT */
+
 CAIRO_END_DECLS
 
-#else  /* CAIRO_HAS_QUARTZ_SURFACE */
+#else
+
 # error Cairo was not compiled with support for the quartz backend
+
 #endif /* CAIRO_HAS_QUARTZ_SURFACE */
 
 #endif /* CAIRO_QUARTZ_H */
diff --git a/src/cairo.h b/src/cairo.h
index cf14e6f..ab730e7 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1148,7 +1148,7 @@ cairo_font_face_status (cairo_font_face_t *font_face);
  * @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api
  * @CAIRO_FONT_TYPE_FT: The font is of type FreeType
  * @CAIRO_FONT_TYPE_WIN32: The font is of type Win32
- * @CAIRO_FONT_TYPE_ATSUI: The font is of type ATSUI
+ * @CAIRO_FONT_TYPE_QUARTZ: The font is of type Quartz (Since: 1.6)
  *
  * #cairo_font_type_t is used to describe the type of a given font
  * face or scaled font. The font types are also known as "font
@@ -1183,7 +1183,7 @@ typedef enum _cairo_font_type {
     CAIRO_FONT_TYPE_TOY,
     CAIRO_FONT_TYPE_FT,
     CAIRO_FONT_TYPE_WIN32,
-    CAIRO_FONT_TYPE_ATSUI
+    CAIRO_FONT_TYPE_QUARTZ
 } cairo_font_type_t;
 
 cairo_public cairo_font_type_t
diff --git a/src/cairoint.h b/src/cairoint.h
index 9108d19..c36a2a8 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -432,7 +432,7 @@ extern const cairo_private struct _cairo_scaled_font_backend cairo_win32_scaled_
 
 #endif
 
-#if CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_QUARTZ_FONT
 
 extern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_font_backend;
 
@@ -841,7 +841,7 @@ typedef struct _cairo_traps {
 #define CAIRO_FONT_WEIGHT_DEFAULT  CAIRO_FONT_WEIGHT_NORMAL
 
 #define CAIRO_WIN32_FONT_FAMILY_DEFAULT "Arial"
-#define CAIRO_ATSUI_FONT_FAMILY_DEFAULT  "Helvetica"
+#define CAIRO_QUARTZ_FONT_FAMILY_DEFAULT  "Helvetica"
 #define CAIRO_FT_FONT_FAMILY_DEFAULT     ""
 
 #if   CAIRO_HAS_WIN32_FONT
@@ -849,9 +849,9 @@ typedef struct _cairo_traps {
 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_WIN32_FONT_FAMILY_DEFAULT
 #define CAIRO_SCALED_FONT_BACKEND_DEFAULT &cairo_win32_scaled_font_backend
 
-#elif CAIRO_HAS_ATSUI_FONT
+#elif CAIRO_HAS_QUARTZ_FONT
 
-#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_ATSUI_FONT_FAMILY_DEFAULT
+#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_QUARTZ_FONT_FAMILY_DEFAULT
 #define CAIRO_SCALED_FONT_BACKEND_DEFAULT &cairo_atsui_scaled_font_backend
 
 #elif CAIRO_HAS_FT_FONT
@@ -2202,7 +2202,7 @@ _cairo_utf8_to_ucs4 (const unsigned char *str,
 		     uint32_t	        **result,
 		     int		 *items_written);
 
-#if CAIRO_HAS_WIN32_FONT+0 || CAIRO_HAS_ATSUI_FONT+0
+#if CAIRO_HAS_WIN32_FONT+0 || CAIRO_HAS_QUARTZ_FONT+0
 # define CAIRO_HAS_UTF8_TO_UTF16 1
 #endif
 #if CAIRO_HAS_UTF8_TO_UTF16


More information about the cairo-commit mailing list