[cairo-commit] 15 commits - src/cairo-atsui-font.c src/cairo-directfb-surface.c src/cairo-font.c src/cairo-ft-font.c src/cairo-glitz-surface.c src/cairo.h src/cairo-image-surface.c src/cairoint.h src/cairo-meta-surface.c src/cairo-paginated-surface.c src/cairo-pattern.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-scaled-font.c src/cairo-surface.c src/cairo-surface-fallback.c src/cairo-svg-surface.c src/cairo-wideint.c src/cairo-wideint.h src/cairo-win32-font.c src/cairo-win32-surface.c src/cairo-xcb-surface.c src/cairo-xlib-surface.c src/test-fallback-surface.c src/test-meta-surface.c test/cairo-test.c test/font-face-get-type.c test/ft-font-create-for-ft-face.c test/.gitignore test/Makefile.am test/pattern-get-type.c

Carl Worth cworth at kemper.freedesktop.org
Tue Feb 28 02:43:15 PST 2006


 src/cairo-atsui-font.c            |    2 
 src/cairo-directfb-surface.c      |    1 
 src/cairo-font.c                  |   13 +++
 src/cairo-ft-font.c               |    2 
 src/cairo-glitz-surface.c         |    1 
 src/cairo-image-surface.c         |    1 
 src/cairo-meta-surface.c          |    3 
 src/cairo-paginated-surface.c     |   25 ++++++-
 src/cairo-pattern.c               |   80 ++++++++++++----------
 src/cairo-pdf-surface.c           |   11 +--
 src/cairo-ps-surface.c            |   27 +++----
 src/cairo-scaled-font.c           |   12 +++
 src/cairo-surface-fallback.c      |    2 
 src/cairo-surface.c               |   24 ++++++
 src/cairo-svg-surface.c           |    1 
 src/cairo-wideint.c               |    3 
 src/cairo-wideint.h               |    3 
 src/cairo-win32-font.c            |    2 
 src/cairo-win32-surface.c         |    1 
 src/cairo-xcb-surface.c           |    1 
 src/cairo-xlib-surface.c          |    3 
 src/cairo.h                       |  135 +++++++++++++++++++++++++++++++++++++-
 src/cairoint.h                    |   28 +++++--
 src/test-fallback-surface.c       |    1 
 src/test-meta-surface.c           |    1 
 test/.gitignore                   |    2 
 test/Makefile.am                  |    4 +
 test/cairo-test.c                 |  107 +++++++++++++++++++++---------
 test/font-face-get-type.c         |   64 ++++++++++++++++++
 test/ft-font-create-for-ft-face.c |   14 +++
 test/pattern-get-type.c           |   74 ++++++++++++++++++++
 31 files changed, 548 insertions(+), 100 deletions(-)

New commits:
diff-tree 6fe93cbf5b368a9a6daf54370aa0e7735b411474 (from parents)
Merge: f2245a7932b857ff70dc0476490090d906ae61f8 210dd59a7441424f71658ca248f6657482c74c7e
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 28 02:36:45 2006 -0800

    Merge branch 'get-type' into cairo

diff --cc src/cairo-win32-surface.c
index c7f4555,9dacd1d..5e1e342
@@@ -1082,32 -1029,8 +1082,33 @@@
      return surface->backend == &cairo_win32_surface_backend;
  }
  
 +/**
 + * cairo_win32_surface_get_dc
 + * @surface: a #cairo_surface_t
 + *
 + * Returns the HDC associated with this surface, or NULL if none.
 + * Also returns NULL if the surface is not a win32 surface.
 + *
 + * Return value: HDC or NULL if no HDC available.
 + **/
 +HDC
 +cairo_win32_surface_get_dc (cairo_surface_t *surface)
 +{
 +    cairo_win32_surface_t *winsurf;
 +
 +    if (surface == NULL)
 +	return NULL;
 +
 +    if (!_cairo_surface_is_win32(surface))
 +	return NULL;
 +
 +    winsurf = (cairo_win32_surface_t *) surface;
 +
 +    return winsurf->dc;
 +}
 +
  static const cairo_surface_backend_t cairo_win32_surface_backend = {
+     CAIRO_SURFACE_TYPE_WIN32,
      _cairo_win32_surface_create_similar,
      _cairo_win32_surface_finish,
      _cairo_win32_surface_acquire_source_image,
diff-tree 210dd59a7441424f71658ca248f6657482c74c7e (from bd2136a23f8a3d5f6a1306d18499fdcfc1e87f48)
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 28 02:30:27 2006 -0800

    Add some basic testing of cairo_font_face_get_type and
    cairo_scaled_font_get_type.

diff --git a/test/.gitignore b/test/.gitignore
index 30554c8..65741ca 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -24,6 +24,7 @@ fill-and-stroke
 fill-rule
 filter-nearest-offset
 ft-font-create-for-ft-face
+font-face-get-type
 get-and-set
 gradient-alpha
 imagediff
diff --git a/test/Makefile.am b/test/Makefile.am
index 0d86636..8a67fc5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,6 +20,7 @@ extend-reflect			\
 fill-and-stroke			\
 fill-rule			\
 filter-nearest-offset		\
+font-face-get-type		\
 get-and-set			\
 gradient-alpha			\
 leaky-polygon			\
@@ -300,6 +301,7 @@ dash_offset_negative_LDADD = $(LDADDS)
 extend_reflect_LDADD = $(LDADDS)
 fill_and_stroke_LDADD = $(LDADDS)
 fill_rule_LDADD = $(LDADDS)
+font_face_get_type_LDADD = $(LDADDS)
 filter_nearest_offset_LDADD = $(LDADDS)
 ft_font_create_for_ft_face_LDADD = $(LDADDS)
 get_and_set_LDADD = $(LDADDS)
diff --git a/test/font-face-get-type.c b/test/font-face-get-type.c
new file mode 100644
index 0000000..c21d5c2
--- /dev/null
+++ b/test/font-face-get-type.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2006 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth at cworth.org>
+ */
+
+#include "cairo-test.h"
+
+int
+main (void)
+{
+    cairo_surface_t *surface;
+    cairo_t *cr;
+    cairo_font_face_t *font_face;
+
+    cairo_test_init ("font-face-get-type");
+
+    cairo_test_log ("Creating cairo context and obtaining a font face\n");
+
+    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+    cr = cairo_create (surface);
+
+    cairo_select_font_face (cr, "Bitstream Vera Sans",
+			    CAIRO_FONT_SLANT_NORMAL,
+			    CAIRO_FONT_WEIGHT_NORMAL);
+
+    font_face = cairo_get_font_face (cr);
+
+    cairo_test_log ("Testing return value of cairo_font_face_get_type\n");
+
+    if (cairo_font_face_get_type (font_face) != CAIRO_FONT_TYPE_TOY) {
+	cairo_test_log ("Unexpected value %d from cairo_font_face_get_type (expected %d)\n",
+			cairo_font_face_get_type (font_face), CAIRO_FONT_TYPE_TOY);
+	return CAIRO_TEST_FAILURE;
+    }
+
+    cairo_destroy (cr);
+    cairo_surface_destroy (surface);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+
+
+    
diff --git a/test/ft-font-create-for-ft-face.c b/test/ft-font-create-for-ft-face.c
index bf668b9..0bb3b8c 100644
--- a/test/ft-font-create-for-ft-face.c
+++ b/test/ft-font-create-for-ft-face.c
@@ -64,6 +64,13 @@ draw (cairo_t *cr, int width, int height
 
     font_face = cairo_ft_font_face_create_for_pattern (resolved);
 
+    if (cairo_font_face_get_type (font_face) != CAIRO_FONT_TYPE_FT) {
+	cairo_test_log ("Unexpected value from cairo_font_face_get_type: %d (expected %d)\n",
+			cairo_font_face_get_type (font_face), CAIRO_FONT_TYPE_FT);
+	cairo_font_face_destroy (font_face);
+	return CAIRO_TEST_FAILURE;
+    }
+
     cairo_matrix_init_identity (&font_matrix);
 
     cairo_get_matrix (cr, &ctm);
@@ -82,6 +89,13 @@ draw (cairo_t *cr, int width, int height
     FcPatternDestroy (pattern);
     FcPatternDestroy (resolved);
 
+    if (cairo_scaled_font_get_type (scaled_font) != CAIRO_FONT_TYPE_FT) {
+	cairo_test_log ("Unexpected value from cairo_scaled_font_get_type: %d (expected %d)\n",
+			cairo_scaled_font_get_type (scaled_font), CAIRO_FONT_TYPE_FT);
+	cairo_scaled_font_destroy (scaled_font);
+	return CAIRO_TEST_FAILURE;
+    }
+
     if (!ft_face) {
 	cairo_test_log ("Failed to get an ft_face with cairo_ft_scaled_font_lock_face\n");
 	cairo_scaled_font_destroy (scaled_font);
diff-tree bd2136a23f8a3d5f6a1306d18499fdcfc1e87f48 (from f9534c856a71b0f56a1e5bc58141b7bc192a27e8)
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 28 01:31:15 2006 -0800

    Correct copyright date

diff --git a/test/pattern-get-type.c b/test/pattern-get-type.c
index 0e8fe25..a6aba03 100644
--- a/test/pattern-get-type.c
+++ b/test/pattern-get-type.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2005 Red Hat, Inc.
+ * Copyright © 2006 Red Hat, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
diff-tree f9534c856a71b0f56a1e5bc58141b7bc192a27e8 (from 1dd6e417c10c90894c87565d4f7fa3f63e97f212)
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 28 01:30:58 2006 -0800

    test/pattern-get-type: Add new test case for cairo_pattern_get_type.

diff --git a/test/.gitignore b/test/.gitignore
index 5173349..30554c8 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -43,6 +43,7 @@ operator-source
 paint
 paint-with-alpha
 path-data
+pattern-get-type
 pdf2png
 png-flatten
 svg2png
diff --git a/test/Makefile.am b/test/Makefile.am
index 0da8b5a..0d86636 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -35,6 +35,7 @@ operator-source			\
 paint				\
 paint-with-alpha		\
 path-data			\
+pattern-get-type		\
 pixman-rotate			\
 rectangle-rounding-error	\
 scale-source-surface-paint	\
@@ -317,6 +318,7 @@ operator_source_LDADD = $(LDADDS)
 paint_LDADD = $(LDADDS)
 paint_with_alpha_LDADD = $(LDADDS)
 path_data_LDADD = $(LDADDS)
+pattern_get_type_LDADD = $(LDADDS)
 svg_surface_LDADD = $(LDADDS)
 svg_clip_LDADD = $(LDADDS)
 pixman_rotate_LDADD = $(LDADDS)
diff --git a/test/pattern-get-type.c b/test/pattern-get-type.c
new file mode 100644
index 0000000..0e8fe25
--- /dev/null
+++ b/test/pattern-get-type.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth at cworth.org>
+ */
+
+#include "cairo-test.h"
+
+int
+main (void)
+{
+    cairo_surface_t *surface;
+    cairo_pattern_t *solid_rgb, *solid_rgba, *surface_pattern, *linear, *radial;
+
+    cairo_test_init ("pattern-get-type");
+
+    cairo_test_log ("Creating patterns of all types\n");
+
+    solid_rgb = cairo_pattern_create_rgb (0.0, 0.1, 0.2);
+    solid_rgba = cairo_pattern_create_rgba (0.3, 0.4, 0.5, 0.6);
+    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+					  1, 1);
+    surface_pattern = cairo_pattern_create_for_surface (surface);
+    linear = cairo_pattern_create_linear (0.0, 0.0, 10.0, 10.0);
+    radial = cairo_pattern_create_radial (10.0, 10.0, 0.1,
+					  10.0, 10.0, 1.0);
+
+    cairo_test_log ("Verifying return values of cairo_pattern_get_type\n");
+
+    if (cairo_pattern_get_type (solid_rgb) != CAIRO_PATTERN_TYPE_SOLID)
+	return CAIRO_TEST_FAILURE;
+
+    if (cairo_pattern_get_type (solid_rgba) != CAIRO_PATTERN_TYPE_SOLID)
+	return CAIRO_TEST_FAILURE;
+
+    if (cairo_pattern_get_type (surface_pattern) != CAIRO_PATTERN_TYPE_SURFACE)
+	return CAIRO_TEST_FAILURE;
+
+    if (cairo_pattern_get_type (linear) != CAIRO_PATTERN_TYPE_LINEAR)
+	return CAIRO_TEST_FAILURE;
+
+    if (cairo_pattern_get_type (radial) != CAIRO_PATTERN_TYPE_RADIAL)
+	return CAIRO_TEST_FAILURE;
+
+    cairo_test_log ("Cleaning up\n");
+
+    cairo_pattern_destroy (solid_rgb);
+    cairo_pattern_destroy (solid_rgba);
+    cairo_pattern_destroy (surface_pattern);
+    cairo_surface_destroy (surface);
+    cairo_pattern_destroy (linear);
+    cairo_pattern_destroy (radial);
+
+    return CAIRO_TEST_SUCCESS;
+}
diff-tree 1dd6e417c10c90894c87565d4f7fa3f63e97f212 (from cd84e2ab32fe4648f9d172cdefe08798336938d2)
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 28 00:55:27 2006 -0800

    Add testing for cairo_surface_get_type.
    
    All test targets now list an expected cairo_surface_type_t. Add notes
    on current limitations of PDF/PS/meta-surface support that causes
    CAIRO_CONTENT_COLOR similar surfaces of PDF and PS surfaces to be
    returned as image surfaces.
    
    Add cairo_internal_surface_type_t for the meta, paginated, and various
    test surfaces.

diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 4bb8572..acfe44a 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -97,6 +97,24 @@ const cairo_private cairo_surface_backen
 static cairo_int_status_t
 _cairo_paginated_surface_show_page (void *abstract_surface);
 
+/* XXX: This would seem the natural thing to do here. But currently,
+ * PDF and PS surfaces do not yet work as source surfaces. So instead,
+ * we don't implement create_similar for the paginate_surface which
+ * means that any create_similar() call on a paginated_surfacae will
+ * result in a new image surface. */
+#if 0
+static cairo_surface_t *
+_cairo_paginated_surface_create_similar (void			*abstract_surface,
+					 cairo_content_t	 content,
+					 int			 width,
+					 int			 height)
+{
+    cairo_paginated_surface_t *surface = abstract_surface;
+    return cairo_surface_create_similar (surface->target, content,
+					 width, height);
+}
+#endif
+
 cairo_surface_t *
 _cairo_paginated_surface_create (cairo_surface_t	*target,
 				 cairo_content_t	 content,
@@ -386,7 +404,7 @@ _cairo_paginated_surface_snapshot (void 
 
 const cairo_surface_backend_t cairo_paginated_surface_backend = {
     CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
-    NULL, /* create_similar */
+    NULL, /* create_similar --- see note for _cairo_paginated_surface_create_similar */
     _cairo_paginated_surface_finish,
     _cairo_paginated_surface_acquire_source_image,
     _cairo_paginated_surface_release_source_image,
diff --git a/src/cairoint.h b/src/cairoint.h
index 1246123..8db52ae 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -258,7 +258,10 @@ typedef enum cairo_int_status {
 
 typedef enum cairo_internal_surface_type {
     CAIRO_INTERNAL_SURFACE_TYPE_META = 0x1000,
-    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED
+    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED
 } cairo_internal_surface_type_t;
 
 typedef enum cairo_direction {
@@ -2157,7 +2160,6 @@ cairo_private int
 _cairo_dtostr (char *buffer, size_t size, double d);
 
 /* Avoid unnecessary PLT entries.  */
-
 slim_hidden_proto(cairo_get_current_point)
 slim_hidden_proto(cairo_fill_preserve)
 slim_hidden_proto(cairo_clip_preserve)
diff --git a/src/test-fallback-surface.c b/src/test-fallback-surface.c
index fe0cc6f..cb8fd92 100644
--- a/src/test-fallback-surface.c
+++ b/src/test-fallback-surface.c
@@ -175,6 +175,7 @@ _test_fallback_surface_get_extents (void
 }
 
 const cairo_surface_backend_t test_fallback_surface_backend = {
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
     _test_fallback_surface_create_similar,
     _test_fallback_surface_finish,
     _test_fallback_surface_acquire_source_image,
diff --git a/src/test-meta-surface.c b/src/test-meta-surface.c
index bdabf31..6d36fca 100644
--- a/src/test-meta-surface.c
+++ b/src/test-meta-surface.c
@@ -296,6 +296,7 @@ _test_meta_surface_snapshot (void *abstr
 }
 
 const cairo_surface_backend_t test_meta_surface_backend = {
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
     NULL, /* create_similar */
     _test_meta_surface_finish,
     _test_meta_surface_acquire_source_image,
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 557ccb6..d782a92 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -47,6 +47,20 @@
 #include "write-png.h"
 #include "xmalloc.h"
 
+/* This is copied from cairoint.h. That makes it painful to keep in
+ * sync, but the slim stuff makes cairoint.h "hard" to include when
+ * not actually building the cairo library itself. Fortunately, since
+ * we're checking all these values, we do have a safeguard for keeping
+ * them in sync.
+ */
+typedef enum cairo_internal_surface_type {
+    CAIRO_INTERNAL_SURFACE_TYPE_META = 0x1000,
+    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED
+} cairo_internal_surface_type_t;
+
 #ifdef _MSC_VER
 #define vsnprintf _vsnprintf
 #define access _access
@@ -163,6 +177,7 @@ typedef void
 typedef struct _cairo_test_target
 {
     const char		       	       *name;
+    cairo_surface_type_t		expected_type;
     cairo_content_t			content;
     cairo_test_create_target_surface_t	create_target_surface;
     cairo_test_write_to_png_t		write_to_png;
@@ -1387,6 +1402,13 @@ cairo_test_for_target (cairo_test_t *tes
 	goto UNWIND_STRINGS;
     }
 
+    if (cairo_surface_get_type (surface) != target->expected_type) {
+	cairo_test_log ("Error: Created surface is of type %d (expected %d)\n",
+			cairo_surface_get_type (surface), target->expected_type);
+	ret = CAIRO_TEST_FAILURE;
+	goto UNWIND_SURFACE;
+    }
+
     cr = cairo_create (surface);
 
     /* Clear to transparent (or black) depending on whether the target
@@ -1436,6 +1458,7 @@ cairo_test_for_target (cairo_test_t *tes
 
 UNWIND_CAIRO:
     cairo_destroy (cr);
+UNWIND_SURFACE:
     cairo_surface_destroy (surface);
 
     cairo_debug_reset_static_data ();
@@ -1461,102 +1484,128 @@ cairo_test_expecting (cairo_test_t *test
     cairo_test_target_t **targets_to_test;
     cairo_test_target_t targets[] = 
 	{
-	    { "image", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "image", CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR_ALPHA,
 	      create_image_surface, cairo_surface_write_to_png, NULL},
-	    { "image", CAIRO_CONTENT_COLOR,
+	    { "image", CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR,
 	      create_image_surface, cairo_surface_write_to_png, NULL},
 #ifdef CAIRO_HAS_TEST_SURFACES
-	    { "test-fallback", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "test-fallback", CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
+	      CAIRO_CONTENT_COLOR_ALPHA,
 	      create_test_fallback_surface, cairo_surface_write_to_png, NULL },
-	    { "test-fallback", CAIRO_CONTENT_COLOR,
+	    { "test-fallback", CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
+	      CAIRO_CONTENT_COLOR,
 	      create_test_fallback_surface, cairo_surface_write_to_png, NULL },
-	    { "test-meta", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "test-meta", CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
+	      CAIRO_CONTENT_COLOR_ALPHA,
 	      create_test_meta_surface, cairo_surface_write_to_png, NULL },
-	    { "test-meta", CAIRO_CONTENT_COLOR,
+	    { "test-meta", CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
+	      CAIRO_CONTENT_COLOR,
 	      create_test_meta_surface, cairo_surface_write_to_png, NULL },
-	    { "test-paginated", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "test-paginated", CAIRO_SURFACE_TYPE_IMAGE,
+	      CAIRO_CONTENT_COLOR_ALPHA,
 	      create_test_paginated_surface,
 	      test_paginated_write_to_png,
 	      cleanup_test_paginated },
-	    { "test-paginated", CAIRO_CONTENT_COLOR,
+	    { "test-paginated", CAIRO_SURFACE_TYPE_IMAGE,
+	      CAIRO_CONTENT_COLOR,
 	      create_test_paginated_surface,
 	      test_paginated_write_to_png,
 	      cleanup_test_paginated },
 #endif
 #ifdef CAIRO_HAS_GLITZ_SURFACE
 #if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
-	    { "glitz-glx", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "glitz-glx", CAIRO_SURFACE_TYPE_GLITZ,CAIRO_CONTENT_COLOR_ALPHA,
 		create_cairo_glitz_glx_surface, cairo_surface_write_to_png,
 		cleanup_cairo_glitz_glx }, 
-	    { "glitz-glx", CAIRO_CONTENT_COLOR,
+	    { "glitz-glx", CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR,
 		create_cairo_glitz_glx_surface, cairo_surface_write_to_png,
 		cleanup_cairo_glitz_glx }, 
 #endif
 #if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
-	    { "glitz-agl", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "glitz-agl", CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA,
 		create_cairo_glitz_agl_surface, cairo_surface_write_to_png,
 		cleanup_cairo_glitz_agl }, 
-	    { "glitz-agl", CAIRO_CONTENT_COLOR,
+	    { "glitz-agl", CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR,
 		create_cairo_glitz_agl_surface, cairo_surface_write_to_png,
 		cleanup_cairo_glitz_agl }, 
 #endif
 #if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
-	    { "glitz-wgl", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "glitz-wgl", CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA,
 		create_cairo_glitz_wgl_surface, cairo_surface_write_to_png,
 		cleanup_cairo_glitz_wgl }, 
-	    { "glitz-wgl", CAIRO_CONTENT_COLOR,
+	    { "glitz-wgl", CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR,
 		create_cairo_glitz_wgl_surface, cairo_surface_write_to_png,
 		cleanup_cairo_glitz_wgl }, 
 #endif
 #endif /* CAIRO_HAS_GLITZ_SURFACE */
 #if 0 && CAIRO_HAS_QUARTZ_SURFACE
-	    { "quartz", CAIRO_CONTENT_COLOR,
+	    { "quartz", CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR,
 		create_quartz_surface, cairo_surface_write_to_png,
 		cleanup_quartz },
 #endif
 #if CAIRO_HAS_WIN32_SURFACE
-	    { "win32", CAIRO_CONTENT_COLOR,
+	    { "win32", CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR,
 		create_win32_surface, cairo_surface_write_to_png, cleanup_win32 },
 #endif
 #if CAIRO_HAS_XCB_SURFACE
-	    { "xcb", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "xcb", CAIRO_SURFACE_TYPE_XCB, CAIRO_CONTENT_COLOR_ALPHA,
 		create_xcb_surface, cairo_surface_write_to_png, cleanup_xcb},
 #endif
 #if CAIRO_HAS_XLIB_SURFACE
-	    { "xlib", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "xlib", CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR_ALPHA,
 		create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
-	    { "xlib", CAIRO_CONTENT_COLOR,
+	    { "xlib", CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR,
 		create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
 #endif
 #if CAIRO_HAS_PS_SURFACE
-	    { "ps", CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED,
+	    { "ps", CAIRO_SURFACE_TYPE_PS,
+	        CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED,
 		create_ps_surface, ps_surface_write_to_png, cleanup_ps },
-	    { "ps", CAIRO_CONTENT_COLOR,
+
+	    /* XXX: We expect type image here only due to a limitation in
+	     * the current PS/meta-surface code. A PS surface is
+	     * "naturally" COLOR_ALPHA, so the COLOR-only variant goes
+	     * through create_similar in create_ps_surface which results
+	     * in the similar surface being used as a source. We do not yet
+	     * have source support for PS/meta-surfaces, so the
+	     * create_similar path for all paginated surfaces currently
+	     * returns an image surface.*/
+	    { "ps", CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR,
 		create_ps_surface, ps_surface_write_to_png, cleanup_ps },
 #endif
 #if CAIRO_HAS_PDF_SURFACE && CAIRO_CAN_TEST_PDF_SURFACE
-	    { "pdf", CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED,
+	    { "pdf", CAIRO_SURFACE_TYPE_PDF,
+	        CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED,
 		create_pdf_surface, pdf_surface_write_to_png, cleanup_pdf },
-	    { "pdf", CAIRO_CONTENT_COLOR,
+
+	    /* XXX: We expect type image here only due to a limitation in
+	     * the current PDF/meta-surface code. A PDF surface is
+	     * "naturally" COLOR_ALPHA, so the COLOR-only variant goes
+	     * through create_similar in create_pdf_surface which results
+	     * in the similar surface being used as a source. We do not yet
+	     * have source support for PDF/meta-surfaces, so the
+	     * create_similar path for all paginated surfaces currently
+	     * returns an image surface.*/
+	    { "pdf", CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR,
 		create_pdf_surface, pdf_surface_write_to_png, cleanup_pdf },
 #endif
 #if CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE
-	    { "svg", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "svg", CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA,
 		    create_svg_surface, svg_surface_write_to_png, cleanup_svg },
 #endif
 #if CAIRO_HAS_BEOS_SURFACE
-	    { "beos", CAIRO_CONTENT_COLOR,
+	    { "beos", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR,
 		create_beos_surface, cairo_surface_write_to_png, cleanup_beos},
-	    { "beos_bitmap", CAIRO_CONTENT_COLOR,
+	    { "beos_bitmap", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR,
 		create_beos_bitmap_surface, cairo_surface_write_to_png, cleanup_beos_bitmap},
-	    { "beos_bitmap", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "beos_bitmap", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR_ALPHA,
 		create_beos_bitmap_surface, cairo_surface_write_to_png, cleanup_beos_bitmap},
 #endif
 
 #if CAIRO_HAS_DIRECTFB_SURFACE
-	    { "directfb", CAIRO_CONTENT_COLOR,
+	    { "directfb", CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR,
 		create_directfb_surface, cairo_surface_write_to_png, cleanup_directfb},
-	    { "directfb_bitmap", CAIRO_CONTENT_COLOR_ALPHA,
+	    { "directfb_bitmap", CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR_ALPHA,
 		create_directfb_bitmap_surface, cairo_surface_write_to_png,cleanup_directfb},
 #endif
 	};
diff-tree cd84e2ab32fe4648f9d172cdefe08798336938d2 (from 5797f814852bb4f6ef559890640b8cd24ec5fa45)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 23:15:45 2006 -0800

    Add documentation for cairo_font_face_get_type,
    cairo_scaled_font_get_type, cairo_surface_get_type, and
    cairo_pattern_get_type.

diff --git a/src/cairo-font.c b/src/cairo-font.c
index bb184c4..6512480 100644
--- a/src/cairo-font.c
+++ b/src/cairo-font.c
@@ -130,6 +130,12 @@ cairo_font_face_destroy (cairo_font_face
     free (font_face);
 }
 
+/**
+ * cairo_font_face_get_type:
+ * @font_face: a #cairo_font_face_t
+ * 
+ * Return value: The type of @font_face. See #cairo_font_type_t.
+ **/
 cairo_font_type_t
 cairo_font_face_get_type (cairo_font_face_t *font_face)
 {
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index a9628a3..8aa2969 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -524,6 +524,12 @@ cairo_pattern_reference (cairo_pattern_t
     return pattern;
 }
 
+/**
+ * cairo_pattern_get_type:
+ * @pattern: a #cairo_pattern_t
+ * 
+ * Return value: The type of @pattern. See #cairo_pattern_type_t.
+ **/
 cairo_pattern_type_t
 cairo_pattern_get_type (cairo_pattern_t *pattern)
 {
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 46e1cac..a046904 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -118,6 +118,12 @@ _cairo_scaled_font_set_error (cairo_scal
     _cairo_error (status);
 }
 
+/**
+ * cairo_scaled_font_get_type:
+ * @scaled_font: a #cairo_scaled_font_t
+ * 
+ * Return value: The type of @scaled_font. See #cairo_font_type_t.
+ **/
 cairo_font_type_t
 cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font)
 {
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index a317e5b..b1a36df 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -121,6 +121,12 @@ _cairo_surface_set_error (cairo_surface_
     _cairo_error (status);
 }
 
+/**
+ * cairo_surface_get_type:
+ * @surface: a #cairo_surface_t
+ * 
+ * Return value: The type of @surface. See #cairo_surface_type_t.
+ **/
 cairo_surface_type_t
 cairo_surface_get_type (cairo_surface_t *surface)
 {
diff-tree 5797f814852bb4f6ef559890640b8cd24ec5fa45 (from 5ae0b9f912b7f5fd1700cbf18763a05493f55b62)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 23:12:43 2006 -0800

    Implement cairo_pattern_get_type

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 27ede9a..a9628a3 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -524,6 +524,12 @@ cairo_pattern_reference (cairo_pattern_t
     return pattern;
 }
 
+cairo_pattern_type_t
+cairo_pattern_get_type (cairo_pattern_t *pattern)
+{
+    return pattern->type;
+}
+
 /**
  * cairo_pattern_status:
  * @pattern: a #cairo_pattern_t
diff-tree 5ae0b9f912b7f5fd1700cbf18763a05493f55b62 (from 1769830e6eea08744830c1c7ea9220d56808831a)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 23:11:32 2006 -0800

    Implement cairo_surface_get_type

diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c
index be17915..a02e56b 100644
--- a/src/cairo-directfb-surface.c
+++ b/src/cairo-directfb-surface.c
@@ -662,6 +662,7 @@ _cairo_directfb_surface_scaled_glyph_fin
 
 
 static const cairo_surface_backend_t cairo_directfb_surface_backend = {
+		CAIRO_SURFACE_TYPE_DIRECTFB,    
 		_cairo_directfb_surface_create_similar,
 		_cairo_directfb_surface_finish,
 		_cairo_directfb_surface_acquire_source_image,
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index b625472..667e231 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -2121,6 +2121,7 @@ _cairo_glitz_surface_flush (void *abstra
 }
 
 static const cairo_surface_backend_t cairo_glitz_surface_backend = {
+    CAIRO_SURFACE_TYPE_GLITZ,
     _cairo_glitz_surface_create_similar,
     _cairo_glitz_surface_finish,
     _cairo_glitz_surface_acquire_source_image,
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 108e89b..0621946 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -903,6 +903,7 @@ _cairo_surface_is_image (const cairo_sur
 }
 
 const cairo_surface_backend_t cairo_image_surface_backend = {
+    CAIRO_SURFACE_TYPE_IMAGE,
     _cairo_image_surface_create_similar,
     _cairo_image_surface_finish,
     _cairo_image_surface_acquire_source_image,
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index 6f82463..f7aeb71 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -557,6 +557,7 @@ _cairo_surface_is_meta (const cairo_surf
 }
 
 static const cairo_surface_backend_t cairo_meta_surface_backend = {
+    CAIRO_INTERNAL_SURFACE_TYPE_META,
     _cairo_meta_surface_create_similar,
     _cairo_meta_surface_finish,
     _cairo_meta_surface_acquire_source_image,
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 6317d70..4bb8572 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -111,6 +111,10 @@ _cairo_paginated_surface_create (cairo_s
 
     _cairo_surface_init (&surface->base, &cairo_paginated_surface_backend);
 
+    /* Override surface->base.type with target's type so we don't leak
+     * evidence of the paginated wrapper out to the user. */
+    surface->base.type = cairo_surface_get_type (target);
+
     surface->content = content;
     surface->width = width;
     surface->height = height;
@@ -381,6 +385,7 @@ _cairo_paginated_surface_snapshot (void 
 }
 
 const cairo_surface_backend_t cairo_paginated_surface_backend = {
+    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
     NULL, /* create_similar */
     _cairo_paginated_surface_finish,
     _cairo_paginated_surface_acquire_source_image,
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 289eeb9..cb8287b 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1657,6 +1657,7 @@ _cairo_pdf_surface_get_font_options (voi
 }
 
 static const cairo_surface_backend_t cairo_pdf_surface_backend = {
+    CAIRO_SURFACE_TYPE_PDF,
     _cairo_pdf_surface_create_similar,
     _cairo_pdf_surface_finish,
     NULL, /* acquire_source_image */
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 371290c..6028b6d 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1322,6 +1322,7 @@ _cairo_ps_surface_fill (void			*abstract
 }
 
 static const cairo_surface_backend_t cairo_ps_surface_backend = {
+    CAIRO_SURFACE_TYPE_PS,
     NULL, /* create_similar */
     _cairo_ps_surface_finish,
     NULL, /* acquire_source_image */
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 52aeafe..a317e5b 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -43,6 +43,7 @@
 
 const cairo_surface_t _cairo_surface_nil = {
     &cairo_image_surface_backend,	/* backend */
+    CAIRO_SURFACE_TYPE_IMAGE,
     -1,					/* ref_count */
     CAIRO_STATUS_NO_MEMORY,		/* status */
     FALSE,				/* finished */
@@ -59,6 +60,7 @@ const cairo_surface_t _cairo_surface_nil
 
 const cairo_surface_t _cairo_surface_nil_file_not_found = {
     &cairo_image_surface_backend,	/* backend */
+    CAIRO_SURFACE_TYPE_IMAGE,
     -1,					/* ref_count */
     CAIRO_STATUS_FILE_NOT_FOUND,	/* status */
     FALSE,				/* finished */
@@ -75,6 +77,7 @@ const cairo_surface_t _cairo_surface_nil
 
 const cairo_surface_t _cairo_surface_nil_read_error = {
     &cairo_image_surface_backend,	/* backend */
+    CAIRO_SURFACE_TYPE_IMAGE,
     -1,					/* ref_count */
     CAIRO_STATUS_READ_ERROR,		/* status */
     FALSE,				/* finished */
@@ -118,6 +121,16 @@ _cairo_surface_set_error (cairo_surface_
     _cairo_error (status);
 }
 
+cairo_surface_type_t
+cairo_surface_get_type (cairo_surface_t *surface)
+{
+    /* We don't use surface->backend->type here so that some of the
+     * special "wrapper" surfaces such as cairo_paginated_surface_t
+     * can override surface->type with the type of the "child"
+     * surface. */
+    return surface->type;
+}
+
 /**
  * cairo_surface_status:
  * @surface: a #cairo_surface_t
@@ -141,6 +154,8 @@ _cairo_surface_init (cairo_surface_t			*
 		     const cairo_surface_backend_t	*backend)
 {
     surface->backend = backend;
+    
+    surface->type = backend->type;
 
     surface->ref_count = 1;
     surface->status = CAIRO_STATUS_SUCCESS;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 5a2c92f..a5b02c9 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1221,6 +1221,7 @@ _cairo_svg_surface_get_font_options (voi
 
 
 static const cairo_surface_backend_t cairo_svg_surface_backend = {
+	CAIRO_SURFACE_TYPE_SVG,
 	_cairo_svg_surface_create_similar,
 	_cairo_svg_surface_finish,
 	NULL, /* acquire_source_image */
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index b1811a1..9dacd1d 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1030,6 +1030,7 @@ _cairo_surface_is_win32 (cairo_surface_t
 }
 
 static const cairo_surface_backend_t cairo_win32_surface_backend = {
+    CAIRO_SURFACE_TYPE_WIN32,
     _cairo_win32_surface_create_similar,
     _cairo_win32_surface_finish,
     _cairo_win32_surface_acquire_source_image,
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index faa207c..78eafc0 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -1025,6 +1025,7 @@ _cairo_xcb_surface_get_extents (void		  
 }
 
 static const cairo_surface_backend_t cairo_xcb_surface_backend = {
+    CAIRO_SURFACE_TYPE_XCB,
     _cairo_xcb_surface_create_similar,
     _cairo_xcb_surface_finish,
     _cairo_xcb_surface_acquire_source_image,
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 1ce7e89..dc7d394 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1675,6 +1675,7 @@ _cairo_xlib_surface_scaled_glyph_fini (c
 				       cairo_scaled_font_t  *scaled_font);
 
 static const cairo_surface_backend_t cairo_xlib_surface_backend = {
+    CAIRO_SURFACE_TYPE_XLIB,
     _cairo_xlib_surface_create_similar,
     _cairo_xlib_surface_finish,
     _cairo_xlib_surface_acquire_source_image,
diff --git a/src/cairoint.h b/src/cairoint.h
index a1978a9..1246123 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -256,6 +256,11 @@ typedef enum cairo_int_status {
     CAIRO_INT_STATUS_CACHE_EMPTY
 } cairo_int_status_t;
 
+typedef enum cairo_internal_surface_type {
+    CAIRO_INTERNAL_SURFACE_TYPE_META = 0x1000,
+    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED
+} cairo_internal_surface_type_t;
+
 typedef enum cairo_direction {
     CAIRO_DIRECTION_FORWARD,
     CAIRO_DIRECTION_REVERSE
@@ -604,6 +609,8 @@ typedef struct _cairo_stroke_style {
 } cairo_stroke_style_t;
 
 struct _cairo_surface_backend {
+    cairo_surface_type_t type;
+
     cairo_surface_t *
     (*create_similar)		(void			*surface,
 				 cairo_content_t	 content,
@@ -834,6 +841,11 @@ typedef struct _cairo_format_masks {
 struct _cairo_surface {
     const cairo_surface_backend_t *backend;
 
+    /* We allow surfaces to override the backend->type by shoving something
+     * else into surface->type. This is for "wrapper" surfaces that want to
+     * hide their internal type from the user-level API. */
+    cairo_surface_type_t type;
+
     unsigned int ref_count;
     cairo_status_t status;
     cairo_bool_t finished;
diff-tree 1769830e6eea08744830c1c7ea9220d56808831a (from 5a3c30eafe0b77f69434e139a2e247c8eb4230d7)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 17:22:45 2006 -0800

    Implement cairo_scaled_font_get_type

diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index 572359f..9c55851 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -664,6 +664,7 @@ _cairo_atsui_font_old_show_glyphs (void	
 }
 
 const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = {
+    CAIRO_FONT_TYPE_ATSUI,
     _cairo_atsui_font_create_toy,
     _cairo_atsui_font_fini,
     _cairo_atsui_font_scaled_glyph_init,
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index e159826..092838a 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1901,6 +1901,7 @@ _cairo_ft_show_glyphs (void		       *abs
 }
 
 const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend = {
+    CAIRO_FONT_TYPE_FT,
     _cairo_ft_scaled_font_create_toy,
     _cairo_ft_scaled_font_fini,
     _cairo_ft_scaled_glyph_init,
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 8ebbf45..46e1cac 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -118,6 +118,12 @@ _cairo_scaled_font_set_error (cairo_scal
     _cairo_error (status);
 }
 
+cairo_font_type_t
+cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font)
+{
+    return scaled_font->backend->type;
+}
+
 /**
  * cairo_scaled_font_status:
  * @scaled_font: a #cairo_scaled_font_t
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index ca8e4a6..a3289fc 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -1355,6 +1355,7 @@ CLEANUP_FONT:
 }
 
 const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend = {
+    CAIRO_FONT_TYPE_WIN32,
     _cairo_win32_scaled_font_create_toy,
     _cairo_win32_scaled_font_fini,
     _cairo_win32_scaled_font_glyph_init,
diff --git a/src/cairoint.h b/src/cairoint.h
index 401114c..a1978a9 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -509,6 +509,8 @@ typedef enum _cairo_scaled_glyph_info {
 } cairo_scaled_glyph_info_t;
 
 struct _cairo_scaled_font_backend {
+    cairo_font_type_t type;
+
     cairo_status_t
     (*create_toy)  (cairo_toy_font_face_t	*toy_face,
 		    const cairo_matrix_t	*font_matrix,
diff-tree f2245a7932b857ff70dc0476490090d906ae61f8 (from 1a1441912604c89e2912ec764fe26b7a9db995a3)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 17:07:22 2006 -0800

    Remove unused RCS $Id:$ tags.

diff --git a/src/cairo-wideint.c b/src/cairo-wideint.c
index 9e4914e..89df00b 100644
--- a/src/cairo-wideint.c
+++ b/src/cairo-wideint.c
@@ -1,5 +1,4 @@
-/*
- * $Id: cairo-wideint.c,v 1.6 2005-07-30 19:57:54 keithp Exp $
+/* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2004 Keith Packard
  *
diff --git a/src/cairo-wideint.h b/src/cairo-wideint.h
index b008b5d..795cde7 100644
--- a/src/cairo-wideint.h
+++ b/src/cairo-wideint.h
@@ -1,5 +1,4 @@
-/*
- * $Id: cairo-wideint.h,v 1.12 2005-08-05 14:48:19 cworth Exp $
+/* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2004 Keith Packard
  *
diff-tree 5a3c30eafe0b77f69434e139a2e247c8eb4230d7 (from 5928d03b496420b2d0a89cf8e2d294081a60cc67)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Feb 24 15:32:26 2006 -0800

    Implement cairo_font_face_get_type.
    
    Add font type to font_face_backend.
    Also export new CAIRO_FONT_TYPE_TOY.

diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index 9f3b54d..572359f 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -94,6 +94,7 @@ _cairo_atsui_font_face_scaled_font_creat
 }
 
 static const cairo_font_face_backend_t _cairo_atsui_font_face_backend = {
+    CAIRO_FONT_TYPE_ATSUI,
     _cairo_atsui_font_face_destroy,
     _cairo_atsui_font_face_scaled_font_create
 };
diff --git a/src/cairo-font.c b/src/cairo-font.c
index b0fab1b..bb184c4 100644
--- a/src/cairo-font.c
+++ b/src/cairo-font.c
@@ -130,6 +130,12 @@ cairo_font_face_destroy (cairo_font_face
     free (font_face);
 }
 
+cairo_font_type_t
+cairo_font_face_get_type (cairo_font_face_t *font_face)
+{
+    return font_face->backend->type;
+}
+
 /**
  * cairo_font_face_status:
  * @font_face: a #cairo_font_face_t
@@ -409,6 +415,7 @@ _cairo_toy_font_face_scaled_font_create 
 }
 
 static const cairo_font_face_backend_t _cairo_toy_font_face_backend = {
+    CAIRO_FONT_TYPE_TOY,
     _cairo_toy_font_face_destroy,
     _cairo_toy_font_face_scaled_font_create
 };
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 4599744..e159826 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2004,6 +2004,7 @@ _cairo_ft_font_face_scaled_font_create (
 }
 
 static const cairo_font_face_backend_t _cairo_ft_font_face_backend = {
+    CAIRO_FONT_TYPE_FT,
     _cairo_ft_font_face_destroy,
     _cairo_ft_font_face_scaled_font_create
 };
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 3343abf..ca8e4a6 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -1398,6 +1398,7 @@ _cairo_win32_font_face_scaled_font_creat
 }
 
 static const cairo_font_face_backend_t _cairo_win32_font_face_backend = {
+    CAIRO_FONT_TYPE_WIN32,
     _cairo_win32_font_face_destroy,
     _cairo_win32_font_face_scaled_font_create
 };
diff --git a/src/cairo.h b/src/cairo.h
index f618721..5b38d18 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -928,6 +928,7 @@ cairo_font_face_status (cairo_font_face_
  * of the wrong type is undefined.
  */
 typedef enum _cairo_font_type {
+    CAIRO_FONT_TYPE_TOY,
     CAIRO_FONT_TYPE_FT,
     CAIRO_FONT_TYPE_WIN32,
     CAIRO_FONT_TYPE_ATSUI
diff --git a/src/cairoint.h b/src/cairoint.h
index ebf2b31..401114c 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -464,6 +464,7 @@ struct _cairo_scaled_font {
 };
 
 struct _cairo_font_face {
+    /* hash_entry must be first */
     cairo_hash_entry_t hash_entry;
     cairo_status_t status;
     int ref_count;
@@ -555,6 +556,8 @@ struct _cairo_scaled_font_backend {
 };
 
 struct _cairo_font_face_backend {
+    cairo_font_type_t	type;
+
     /* The destroy() function is allowed to resurrect the font face
      * by re-referencing. This is needed for the FreeType backend.
      */
diff-tree 5928d03b496420b2d0a89cf8e2d294081a60cc67 (from f58f39d7afee8d8a663569f149651c789aa95da8)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Feb 24 15:25:19 2006 -0800

    Remove private cairo_pattern_type in favor of new public one. Rename
    all values to now include TYPE. Drop _GRADIENT from LINEAR and RADIAL.

diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index a314150..6f82463 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -201,7 +201,7 @@ _init_pattern_with_snapshot (cairo_patte
 {
     _cairo_pattern_init_copy (pattern, other);
 
-    if (pattern->type == CAIRO_PATTERN_SURFACE) {
+    if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
 	cairo_surface_pattern_t *surface_pattern =
 	    (cairo_surface_pattern_t *) pattern;
 	cairo_surface_t *surface = surface_pattern->surface;
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index d7b7369..27ede9a 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -30,7 +30,7 @@
 #include "cairoint.h"
 
 const cairo_solid_pattern_t cairo_pattern_nil = {
-    { CAIRO_PATTERN_SOLID, 	/* type */
+    { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
       (unsigned int)-1,		/* ref_count */
       CAIRO_STATUS_NO_MEMORY,	/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
@@ -39,7 +39,7 @@ const cairo_solid_pattern_t cairo_patter
 };
 
 static const cairo_solid_pattern_t cairo_pattern_nil_null_pointer = {
-    { CAIRO_PATTERN_SOLID, 	/* type */
+    { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
       (unsigned int)-1,		/* ref_count */
       CAIRO_STATUS_NULL_POINTER,/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
@@ -48,7 +48,7 @@ static const cairo_solid_pattern_t cairo
 };
 
 static const cairo_solid_pattern_t cairo_pattern_nil_file_not_found = {
-    { CAIRO_PATTERN_SOLID, 	/* type */
+    { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
       (unsigned int)-1,		/* ref_count */
       CAIRO_STATUS_FILE_NOT_FOUND, /* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
@@ -57,7 +57,7 @@ static const cairo_solid_pattern_t cairo
 };
 
 static const cairo_solid_pattern_t cairo_pattern_nil_read_error = {
-    { CAIRO_PATTERN_SOLID, 	/* type */
+    { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
       (unsigned int)-1,		/* ref_count */
       CAIRO_STATUS_READ_ERROR,	/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
@@ -117,7 +117,7 @@ _cairo_pattern_init (cairo_pattern_t *pa
     pattern->ref_count = 1;
     pattern->status    = CAIRO_STATUS_SUCCESS;
 
-    if (type == CAIRO_PATTERN_SURFACE)
+    if (type == CAIRO_PATTERN_TYPE_SURFACE)
 	pattern->extend = CAIRO_EXTEND_SURFACE_DEFAULT;
     else
 	pattern->extend = CAIRO_EXTEND_GRADIENT_DEFAULT;
@@ -131,7 +131,7 @@ static void
 _cairo_gradient_pattern_init_copy (cairo_gradient_pattern_t	  *pattern,
 				   const cairo_gradient_pattern_t *other)
 {
-    if (other->base.type == CAIRO_PATTERN_LINEAR)
+    if (other->base.type == CAIRO_PATTERN_TYPE_LINEAR)
     {
 	cairo_linear_pattern_t *dst = (cairo_linear_pattern_t *) pattern;
 	cairo_linear_pattern_t *src = (cairo_linear_pattern_t *) other;
@@ -170,21 +170,21 @@ _cairo_pattern_init_copy (cairo_pattern_
     }
 
     switch (other->type) {
-    case CAIRO_PATTERN_SOLID: {
+    case CAIRO_PATTERN_TYPE_SOLID: {
 	cairo_solid_pattern_t *dst = (cairo_solid_pattern_t *) pattern;
 	cairo_solid_pattern_t *src = (cairo_solid_pattern_t *) other;
 
 	*dst = *src;
     } break;
-    case CAIRO_PATTERN_SURFACE: {
+    case CAIRO_PATTERN_TYPE_SURFACE: {
 	cairo_surface_pattern_t *dst = (cairo_surface_pattern_t *) pattern;
 	cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) other;
 	
 	*dst = *src;
 	cairo_surface_reference (dst->surface);
     } break;
-    case CAIRO_PATTERN_LINEAR:
-    case CAIRO_PATTERN_RADIAL: {
+    case CAIRO_PATTERN_TYPE_LINEAR:
+    case CAIRO_PATTERN_TYPE_RADIAL: {
 	cairo_gradient_pattern_t *dst = (cairo_gradient_pattern_t *) pattern;
 	cairo_gradient_pattern_t *src = (cairo_gradient_pattern_t *) other;
 	
@@ -199,16 +199,16 @@ void
 _cairo_pattern_fini (cairo_pattern_t *pattern)
 {
     switch (pattern->type) {
-    case CAIRO_PATTERN_SOLID:
+    case CAIRO_PATTERN_TYPE_SOLID:
 	break;
-    case CAIRO_PATTERN_SURFACE: {
+    case CAIRO_PATTERN_TYPE_SURFACE: {
 	cairo_surface_pattern_t *surface_pattern =
 	    (cairo_surface_pattern_t *) pattern;
 	
 	cairo_surface_destroy (surface_pattern->surface);
     } break;
-    case CAIRO_PATTERN_LINEAR:
-    case CAIRO_PATTERN_RADIAL: {
+    case CAIRO_PATTERN_TYPE_LINEAR:
+    case CAIRO_PATTERN_TYPE_RADIAL: {
 	cairo_gradient_pattern_t *gradient =
 	    (cairo_gradient_pattern_t *) pattern;
 	
@@ -222,7 +222,7 @@ void
 _cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
 			   const cairo_color_t	 *color)
 {
-    _cairo_pattern_init (&pattern->base, CAIRO_PATTERN_SOLID);
+    _cairo_pattern_init (&pattern->base, CAIRO_PATTERN_TYPE_SOLID);
     pattern->color = *color;
 }
 
@@ -232,12 +232,12 @@ _cairo_pattern_init_for_surface (cairo_s
 {
     if (surface->status) {
 	/* Force to solid to simplify the pattern_fini process. */
-	pattern->base.type = CAIRO_PATTERN_SOLID;
+	pattern->base.type = CAIRO_PATTERN_TYPE_SOLID;
 	_cairo_pattern_set_error (&pattern->base, surface->status);
 	return;
     }
 
-    _cairo_pattern_init (&pattern->base, CAIRO_PATTERN_SURFACE);
+    _cairo_pattern_init (&pattern->base, CAIRO_PATTERN_TYPE_SURFACE);
     
     pattern->surface = cairo_surface_reference (surface);
 }
@@ -256,7 +256,7 @@ void
 _cairo_pattern_init_linear (cairo_linear_pattern_t *pattern,
 			    double x0, double y0, double x1, double y1)
 {
-    _cairo_pattern_init_gradient (&pattern->base, CAIRO_PATTERN_LINEAR);
+    _cairo_pattern_init_gradient (&pattern->base, CAIRO_PATTERN_TYPE_LINEAR);
 
     pattern->gradient.p1.x = _cairo_fixed_from_double (x0);
     pattern->gradient.p1.y = _cairo_fixed_from_double (y0);
@@ -269,7 +269,7 @@ _cairo_pattern_init_radial (cairo_radial
 			    double cx0, double cy0, double radius0,
 			    double cx1, double cy1, double radius1)
 {
-    _cairo_pattern_init_gradient (&pattern->base, CAIRO_PATTERN_RADIAL);
+    _cairo_pattern_init_gradient (&pattern->base, CAIRO_PATTERN_TYPE_RADIAL);
 
     pattern->gradient.inner.x	   = _cairo_fixed_from_double (cx0);
     pattern->gradient.inner.y	   = _cairo_fixed_from_double (cy0);
@@ -641,8 +641,8 @@ cairo_pattern_add_color_stop_rgb (cairo_
     if (pattern->status)
 	return;
 
-    if (pattern->type != CAIRO_PATTERN_LINEAR &&
-	pattern->type != CAIRO_PATTERN_RADIAL)
+    if (pattern->type != CAIRO_PATTERN_TYPE_LINEAR &&
+	pattern->type != CAIRO_PATTERN_TYPE_RADIAL)
     {
 	_cairo_pattern_set_error (pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
 	return;
@@ -689,8 +689,8 @@ cairo_pattern_add_color_stop_rgba (cairo
     if (pattern->status)
 	return;
 
-    if (pattern->type != CAIRO_PATTERN_LINEAR &&
-	pattern->type != CAIRO_PATTERN_RADIAL)
+    if (pattern->type != CAIRO_PATTERN_TYPE_LINEAR &&
+	pattern->type != CAIRO_PATTERN_TYPE_RADIAL)
     {
 	_cairo_pattern_set_error (pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
 	return;
@@ -894,7 +894,7 @@ _cairo_pattern_acquire_surface_for_gradi
     cairo_status_t	  status;
     cairo_bool_t	  repeat = FALSE;
 
-    if (pattern->base.type == CAIRO_PATTERN_LINEAR)
+    if (pattern->base.type == CAIRO_PATTERN_TYPE_LINEAR)
     {
 	cairo_linear_pattern_t *linear = (cairo_linear_pattern_t *) pattern;
 
@@ -936,7 +936,7 @@ _cairo_pattern_acquire_surface_for_gradi
 	return CAIRO_STATUS_SUCCESS;
     }
 
-    if (pattern->base.type == CAIRO_PATTERN_LINEAR) {
+    if (pattern->base.type == CAIRO_PATTERN_TYPE_LINEAR) {
 	cairo_bool_t is_horizontal;
 	cairo_bool_t is_vertical;
 
@@ -1055,7 +1055,7 @@ _cairo_pattern_is_opaque_solid (cairo_pa
 {
     cairo_solid_pattern_t *solid;
 
-    if (pattern->type != CAIRO_PATTERN_SOLID)
+    if (pattern->type != CAIRO_PATTERN_TYPE_SOLID)
 	return FALSE;
 
     solid = (cairo_solid_pattern_t *) pattern;
@@ -1151,7 +1151,7 @@ _cairo_pattern_acquire_surface (cairo_pa
     }
 
     switch (pattern->type) {
-    case CAIRO_PATTERN_SOLID: {
+    case CAIRO_PATTERN_TYPE_SOLID: {
 	cairo_solid_pattern_t *src = (cairo_solid_pattern_t *) pattern;
 	
 	status = _cairo_pattern_acquire_surface_for_solid (src, dst,
@@ -1159,8 +1159,8 @@ _cairo_pattern_acquire_surface (cairo_pa
 							   surface_out,
 							   attributes);
 	} break;
-    case CAIRO_PATTERN_LINEAR:
-    case CAIRO_PATTERN_RADIAL: {
+    case CAIRO_PATTERN_TYPE_LINEAR:
+    case CAIRO_PATTERN_TYPE_RADIAL: {
 	cairo_gradient_pattern_t *src = (cairo_gradient_pattern_t *) pattern;
 
 	/* fast path for gradients with less than 2 color stops */
@@ -1203,7 +1203,7 @@ _cairo_pattern_acquire_surface (cairo_pa
 								  attributes);
 	}
     } break;
-    case CAIRO_PATTERN_SURFACE: {
+    case CAIRO_PATTERN_TYPE_SURFACE: {
 	cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) pattern;
 	
 	status = _cairo_pattern_acquire_surface_for_surface (src, dst,
@@ -1235,7 +1235,7 @@ _cairo_pattern_release_surface (cairo_pa
     {
 	cairo_surface_pattern_t *surface_pattern;
 
-	assert (pattern->type == CAIRO_PATTERN_SURFACE);
+	assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
 	surface_pattern = (cairo_surface_pattern_t *) pattern;
 
 	_cairo_surface_release_source_image (surface_pattern->surface,
@@ -1277,8 +1277,8 @@ _cairo_pattern_acquire_surfaces (cairo_p
     /* XXX: This optimization assumes that there is no color
      * information in mask, so this will need to change when we
      * support RENDER-style 4-channel masks. */
-    if (src->type == CAIRO_PATTERN_SOLID &&
-	mask && mask->type == CAIRO_PATTERN_SOLID)
+    if (src->type == CAIRO_PATTERN_TYPE_SOLID &&
+	mask && mask->type == CAIRO_PATTERN_TYPE_SOLID)
     {
 	cairo_color_t combined;
 	cairo_solid_pattern_t *src_solid = (cairo_solid_pattern_t *) src;
@@ -1346,7 +1346,7 @@ _cairo_pattern_get_extents (cairo_patter
 			    cairo_rectangle_t	*extents)
 {
     if (pattern->extend == CAIRO_EXTEND_NONE &&
-	pattern->type == CAIRO_PATTERN_SURFACE)
+	pattern->type == CAIRO_PATTERN_TYPE_SURFACE)
     {
 	cairo_status_t status;
 	cairo_rectangle_t surface_extents;
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index ee5c482..289eeb9 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -841,7 +841,7 @@ _cairo_pdf_surface_composite (cairo_oper
     if (mask_pattern)
  	return CAIRO_STATUS_SUCCESS;
     
-    if (src_pattern->type != CAIRO_PATTERN_SURFACE)
+    if (src_pattern->type != CAIRO_PATTERN_TYPE_SURFACE)
 	return CAIRO_STATUS_SUCCESS;
 
     if (src->surface->backend == &cairo_pdf_surface_backend)
@@ -1237,16 +1237,16 @@ static cairo_status_t
 emit_pattern (cairo_pdf_surface_t *surface, cairo_pattern_t *pattern)
 {
     switch (pattern->type) {
-    case CAIRO_PATTERN_SOLID:	
+    case CAIRO_PATTERN_TYPE_SOLID:
 	return emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
 
-    case CAIRO_PATTERN_SURFACE:
+    case CAIRO_PATTERN_TYPE_SURFACE:
 	return emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern);
 
-    case CAIRO_PATTERN_LINEAR:
+    case CAIRO_PATTERN_TYPE_LINEAR:
 	return emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern);
 
-    case CAIRO_PATTERN_RADIAL:
+    case CAIRO_PATTERN_TYPE_RADIAL:
 	return emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern);
     }
 
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 6cf8621..371290c 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -546,12 +546,12 @@ pattern_is_translucent (const cairo_patt
 
     pattern = (cairo_pattern_union_t *) abstract_pattern;
     switch (pattern->base.type) {
-    case CAIRO_PATTERN_SOLID:
+    case CAIRO_PATTERN_TYPE_SOLID:
 	return color_is_translucent (&pattern->solid.color);
-    case CAIRO_PATTERN_SURFACE:
+    case CAIRO_PATTERN_TYPE_SURFACE:
 	return surface_is_translucent (pattern->surface.surface);
-    case CAIRO_PATTERN_LINEAR:
-    case CAIRO_PATTERN_RADIAL:
+    case CAIRO_PATTERN_TYPE_LINEAR:
+    case CAIRO_PATTERN_TYPE_RADIAL:
 	return gradient_is_translucent (&pattern->gradient.base);
     }	
 
@@ -637,7 +637,7 @@ color_operation_needs_fallback (cairo_op
 static cairo_bool_t
 pattern_type_supported (const cairo_pattern_t *pattern)
 {
-    if (pattern->type == CAIRO_PATTERN_SOLID)
+    if (pattern->type == CAIRO_PATTERN_TYPE_SOLID)
 	return TRUE;
     return FALSE;
 }
@@ -837,19 +837,19 @@ emit_pattern (cairo_ps_surface_t *surfac
      * different pattern. */
 
     switch (pattern->type) {
-    case CAIRO_PATTERN_SOLID:	
+    case CAIRO_PATTERN_TYPE_SOLID:	
 	emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
 	break;
 
-    case CAIRO_PATTERN_SURFACE:
+    case CAIRO_PATTERN_TYPE_SURFACE:
 	emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern);
 	break;
 
-    case CAIRO_PATTERN_LINEAR:
+    case CAIRO_PATTERN_TYPE_LINEAR:
 	emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern);
 	break;
 
-    case CAIRO_PATTERN_RADIAL:
+    case CAIRO_PATTERN_TYPE_RADIAL:
 	emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern);
 	break;	    
     }
@@ -890,12 +890,12 @@ _cairo_ps_surface_composite (cairo_opera
 
     status = CAIRO_STATUS_SUCCESS;
     switch (src_pattern->type) {
-    case CAIRO_PATTERN_SOLID:
+    case CAIRO_PATTERN_TYPE_SOLID:
 	_cairo_output_stream_printf (stream,
 				     "%% _cairo_ps_surface_composite: solid\n");
 	goto bail;
 
-    case CAIRO_PATTERN_SURFACE:
+    case CAIRO_PATTERN_TYPE_SURFACE:
 	surface_pattern = (cairo_surface_pattern_t *) src_pattern;
 
 	if (src_pattern->extend != CAIRO_EXTEND_NONE) {
@@ -920,8 +920,8 @@ _cairo_ps_surface_composite (cairo_opera
 					     image, image_extra);
 	break;
 
-    case CAIRO_PATTERN_LINEAR:
-    case CAIRO_PATTERN_RADIAL:
+    case CAIRO_PATTERN_TYPE_LINEAR:
+    case CAIRO_PATTERN_TYPE_RADIAL:
 	_cairo_output_stream_printf (stream,
 				     "%% _cairo_ps_surface_composite: gradient\n");
 	goto bail;
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 8f18ca3..9dde31f 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -576,7 +576,7 @@ _clip_and_composite_trapezoids (cairo_pa
     {
 	cairo_surface_t *clip_surface = clip ? clip->surface : NULL;
 	
-	if ((src->type == CAIRO_PATTERN_SOLID || op == CAIRO_OPERATOR_CLEAR) &&
+	if ((src->type == CAIRO_PATTERN_TYPE_SOLID || op == CAIRO_OPERATOR_CLEAR) &&
 	    !clip_surface)
 	{
 	    const cairo_color_t *color;
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 38c7c76..1ce7e89 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1047,7 +1047,7 @@ _categorize_composite_operation (cairo_x
     if (!dst->buggy_repeat)
 	return DO_RENDER;
 
-    if (src_pattern->type == CAIRO_PATTERN_SURFACE)
+    if (src_pattern->type == CAIRO_PATTERN_TYPE_SURFACE)
     {
 	cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *)src_pattern;
 	
diff --git a/src/cairo.h b/src/cairo.h
index cc87b7e..f618721 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1389,8 +1389,8 @@ cairo_pattern_status (cairo_pattern_t *p
  * @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
  * color. It may be opaque or translucent.
  * @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image).
- * @CAIRO_PATTERN_TYPE_LINEAR_GRADIENT: The pattern is a linear gradient.
- * @CAIRO_PATTERN_TYPE_RADIAL_GRADIENT: The pattern is a radial gradient.
+ * @CAIRO_PATTERN_TYPE_LINEAR: The pattern is a linear gradient.
+ * @CAIRO_PATTERN_TYPE_RADIAL: The pattern is a radial gradient.
  *
  * @cairo_pattern_type_t us used to describe the type of a given pattern.
  *
@@ -1407,14 +1407,14 @@ cairo_pattern_status (cairo_pattern_t *p
  * pattern will have no effect). A notable exception is
  * cairo_pattern_add_color_stop_rgb() and
  * cairo_pattern_add_color_stop_rgba() which must only be called with
- * gradient patterns. Otherwise the pattern will be shutdown and put
- * into an error state.
+ * gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
+ * will be shutdown and put into an error state.
  */
 typedef enum _cairo_pattern_type {
     CAIRO_PATTERN_TYPE_SOLID,
     CAIRO_PATTERN_TYPE_SURFACE,
-    CAIRO_PATTERN_TYPE_LINEAR_GRADIENT,
-    CAIRO_PATTERN_TYPE_RADIAL_GRADIENT
+    CAIRO_PATTERN_TYPE_LINEAR,
+    CAIRO_PATTERN_TYPE_RADIAL
 } cairo_pattern_type_t;
 
 cairo_public cairo_pattern_type_t
diff --git a/src/cairoint.h b/src/cairoint.h
index 88fccae..ebf2b31 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -909,13 +909,6 @@ typedef enum {
 #define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_PAD
 #define CAIRO_FILTER_DEFAULT CAIRO_FILTER_BEST
 
-typedef enum {
-    CAIRO_PATTERN_SOLID,
-    CAIRO_PATTERN_SURFACE,
-    CAIRO_PATTERN_LINEAR,
-    CAIRO_PATTERN_RADIAL
-} cairo_pattern_type_t;
-
 struct _cairo_pattern {
     cairo_pattern_type_t type;
     unsigned int	 ref_count;
diff-tree f58f39d7afee8d8a663569f149651c789aa95da8 (from 2fc9fd79e794129b26cc8f9b62a5aa4604cb99d9)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Feb 24 15:06:50 2006 -0800

    cairo.h: Fix typo (thanks to Torsten Schoenfeld)

diff --git a/src/cairo.h b/src/cairo.h
index 0dd3616..cc87b7e 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -934,7 +934,7 @@ typedef enum _cairo_font_type {
 } cairo_font_type_t;
 
 cairo_public cairo_font_type_t
-cairo_font_face_get_type (cairo_scaled_font_t *font_face);
+cairo_font_face_get_type (cairo_font_face_t *font_face);
 
 cairo_public void *
 cairo_font_face_get_user_data (cairo_font_face_t	   *font_face,
diff-tree 2fc9fd79e794129b26cc8f9b62a5aa4604cb99d9 (from 9287d60d60f55ae3838a7cecfa9fa04a5f95e8de)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Feb 24 11:37:50 2006 -0800

    cairo.h: Fix two typos in the documentation.

diff --git a/src/cairo.h b/src/cairo.h
index 76f9257..0dd3616 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1204,7 +1204,7 @@ cairo_surface_status (cairo_surface_t *s
  * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image
  * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf
  * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps
- * @CAIRO_SURFACE_TYPE_XLIB: The surface is of typs xlib
+ * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib
  * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb
  * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz
  * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz
@@ -1396,7 +1396,7 @@ cairo_pattern_status (cairo_pattern_t *p
  *
  * The type of a pattern is determined by the function used to create
  * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
- * functions create SOLID patterns. The reamaining
+ * functions create SOLID patterns. The remaining
  * cairo_pattern_create functions map to pattern types in obvious
  * ways.
  *
diff-tree 9287d60d60f55ae3838a7cecfa9fa04a5f95e8de (from d0e02a948e83e3b1b330c9cb0aa4930b42bf485c)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Feb 24 11:24:03 2006 -0800

    Add get_type functions: cairo_surface_get_type,
    cairo_pattern_get_type, cairo_font_face_get_type, and
    cairo_scaled_font_get_type.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 2982017..52aeafe 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -186,7 +186,8 @@ _cairo_surface_create_similar_scratch (c
  * 
  * Create a new surface that is as compatible as possible with an
  * existing surface. The new surface will use the same backend as
- * @other unless that is not possible for some reason.
+ * @other unless that is not possible for some reason. The type of the
+ * returned surface may be examined with cairo_surface_get_type().
  * 
  * Return value: a pointer to the newly allocated surface. The caller
  * owns the surface and should call cairo_surface_destroy when done
diff --git a/src/cairo.h b/src/cairo.h
index fbb3620..76f9257 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -896,6 +896,46 @@ cairo_font_face_destroy (cairo_font_face
 cairo_public cairo_status_t
 cairo_font_face_status (cairo_font_face_t *font_face);
 
+/**
+ * cairo_font_type_t
+ * @CAIRO_SCALED_FONT_TYPE_FT: The font is of type ft
+ * @CAIRO_SCALED_FONT_TYPE_WIN32: The font is of type win32
+ * @CAIRO_SCALED_FONT_TYPE_ATSUI: The font is of type atsui
+ *
+ * @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
+ * backends" within cairo.
+ *
+ * The type of a font face is determined by the function used to
+ * create it, which will generally be of the form
+ * cairo_<type>_font_face_create. The font face type can be queried
+ * with cairo_font_face_get_type()
+ *
+ * The various cairo_font_face functions can be used with a font face
+ * of any type.
+ *
+ * The type of a scaled font is determined by the type of the font
+ * face passed to cairo_scaled_font_create. The scaled font type can
+ * be queried with cairo_scaled_font_get_type()
+ *
+ * The various cairo_scaled_font functions can be used with scaled
+ * fonts of any type, but some font backends also provide
+ * type-specific functions that must only be called with a scaled font
+ * of the appropriate type. These functions have names that begin with
+ * cairo_<type>_scaled_font such as cairo_ft_scaled_font_lock_face.
+ *
+ * The behavior of calling a type-specific function with a scaled font
+ * of the wrong type is undefined.
+ */
+typedef enum _cairo_font_type {
+    CAIRO_FONT_TYPE_FT,
+    CAIRO_FONT_TYPE_WIN32,
+    CAIRO_FONT_TYPE_ATSUI
+} cairo_font_type_t;
+
+cairo_public cairo_font_type_t
+cairo_font_face_get_type (cairo_scaled_font_t *font_face);
+
 cairo_public void *
 cairo_font_face_get_user_data (cairo_font_face_t	   *font_face,
 			       const cairo_user_data_key_t *key);
@@ -923,6 +963,9 @@ cairo_scaled_font_destroy (cairo_scaled_
 cairo_public cairo_status_t
 cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
 
+cairo_public cairo_font_type_t
+cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
+
 cairo_public void
 cairo_scaled_font_extents (cairo_scaled_font_t  *scaled_font,
 			   cairo_font_extents_t *extents);
@@ -1148,13 +1191,63 @@ cairo_public cairo_surface_t *
 cairo_surface_reference (cairo_surface_t *surface);
 
 cairo_public void
+cairo_surface_finish (cairo_surface_t *surface);
+
+cairo_public void
 cairo_surface_destroy (cairo_surface_t *surface);
 
 cairo_public cairo_status_t
 cairo_surface_status (cairo_surface_t *surface);
 
-cairo_public void
-cairo_surface_finish (cairo_surface_t *surface);
+/**
+ * cairo_surface_type_t
+ * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image
+ * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf
+ * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps
+ * @CAIRO_SURFACE_TYPE_XLIB: The surface is of typs xlib
+ * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb
+ * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz
+ * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz
+ * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32
+ * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos
+ * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb
+ * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg
+ *
+ * @cairo_surface_type_t is used to describe the type of a given
+ * surface. The surface types are also known as "backends" or "surface
+ * backends" within cairo.
+ *
+ * The type of a surface is determined by the function used to create
+ * it, which will generally be of the form cairo_<type>_surface_create,
+ * (though see cairo_surface_create_similar as well).
+ *
+ * The surface type can be queried with cairo_surface_get_type()
+ *
+ * The various cairo_surface functions can be used with surfaces of
+ * any type, but some backends also provide type-specific functions
+ * that must only be called with a surface of the appropriate
+ * type. These functions have names that begin with
+ * cairo_<type>_surface such as cairo_image_surface_get_width().
+ *
+ * The behavior of calling a type-specific function with a surface of
+ * the wrong type is undefined.
+ */
+typedef enum _cairo_surface_type {
+    CAIRO_SURFACE_TYPE_IMAGE,
+    CAIRO_SURFACE_TYPE_PDF,
+    CAIRO_SURFACE_TYPE_PS,
+    CAIRO_SURFACE_TYPE_XLIB,
+    CAIRO_SURFACE_TYPE_XCB,
+    CAIRO_SURFACE_TYPE_GLITZ,
+    CAIRO_SURFACE_TYPE_QUARTZ,
+    CAIRO_SURFACE_TYPE_WIN32,
+    CAIRO_SURFACE_TYPE_BEOS,
+    CAIRO_SURFACE_TYPE_DIRECTFB,
+    CAIRO_SURFACE_TYPE_SVG
+} cairo_surface_type_t;
+
+cairo_public cairo_surface_type_t
+cairo_surface_get_type (cairo_surface_t *surface);
 
 #if CAIRO_HAS_PNG_FUNCTIONS
 
@@ -1290,6 +1383,43 @@ cairo_pattern_destroy (cairo_pattern_t *
 cairo_public cairo_status_t
 cairo_pattern_status (cairo_pattern_t *pattern);
 
+/**
+ * cairo_pattern_type_t
+
+ * @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
+ * color. It may be opaque or translucent.
+ * @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image).
+ * @CAIRO_PATTERN_TYPE_LINEAR_GRADIENT: The pattern is a linear gradient.
+ * @CAIRO_PATTERN_TYPE_RADIAL_GRADIENT: The pattern is a radial gradient.
+ *
+ * @cairo_pattern_type_t us used to describe the type of a given pattern.
+ *
+ * The type of a pattern is determined by the function used to create
+ * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
+ * functions create SOLID patterns. The reamaining
+ * cairo_pattern_create functions map to pattern types in obvious
+ * ways.
+ *
+ * The pattern type can be queried with cairo_pattern_get_type()
+ *
+ * Most cairo_pattern functions can be called with a pattern of any
+ * type, (though trying to change the extend or filter for a solid
+ * pattern will have no effect). A notable exception is
+ * cairo_pattern_add_color_stop_rgb() and
+ * cairo_pattern_add_color_stop_rgba() which must only be called with
+ * gradient patterns. Otherwise the pattern will be shutdown and put
+ * into an error state.
+ */
+typedef enum _cairo_pattern_type {
+    CAIRO_PATTERN_TYPE_SOLID,
+    CAIRO_PATTERN_TYPE_SURFACE,
+    CAIRO_PATTERN_TYPE_LINEAR_GRADIENT,
+    CAIRO_PATTERN_TYPE_RADIAL_GRADIENT
+} cairo_pattern_type_t;
+
+cairo_public cairo_pattern_type_t
+cairo_pattern_get_type (cairo_pattern_t *pattern);
+
 cairo_public void
 cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
 				  double offset,


More information about the cairo-commit mailing list