[cairo-commit] cairo-5c ChangeLog, 1.20, 1.21 cairo-5c.h, 1.13, 1.14 cairo.5c, 1.10, 1.11 cairo.c, 1.4, 1.5 draw.c, 1.6, 1.7 event.c, 1.4, 1.5 gstate.c, 1.8, 1.9 gtk.c, 1.8, 1.9 init.c, 1.13, 1.14 pattern.c, 1.5, 1.6 surface.c, 1.11, 1.12 text.c, 1.7, 1.8

Keith Packard commit at pdx.freedesktop.org
Tue May 17 23:21:18 PDT 2005


Committed by: keithp

Update of /cvs/cairo/cairo-5c
In directory gabe:/tmp/cvs-serv17181

Modified Files:
	ChangeLog cairo-5c.h cairo.5c cairo.c draw.c event.c gstate.c 
	gtk.c init.c pattern.c surface.c text.c 
Log Message:
2005-05-17  Keith Packard  <keithp at keithp.com>

	* cairo-5c.h:
	* cairo.5c:
	* cairo.c: (cairo_5c_get), (do_Cairo_create), (cairo_5c_dirty),
	(cairo_5c_enable), (cairo_5c_disable), (do_Cairo_get_target):
	* draw.c: (do_Cairo_paint), (do_Cairo_paint_with_alpha),
	(do_Cairo_mask), (do_Cairo_mask_surface), (do_Cairo_fill_preserve),
	(do_Cairo_stroke_preserve), (path_elt_new), (path_array),
	(do_Cairo_copy_path), (do_Cairo_copy_path_flat),
	(do_Cairo_append_path):
	* event.c: (do_Cairo_Surface_open_event):
	* examples/animate.5c:
	* examples/draw.5c:
	* examples/fob.5c:
	* examples/metrics.5c:
	* examples/sin.5c:
	* examples/spin.5c:
	* examples/spinman.5c:
	* examples/test.5c:
	* gstate.c: (do_Cairo_set_source_surface),
	(do_Cairo_identity_matrix), (do_Cairo_transform),
	(do_Cairo_user_to_device), (do_Cairo_user_to_device_distance),
	(do_Cairo_device_to_user), (do_Cairo_device_to_user_distance),
	(do_Cairo_reset_clip), (do_Cairo_clip_preserve):
	* gtk.c: (create_gtk_global):
	* init.c: (init_types), (nickle_init):
	* pattern.c: (do_Cairo_Pattern_create_for_surface),
	(do_Cairo_Pattern_add_color_stop_rgba),
	(do_Cairo_Pattern_add_color_stop_rgb):
	* surface.c: (cairo_5c_surface_get), (cairo_5c_surface_mark),
	(cairo_5c_surface_destroy), (do_Cairo_Surface_write_to_png),
	(do_Cairo_Surface_write_to_png_file),
	(do_Cairo_Surface_set_device_offset),
	(do_Cairo_Surface_create_similar), (do_Cairo_Surface_finish),
	(do_Cairo_Surface_destroy), (do_Cairo_Surface_width),
	(do_Cairo_Surface_height), (do_Cairo_Image_surface_create),
	(do_Cairo_Image_surface_create_from_png),
	(do_Cairo_Image_surface_create_from_png_file),
	(do_Cairo_Pdf_surface_create):
	* text.c: (do_Cairo_select_font_face), (do_Cairo_get_font_matrix):
	Another round of API changes for cairo 0.5, the putative
	final API structure.


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-5c/ChangeLog,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ChangeLog	2 May 2005 20:24:38 -0000	1.20
+++ ChangeLog	18 May 2005 06:21:15 -0000	1.21
@@ -1,3 +1,47 @@
+2005-05-17  Keith Packard  <keithp at keithp.com>
+
+	* cairo-5c.h:
+	* cairo.5c:
+	* cairo.c: (cairo_5c_get), (do_Cairo_create), (cairo_5c_dirty),
+	(cairo_5c_enable), (cairo_5c_disable), (do_Cairo_get_target):
+	* draw.c: (do_Cairo_paint), (do_Cairo_paint_with_alpha),
+	(do_Cairo_mask), (do_Cairo_mask_surface), (do_Cairo_fill_preserve),
+	(do_Cairo_stroke_preserve), (path_elt_new), (path_array),
+	(do_Cairo_copy_path), (do_Cairo_copy_path_flat),
+	(do_Cairo_append_path):
+	* event.c: (do_Cairo_Surface_open_event):
+	* examples/animate.5c:
+	* examples/draw.5c:
+	* examples/fob.5c:
+	* examples/metrics.5c:
+	* examples/sin.5c:
+	* examples/spin.5c:
+	* examples/spinman.5c:
+	* examples/test.5c:
+	* gstate.c: (do_Cairo_set_source_surface),
+	(do_Cairo_identity_matrix), (do_Cairo_transform),
+	(do_Cairo_user_to_device), (do_Cairo_user_to_device_distance),
+	(do_Cairo_device_to_user), (do_Cairo_device_to_user_distance),
+	(do_Cairo_reset_clip), (do_Cairo_clip_preserve):
+	* gtk.c: (create_gtk_global):
+	* init.c: (init_types), (nickle_init):
+	* pattern.c: (do_Cairo_Pattern_create_for_surface),
+	(do_Cairo_Pattern_add_color_stop_rgba),
+	(do_Cairo_Pattern_add_color_stop_rgb):
+	* surface.c: (cairo_5c_surface_get), (cairo_5c_surface_mark),
+	(cairo_5c_surface_destroy), (do_Cairo_Surface_write_to_png),
+	(do_Cairo_Surface_write_to_png_file),
+	(do_Cairo_Surface_set_device_offset),
+	(do_Cairo_Surface_create_similar), (do_Cairo_Surface_finish),
+	(do_Cairo_Surface_destroy), (do_Cairo_Surface_width),
+	(do_Cairo_Surface_height), (do_Cairo_Image_surface_create),
+	(do_Cairo_Image_surface_create_from_png),
+	(do_Cairo_Image_surface_create_from_png_file),
+	(do_Cairo_Pdf_surface_create):
+	* text.c: (do_Cairo_select_font_face), (do_Cairo_get_font_matrix):
+	Another round of API changes for cairo 0.5, the putative
+	final API structure.
+
 2005-05-02  Keith Packard  <keithp at keithp.com>
 
 	* cairo-5c.h:

Index: cairo-5c.h
===================================================================
RCS file: /cvs/cairo/cairo-5c/cairo-5c.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cairo-5c.h	2 May 2005 20:24:38 -0000	1.13
+++ cairo-5c.h	18 May 2005 06:21:15 -0000	1.14
@@ -43,13 +43,13 @@
 #include <cairo.h>
 #include <cairo-xlib.h>
 #include <cairo-png.h>
-#include <cairo-ps.h>
+#include <cairo-pdf.h>
 #include <cairo-ft.h>
 #include <stdio.h>
 #include <unistd.h>
 #undef Atom
 
-typedef enum { CAIRO_5C_WINDOW, CAIRO_5C_IMAGE, CAIRO_5C_PS, CAIRO_5C_SCRATCH } cairo_5c_kind_t;
+typedef enum { CAIRO_5C_WINDOW, CAIRO_5C_IMAGE, CAIRO_5C_PDF, CAIRO_5C_SCRATCH } cairo_5c_kind_t;
 
 typedef struct _cairo_5c_tool	cairo_5c_tool_t;
 
@@ -60,9 +60,13 @@
     FILE	    *send_events;
 } cairo_5c_window_t;
 
-typedef struct _cairo_ps_t {
-    FILE	*file;
-} cairo_5c_ps_t;
+typedef struct _cairo_5c_pdf_t {
+    Value	    file;
+} cairo_5c_pdf_t;
+
+typedef struct _cairo_5c_image_t {
+    int		    unused;
+} cairo_5c_image_t;
 
 typedef struct _cairo_5c_t {
     DataType	    *data;
@@ -74,17 +78,33 @@
     DataType	    *data;
     cairo_5c_kind_t kind;
     cairo_surface_t *surface;
-    int		    width;
-    int		    height;
+    double    	    width;
+    double    	    height;
     Bool	    dirty;
     Value	    recv_events;
     Bool	    copied;
     union {
 	cairo_5c_window_t   window;
-	cairo_5c_ps_t	    ps;
+	cairo_5c_pdf_t	    pdf;
+	cairo_5c_image_t    image;
     } u;
 } cairo_5c_surface_t;
 
+typedef struct _cairo_5c_pattern_t {
+    DataType	    *data;
+    cairo_pattern_t *pattern;
+} cairo_5c_pattern_t;
+
+typedef struct _cairo_5c_scaled_font_t {
+    DataType		*data;
+    cairo_scaled_font_t	*scaled_font;
+} cairo_5c_scaled_font_t;
+
+typedef struct _cairo_5c_font_face_t {
+    DataType		*data;
+    cairo_font_face_t	*font_face;
+} cairo_5c_font_face_t;
+
 extern Type		*typeCairo;
 extern Type		*typeCairoSurface;
 extern Type		*typeCairoStatus;
@@ -103,11 +123,10 @@
 extern Type		*typeCairoRgbaColor;
 extern Type		*typeCairoPattern;
 extern Type		*typeCairoPath;
-extern Type		*typeCairoMoveTo;
-extern Type		*typeCairoLineTo;
 extern Type		*typeCairoCurveTo;
-extern Type		*typeCairoClosePath;
 extern Type		*typeCairoFilter;
+extern Type		*typeCairoScaledFont;
+extern Type		*typeCairoFontFace;
 
 extern Type		*typeCairoPatternExtend;
 extern Type		*typeCairoPatternFilter;
@@ -121,19 +140,15 @@
 cairo_5c_dirty (cairo_5c_t *c5c);
 
 Value
-do_Cairo_create (void);
+do_Cairo_create (Value sv);
 
 Value
 do_Cairo_destroy (Value cv);
 
 Value
-do_Cairo_set_target_surface (Value cv, Value sv);
-    
-Value
-do_Cairo_get_target_surface (Value cv);
-    
-Value
-do_Cairo_copy (Value dstv, Value srcv);
+do_Cairo_get_target (Value cv);
+
+/* Error status queries */
 
 Value
 do_Cairo_status (Value cv);
@@ -156,21 +171,45 @@
 do_Cairo_Surface_create_window (Value namev, Value wv, Value hv);
 
 Value
-do_Cairo_Surface_create_image (Value wv, Value hv);
+do_Cairo_Image_surface_create (Value fv, Value wv, Value hv);
 
 Value
-do_Cairo_Surface_write_to_png (Value sv, Value fv);
+do_Cairo_Image_surface_create_from_png (Value fnv);
 
 Value
-do_Cairo_Surface_create_ps (Value fv, Value wv, Value hv, Value xppiv, Value yppiv);
+do_Cairo_Image_surface_create_from_png_file (Value fv);
+
+Value
+do_Cairo_Pdf_surface_create (Value fnv, Value wv, Value hv);
+
+Value
+do_Cairo_Pdf_surface_create_for_file (Value fv, Value wv, Value hv);
+
+Value
+do_Cairo_Surface_write_to_png (Value sv, Value fnv);
+
+Value
+do_Cairo_Surface_write_to_png_file (Value sv, Value fv);
 
 Value
 do_Cairo_Surface_create_similar (Value sv, Value wv, Value hv);
 
 Value
+do_Cairo_Surface_finish (Value sv);
+
+Value
 do_Cairo_Surface_destroy (Value sv);
 
 Value
+do_Cairo_Surface_write_to_png (Value sv, Value fnv);
+
+Value
+do_Cairo_Surface_write_to_png_file (Value sv, Value fv);
+
+Value
+do_Cairo_Surface_set_device_offset (Value sv, Value xv, Value yv);
+
+Value
 do_Cairo_Surface_width (Value sv);
 
 Value
@@ -202,9 +241,6 @@
 do_Cairo_set_operator (Value cv, Value ov);
 
 Value
-do_Cairo_default_matrix (Value cv);
-
-Value
 do_Cairo_identity_matrix (Value cv);
 
 Value
@@ -214,6 +250,9 @@
 do_Cairo_set_source_rgba (Value cv, Value rv, Value gv, Value bv, Value av);
 
 Value
+do_Cairo_set_source_surface (Value cv, Value sv, Value xv, Value yv);
+
+Value
 do_Cairo_set_tolerance (Value cv, Value tv);
 
 Value
@@ -244,31 +283,27 @@
 do_Cairo_rotate (Value cv, Value av);
 
 Value
-do_Cairo_get_matrix (Value cv);
-
-Value
-do_Cairo_concat_matrix (Value cv, Value mv);
+do_Cairo_transform (Value cv, Value mv);
 
 Value
 do_Cairo_set_matrix (Value cv, Value mv);
 
 Value
-do_Cairo_transform_point (Value cv, Value pv);
+do_Cairo_identity_matrix (Value cv);
 
 Value
-do_Cairo_transform_distance (Value cv, Value pv);
+do_Cairo_user_to_device (Value cv, Value pv);
 
 Value
-do_Cairo_inverse_transform_point (Value cv, Value pv);
+do_Cairo_user_to_device_distance (Value cv, Value pv);
 
 Value
-do_Cairo_inverse_transform_distance (Value cv, Value pv);
+do_Cairo_device_to_user (Value cv, Value pv);
 
 Value
-do_Cairo_init_clip (Value cv);
+do_Cairo_device_to_user_distance (Value cv, Value pv);
 
-Value
-do_Cairo_clip (Value cv);
+/* Query functions */
 
 Value
 do_Cairo_get_operator (Value cv);
@@ -294,6 +329,9 @@
 Value
 do_Cairo_get_miter_limit (Value cv);
 
+Value
+do_Cairo_get_matrix (Value cv);
+
 /* draw.c */
 Value
 do_Cairo_new_path (Value cv);
@@ -340,35 +378,69 @@
 Value
 do_Cairo_close_path (Value cv);
 
+/* Painting functions */
 Value
-do_Cairo_fill (Value cv);
+do_Cairo_paint (Value cv);
+
+Value
+do_Cairo_paint_with_alpha (Value cv, Value av);
+
+Value
+do_Cairo_mask (Value cv, Value pv);
+
+Value
+do_Cairo_mask_surface (Value cv, Value sv, Value xv, Value yv);
 
 Value
 do_Cairo_stroke (Value cv);
 
 Value
+do_Cairo_stroke_preserve (Value cv);
+
+Value
+do_Cairo_fill (Value cv);
+
+Value
+do_Cairo_fill_preserve (Value cv);
+
+Value
 do_Cairo_copy_page (Value cv);
 
 Value
 do_Cairo_show_page (Value cv);
 
+/* Insideness testing */
 Value
 do_Cairo_in_stroke (Value cv, Value xv, Value yv);
 
 Value
 do_Cairo_in_fill (Value cv, Value xv, Value yv);
 
+/* Rectangular extents */
 Value
 do_Cairo_stroke_extents (Value cv);
 
 Value
 do_Cairo_fill_extents (Value cv);
 
+/* Clipping */
 Value
-do_Cairo_current_path_list (Value cv);
+do_Cairo_reset_clip (Value cv);
 
 Value
-do_Cairo_current_path_flat_list (Value cv);
+do_Cairo_clip (Value cv);
+
+Value
+do_Cairo_clip_preserve (Value cv);
+
+Value
+do_Cairo_copy_path (Value cv);
+
+Value
+do_Cairo_copy_path_flat (Value cv);
+
+Value
+do_Cairo_append_path (Value cv, Value pv);
 
 /* matrix.c */
 void
@@ -388,7 +460,7 @@
 do_Cairo_set_source (Value cv, Value patv);
 
 Value
-do_Cairo_Pattern_create_png (Value filenamev);
+do_Cairo_Pattern_create_for_surface (Value sv);
 
 Value
 do_Cairo_Pattern_create_linear (Value x0v, Value y0v, Value x1v, Value y1v);
@@ -398,12 +470,13 @@
 				Value cx1v, Value cy1v, Value radius1v);
 
 Value
-do_Cairo_Pattern_create_for_surface (Value cv);
+do_Cairo_Pattern_add_color_stop_rgb (Value patv, Value offsetv,
+				     Value redv, Value greenv, Value bluev);
 
 Value
-do_Cairo_Pattern_add_color_stop (Value patv, Value offsetv,
-				 Value redv, Value greenv, Value bluev,
-				 Value alphav);
+do_Cairo_Pattern_add_color_stop_rgba (Value patv, Value offsetv,
+				      Value redv, Value greenv, Value bluev,
+				      Value alphav);
 
 Value
 do_Cairo_Pattern_set_matrix (Value patv, Value matrixv);
@@ -425,10 +498,10 @@
 
 /* text.c */
 Value
-do_Cairo_select_font (Value cv, Value fv, Value sv, Value wv);
+do_Cairo_select_font_face (Value cv, Value fv, Value sv, Value wv);
 
 Value
-do_Cairo_set_font (Value cv, Value fv);
+do_Cairo_set_font (Value cv, Value fnv);
 
 Value
 do_Cairo_set_font_size (Value cv, Value sv);
@@ -437,17 +510,38 @@
 do_Cairo_set_font_matrix (Value cv, Value mv);
 
 Value
-do_Cairo_font_extents (Value cv);
+do_Cairo_get_font_matrix (Value cv);
 
 Value
 do_Cairo_show_text (Value cv, Value uv);
 
 Value
-do_Cairo_text_path (Value cv, Value uv);
+do_Cairo_font_extents (Value cv);
+
+Value
+do_Cairo_set_font_face (Value cv, Value fv);
 
 Value
 do_Cairo_text_extents (Value cv, Value uv);
 
+Value
+do_Cairo_text_path (Value cv, Value uv);
+
+/* Portable interface to general font features. */
+
+#if 0
+
+/* not actually useful until we expose freetype/fontconfig to nickle apps */
+Value
+do_Cairo_scaled_font_create (Value fv, Value mv, Value ctm);
+
+Value
+do_Cairo_scaled_font_extents (Value sfv);
+
+Value
+do_Cairo_scaled_text_extents (Value sfv, Value uv);
+
+#endif
 
 /* gtk.c */
 

Index: cairo.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/cairo.5c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cairo.5c	2 May 2005 20:24:38 -0000	1.10
+++ cairo.5c	18 May 2005 06:21:15 -0000	1.11
@@ -47,59 +47,22 @@
     } hsv_color_t;
     
     public int width (cairo_t cr) = 
-	Surface::width (get_target_surface (cr));
+	Surface::width (get_target (cr));
     
     public int height (cairo_t cr) = 
-	Surface::height (get_target_surface (cr));
+	Surface::height (get_target (cr));
     
     public file open_event (cairo_t cr) =
-	Surface::open_event (get_target_surface (cr));
+	Surface::open_event (get_target (cr));
 
     public cairo_t new (int args...) {
-	int w = dim(args) > 0 ? args[0] : 0;
-	int h = dim(args) > 1 ? args[1] : 0;
-
-	typedef union {
-	    void	none;
-	    surface_t	surface;
-	} surface_or_none_t;
-	
-	static surface_or_none_t    surface = surface_or_none_t.none;
-	static mutex		    m = Mutex::new();
-
-	cairo_t	cr = create ();
+	int	w = dim(args) > 0 ? args[0] : 0;
+	int	h = dim(args) > 1 ? args[1] : 0;
+	string	name = (dim (argv) > 0) ? argv[0] : "nickle";
+	cairo_t	cr = create (Surface::create_window (name, w, h));
 	
-	/*
-	 * A local function to make sure the 'default' surface
-	 * exists
-	 */
-	void ensure_surface () 
-	{
-	    twixt (Mutex::acquire (m); Mutex::release (m))
-	    {
-		union switch (surface) {
-		case none:
-		    string name = (dim (argv) > 0) ? argv[0] : "nickle";
-		    surface.surface = Surface::create_window (name, w, h);
-		    set_target_surface (cr, surface.surface);
-		    set_source_rgba (cr, 1, 1, 1, 1);
-		    rectangle (cr, 0, 0, Cairo::width (cr), Cairo::height (cr));
-		    fill (cr);
-		    break;
-		case surface:
-		    set_target_surface (cr, surface.surface);
-		    break;
-		}
-	    }
-	}
-
-	try 
-	{
-	    ensure_surface ();
-	} catch invalid_argument (string reason, int i, poly arg) {
-	    surface = surface_or_none_t.none;
-	    ensure_surface ();
-	}
+        set_source_rgba (cr, 1, 1, 1, 1);
+	paint (cr);
 	set_source_rgba (cr, 0, 0, 0, 1);
 	return cr;
     }
@@ -108,25 +71,22 @@
 	int	    w = dim(args) > 0 ? args[0] : 0;
 	int	    h = dim(args) > 1 ? args[1] : 0;
 	surface_t   surface = Surface::create_window (name, w, h);
-	cairo_t	    cr = create ();
+	cairo_t	    cr = create (surface);
 	
-	set_target_surface (cr, surface);
 	set_source_rgba (cr, 1, 1, 1, 1);
-	rectangle (cr, 0, 0, Cairo::width (cr), Cairo::height (cr));
-	fill (cr);
+	paint (cr);
 	set_source_rgba (cr, 0, 0, 0, 1);
 	return cr;
     }
 
     public cairo_t new_image (int width, int height)
     {
-	surface_t   surface = Surface::create_image (width, height);
-	cairo_t	    cr = create ();
-	set_target_surface (cr, surface);
+	surface_t   surface = Image::surface_create (0, width, height);
+	cairo_t	    cr = create (surface);
+	
 	set_source_rgba (cr, 0, 0, 0, 0);
 	set_operator (cr, operator_t.SRC);
-	rectangle (cr, 0, 0, Cairo::width (cr), Cairo::height (cr));
-	fill (cr);
+	paint (cr);
 	set_operator (cr, operator_t.OVER);
 	set_source_rgba (cr, 0, 0, 0, 1);
 	return cr;
@@ -134,95 +94,25 @@
     
     public void write_to_png (cairo_t cr, string filename)
     {
-	surface_t   surface = get_target_surface (cr);
+	surface_t   surface = get_target (cr);
 	Surface::write_to_png (surface, filename);
     }
     
-    public cairo_t new_ps (string filename, 
-			   real width, real height,
-			   real xppi, real yppi)
+    public cairo_t new_pdf (string filename, 
+			   real width, real height)
     {
-	surface_t   surface = Surface::create_ps (filename, width, height,
-						  xppi, yppi);
-	cairo_t	    cr = create ();
-	set_target_surface (cr, surface);
+	surface_t   surface = Pdf::surface_create (filename, width, height);
+	cairo_t	    cr = create (surface);
+	
 	set_source_rgba (cr, 1, 1, 1, 1);
-	rectangle (cr, 0, 0, Cairo::width (cr), Cairo::height (cr));
-	fill (cr);
+	paint (cr);
 	set_source_rgba (cr, 0, 0, 0, 1);
 	return cr;
     }
     
     public cairo_t dup (cairo_t cr)
     {
-	cairo_t	n = create ();
-
-	set_target_surface (n, get_target_surface (cr));
-	copy (n, cr);
-	return n;
-    }
-    
-    void walk_path (path_t  path,
-		    move_to_func_t move_to,
-		    line_to_func_t line_to,
-		    curve_to_func_t curve_to,
-		    close_path_func_t close_path)
-    {
-	while (path != path_t.end)
-	{
-	    union switch (path) {
-	    case move_to m:
-		move_to (m->x, m->y);
-		path = m->next;
-		break;
-	    case line_to l:
-		line_to (l->x, l->y);
-		path = l->next;
-		break;
-	    case curve_to c:
-		curve_to (c->x1, c->y1, c->x2, c->y2, c->x3, c->y3);
-		path = c->next;
-		break;
-	    case close_path c:
-		close_path ();
-		path = c->next;
-		break;
-	    case end:
-		break;
-	    }
-	}
-    }
-
-    public void current_path (cairo_t cr,
-			      move_to_func_t move_to,
-			      line_to_func_t line_to,
-			      curve_to_func_t curve_to,
-			      close_path_func_t close_path)
-	/*
-	 * Walk path calling provided functions for matching 
-	 * elements sequentially
-	 */
-    {
-	walk_path (current_path_list (cr),
-		   move_to, line_to, curve_to, close_path);
-    }
-    
-    public void current_path_flat (cairo_t cr,
-				   move_to_func_t move_to,
-				   line_to_func_t line_to,
-				   close_path_func_t close_path)
-	/*
-	 * Walk path calling provided functions for matching 
-	 * elements sequentially.  Curves are replaced by
-	 * lines as needed to meet current_tolerance
-	 */
-    {
-	void no_curve_to (real x1, real y1, real x2, real y2, real x2, real y3)
-	{
-	    abort ("flat paths have no curves", cr);
-	}
-	walk_path (current_path_flat_list (cr),
-		   move_to, line_to, no_curve_to, close_path);
+	return cr;
     }
 
     real[3] to_hsv(real r, real g, real b)

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/cairo.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo.c	2 May 2005 20:24:38 -0000	1.4
+++ cairo.c	18 May 2005 06:21:15 -0000	1.5
@@ -63,8 +63,10 @@
 	c5s = cairo_5c_surface_get (c5c->surface);
 	if (!c5s)
 	    return 0;
+#if 0
 	if (c5s->surface != cairo_current_target_surface (c5c->cr))
 	    cairo_set_target_surface (c5c->cr, c5s->surface);
+#endif
     }
     return c5c;
 }
@@ -119,14 +121,18 @@
 }
 
 Value
-do_Cairo_create (void)
+do_Cairo_create (Value sv)
 {
     ENTER ();
-    Value	ret;
-    cairo_5c_t	*c5c;
-    cairo_t	*cr;
+    cairo_5c_surface_t	*c5s;
+    Value		ret;
+    cairo_5c_t		*c5c;
+    cairo_t		*cr;
 
-    cr = cairo_create ();
+    c5s = cairo_5c_surface_get (sv);
+    if (aborting)
+	RETURN (Void);
+    cr = cairo_create (c5s->surface);
     if (!cr)
     {
 	RaiseStandardException (exception_invalid_argument,
@@ -136,7 +142,7 @@
     }
     c5c = ALLOCATE (&Cairo5cType, sizeof (cairo_5c_t));
     c5c->cr = cr;
-    c5c->surface = Void;
+    c5c->surface = sv;
     ret = NewForeign (CairoId, c5c, 
 		      cairo_foreign_mark, cairo_foreign_free);
     RETURN (ret);
@@ -156,7 +162,7 @@
 		cairo_5c_tool_dirty (c5s);
 		break;
 	    case CAIRO_5C_IMAGE:
-	    case CAIRO_5C_PS:
+	    case CAIRO_5C_PDF:
 	    case CAIRO_5C_SCRATCH:
 		break;
 	    }
@@ -178,7 +184,7 @@
 		cairo_5c_tool_enable (c5s);
 		break;
 	    case CAIRO_5C_IMAGE:
-	    case CAIRO_5C_PS:
+	    case CAIRO_5C_PDF:
 	    case CAIRO_5C_SCRATCH:
 		break;
 	    }
@@ -201,7 +207,7 @@
 		cairo_5c_tool_disable (c5s);
 		break;
 	    case CAIRO_5C_IMAGE:
-	    case CAIRO_5C_PS:
+	    case CAIRO_5C_PDF:
 	    case CAIRO_5C_SCRATCH:
 		break;
 	    }
@@ -211,34 +217,13 @@
 }
 
 Value
-do_Cairo_set_target_surface (Value cv, Value sv)
-{
-    ENTER ();
-    cairo_5c_t		*c5c = cairo_5c_get (cv);
-    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
-
-    if (aborting)
-	RETURN (Void);
-    cairo_set_target_surface (c5c->cr, c5s->surface);
-    c5c->surface = sv;
-    RETURN (Void);
-}
-
-Value
-do_Cairo_get_target_surface (Value cv)
+do_Cairo_get_target (Value cv)
 {
     ENTER ();
     cairo_5c_t		*c5c = cairo_5c_get (cv);
 
     if (aborting)
 	RETURN (Void);
-    if (c5c->surface == Void)
-    {
-	RaiseStandardException (exception_invalid_argument,
-				"No current surface",
-				2, NewInt (0), cv);
-	RETURN (Void);
-    }
     RETURN (c5c->surface);
 }
 
@@ -258,21 +243,6 @@
 }
 
 Value
-do_Cairo_copy (Value dstv, Value srcv)
-{
-    ENTER ();
-    cairo_5c_t	*dst = cairo_5c_get (dstv);
-    cairo_5c_t	*src = cairo_5c_get (srcv);
-    
-    if (aborting)
-	RETURN (Void);
-    
-    cairo_copy (dst->cr, src->cr);
-
-    RETURN (Void);
-}
-
-Value
 do_Cairo_status (Value cv)
 {
     ENTER ();

Index: draw.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/draw.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- draw.c	11 Feb 2005 21:15:46 -0000	1.6
+++ draw.c	18 May 2005 06:21:15 -0000	1.7
@@ -189,6 +189,63 @@
 }
 
 Value
+do_Cairo_paint (Value cv)
+{
+    cairo_5c_t	*c5c = cairo_5c_get (cv);
+
+    if (!aborting)
+    {
+	cairo_paint (c5c->cr);
+	cairo_5c_dirty (c5c);
+    }
+    return Void;
+}
+
+Value
+do_Cairo_paint_with_alpha (Value cv, Value av)
+{
+    cairo_5c_t	*c5c = cairo_5c_get (cv);
+    double	alpha = DoublePart (av, "invalid alpha value");
+
+    if (!aborting)
+    {
+	cairo_paint_with_alpha (c5c->cr, alpha);
+	cairo_5c_dirty (c5c);
+    }
+    return Void;
+}
+
+Value
+do_Cairo_mask (Value cv, Value pv)
+{
+    cairo_5c_t		*c5c = cairo_5c_get (cv);
+    cairo_pattern_t	*pat = get_cairo_pattern (pv);
+
+    if (!aborting)
+    {
+	cairo_mask (c5c->cr, pat);
+	cairo_5c_dirty (c5c);
+    }
+    return Void;
+}
+
+Value
+do_Cairo_mask_surface (Value cv, Value sv, Value xv, Value yv)
+{
+    cairo_5c_t		*c5c = cairo_5c_get (cv);
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+    double		x = DoublePart (xv, "invalid X value");
+    double		y = DoublePart (yv, "invalid Y value");
+
+    if (!aborting)
+    {
+	cairo_mask_surface (c5c->cr, c5s->surface, x, y);
+	cairo_5c_dirty (c5c);
+    }
+    return Void;
+}
+
+Value
 do_Cairo_fill (Value cv)
 {
     cairo_5c_t	*c5c = cairo_5c_get (cv);
@@ -202,6 +259,19 @@
 }
 
 Value
+do_Cairo_fill_preserve (Value cv)
+{
+    cairo_5c_t	*c5c = cairo_5c_get (cv);
+
+    if (!aborting)
+    {
+	cairo_fill_preserve (c5c->cr);
+	cairo_5c_dirty (c5c);
+    }
+    return Void;
+}
+
+Value
 do_Cairo_stroke (Value cv)
 {
     cairo_5c_t	*c5c = cairo_5c_get (cv);
@@ -214,6 +284,18 @@
 }
 
 Value
+do_Cairo_stroke_preserve (Value cv)
+{
+    cairo_5c_t	*c5c = cairo_5c_get (cv);
+
+    if (!aborting) {
+	cairo_stroke_preserve (c5c->cr);
+	cairo_5c_dirty (c5c);
+    }
+    return Void;
+}
+
+Value
 do_Cairo_copy_page (Value cv)
 {
     cairo_5c_t	*c5c = cairo_5c_get (cv);
@@ -315,11 +397,6 @@
     RETURN (ret);
 }
 
-typedef struct _path_closure {
-    Value   head;
-    Value   *tail;
-} path_closure_t;
-
 static Value
 path_new (char *tag, Value value)
 {
@@ -332,107 +409,99 @@
 }
 
 static Value
-path_box (void *closure, Type *type, char *tag)
-{
-    ENTER ();
-    path_closure_t  *pc = closure;
-    Value	    elt = NewStruct (TypeCanon (type)->structs.structs, False);
-    Value	    elt_ref = NewRef (NewBox (False, False, 1, type), 0);
-    Value	    path = path_new (tag, elt_ref);
-    BoxPtr	    box = elt->structs.values;
-
-    RefValueSet (elt_ref, elt);
-    /* move End element after this element */
-    BoxValueSet (box, 0, *pc->tail);
-    /* append element to list */
-    *pc->tail = path;
-    pc->tail = &BoxElements(box)[0];
-    RETURN (elt);
-}
-
-static void
-cairo_5c_move_to (void *closure, double x, double y)
-{
-    ENTER ();
-    Value   elt = path_box (closure, typeCairoMoveTo, "move_to");
-    BoxPtr  box = elt->structs.values;
-    BoxValueSet (box, 1, NewDoubleFloat (x));
-    BoxValueSet (box, 2, NewDoubleFloat (y));
-    EXIT ();
-}
-
-static void
-cairo_5c_line_to (void *closure, double x, double y)
+path_elt_new (Type *type)
 {
-    ENTER ();
-    Value   elt = path_box (closure, typeCairoLineTo, "line_to");
-    BoxPtr  box = elt->structs.values;
-    BoxValueSet (box, 1, NewDoubleFloat (x));
-    BoxValueSet (box, 2, NewDoubleFloat (y));
-    EXIT ();
+    return NewStruct (TypeCanon (type)->structs.structs, False);
 }
 
-static void
-cairo_5c_curve_to (void *closure,
-		   double x1, double y1,
-		   double x2, double y2,
-		   double x3, double y3)
+static Value
+path_array (Value cv, cairo_path_t* (*copy_path) (cairo_t *cr))
 {
     ENTER ();
-    Value   elt = path_box (closure, typeCairoCurveTo, "curve_to");
-    BoxPtr  box = elt->structs.values;
-    BoxValueSet (box, 1, NewDoubleFloat (x1));
-    BoxValueSet (box, 2, NewDoubleFloat (y1));
-    BoxValueSet (box, 3, NewDoubleFloat (x2));
-    BoxValueSet (box, 4, NewDoubleFloat (y2));
-    BoxValueSet (box, 5, NewDoubleFloat (x3));
-    BoxValueSet (box, 6, NewDoubleFloat (y3));
-    EXIT ();
+    cairo_5c_t		*c5c = cairo_5c_get (cv);
+    cairo_path_t	*path;
+    Value		pv;
+    Value		pev;
+    Value		e;
+    BoxPtr		box;
+    int			zero = 0;
+    int			n = 0;
+    int			i, j;
+    cairo_path_data_t	*data;
+    char		*tag;
+    
+    if (aborting)
+	RETURN (Void);
+    
+    path = (*copy_path) (c5c->cr);
+    if (!path)
+    {
+	RaiseStandardException (exception_invalid_argument,
+				"Can't copy path",
+				2, cv,
+				IntToEnum (typeCairoStatus, 
+					   cairo_status (c5c->cr)));
+	RETURN (Void);
+    }
+    pv = NewArray (False, True, typeCairoPath, 1, &zero);
+    for (i=0; i < path->num_data; i += path->data[i].header.length) 
+    {
+	data = &path->data[i];
+	switch (data->header.type) {
+	case CAIRO_PATH_MOVE_TO:
+	case CAIRO_PATH_LINE_TO:
+	    tag = data->header.type == CAIRO_PATH_MOVE_TO ? "move_to" : "line_to";
+	    e = path_elt_new (typeCairoPoint);
+	    box = e->structs.values;
+	    BoxValueSet (box, 0, NewDoubleFloat (data[1].point.x));
+	    BoxValueSet (box, 1, NewDoubleFloat (data[1].point.y));
+	    break;
+	case CAIRO_PATH_CURVE_TO:
+	    tag = "curve_to";
+	    e = path_elt_new (typeCairoCurveTo);
+	    box = e->structs.values;
+	    for (j = 0; j < 3; j++)
+	    {
+		BoxValueSet (box, j*2+0, NewDoubleFloat (data[j+1].point.x));
+		BoxValueSet (box, j*2+1, NewDoubleFloat (data[j+1].point.y));
+	    }
+	    break;
+	case CAIRO_PATH_CLOSE_PATH:
+	    tag = "close_path";
+	    e = Void;
+	    break;
+	default:
+	    tag = "unknown";
+	    e = Void;
+	    break;
+	}
+	pev = path_new (tag, e);
+	ArrayResize (pev, 0, n+1);
+	ArrayValueSet (&pv->array, n, pev);
+	n++;
+    }
+    
+    RETURN(pv);
 }
 
-static void
-cairo_5c_close_path (void *closure)
+Value
+do_Cairo_copy_path (Value cv)
 {
     ENTER ();
-    (void) path_box (closure, typeCairoClosePath, "close_path");
-    EXIT ();
+    RETURN (path_array (cv, cairo_copy_path));
 }
 
 Value
-do_Cairo_current_path_list (Value cv)
+do_Cairo_copy_path_flat (Value cv)
 {
     ENTER ();
-    path_closure_t  close;
-    cairo_5c_t	    *c5c = cairo_5c_get (cv);
-    
-    if (aborting)
-	RETURN (Void);
-    close.head = path_new ("end", Void);
-    close.tail = &close.head;
-    cairo_current_path (c5c->cr,
-			cairo_5c_move_to,
-			cairo_5c_line_to,
-			cairo_5c_curve_to,
-			cairo_5c_close_path,
-			&close);
-    RETURN(close.head);
+    RETURN (path_array (cv, cairo_copy_path_flat));
 }
 
 Value
-do_Cairo_current_path_flat_list (Value cv)
+do_Cairo_append_path (Value cv, Value pv)
 {
     ENTER ();
-    path_closure_t  close;
-    cairo_5c_t	    *c5c = cairo_5c_get (cv);
-    
-    if (aborting)
-	RETURN (Void);
-    close.head = path_new ("end", Void);
-    close.tail = &close.head;
-    cairo_current_path_flat (c5c->cr,
-			     cairo_5c_move_to,
-			     cairo_5c_line_to,
-			     cairo_5c_close_path,
-			     &close);
-    RETURN(close.head);
+    /* XXX */
+    RETURN (Void);
 }

Index: event.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/event.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- event.c	2 May 2005 20:24:38 -0000	1.4
+++ event.c	18 May 2005 06:21:15 -0000	1.5
@@ -68,7 +68,7 @@
 	    c5s->u.window.send_events = write;
 	    break;
 	case CAIRO_5C_IMAGE:
-	case CAIRO_5C_PS:
+	case CAIRO_5C_PDF:
 	case CAIRO_5C_SCRATCH:
 	    read = FileFopen ("/dev/null", "r", &err);
 	    if (!c5s->recv_events)

Index: gstate.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/gstate.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gstate.c	2 May 2005 20:24:38 -0000	1.8
+++ gstate.c	18 May 2005 06:21:15 -0000	1.9
@@ -92,6 +92,20 @@
 }
 
 Value
+do_Cairo_set_source_surface (Value cv, Value sv, Value xv, Value yv)
+{
+    ENTER ();
+    cairo_5c_t		*c5c = cairo_5c_get (cv);
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+    double		x = DoublePart (xv, "invalid X value");
+    double		y = DoublePart (yv, "invalid Y value");
+
+    if (!aborting)
+	cairo_set_source_surface (c5c->cr, c5s->surface, x, y);
+    RETURN (Void);
+}
+
+Value
 do_Cairo_set_tolerance (Value cv, Value tv)
 {
     cairo_5c_t	*c5c = cairo_5c_get (cv);
@@ -187,17 +201,6 @@
 	cairo_identity_matrix (c5c->cr);
     return Void;
 }
-
-Value
-do_Cairo_default_matrix (Value cv)
-{
-    cairo_5c_t	    *c5c = cairo_5c_get (cv);
-
-    if (aborting)
-	return Void;
-    cairo_default_matrix (c5c->cr);
-    return Void;
-}
     
 Value
 do_Cairo_translate (Value cv, Value xv, Value yv)
@@ -251,7 +254,7 @@
 }
 
 Value
-do_Cairo_concat_matrix (Value cv, Value mv)
+do_Cairo_transform (Value cv, Value mv)
 {
     ENTER ();
     cairo_5c_t	    *c5c = cairo_5c_get (cv);
@@ -262,7 +265,7 @@
     cairo_matrix_part (mv, &matrix, "invalid matrix");
     if (aborting)
 	RETURN(Void);
-    cairo_concat_matrix (c5c->cr, &matrix);
+    cairo_transform (c5c->cr, &matrix);
     RETURN (Void);
 }
 
@@ -283,7 +286,7 @@
 }
 
 Value
-do_Cairo_transform_point (Value cv, Value pv)
+do_Cairo_user_to_device (Value cv, Value pv)
 {
     ENTER ();
     cairo_5c_t	    *c5c = cairo_5c_get (cv);
@@ -296,7 +299,7 @@
     
     x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate");
     y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate");
-    cairo_transform_point (c5c->cr, &x, &y);
+    cairo_user_to_device (c5c->cr, &x, &y);
     ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False);
     box = ret->structs.values;
     BoxValueSet (box, 0, NewDoubleFloat (x));
@@ -305,7 +308,7 @@
 }
 
 Value
-do_Cairo_transform_distance (Value cv, Value pv)
+do_Cairo_user_to_device_distance (Value cv, Value pv)
 {
     ENTER ();
     cairo_5c_t	    *c5c = cairo_5c_get (cv);
@@ -318,7 +321,7 @@
     
     x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate");
     y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate");
-    cairo_transform_distance (c5c->cr, &x, &y);
+    cairo_user_to_device_distance (c5c->cr, &x, &y);
     ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False);
     box = ret->structs.values;
     BoxValueSet (box, 0, NewDoubleFloat (x));
@@ -327,7 +330,7 @@
 }
 
 Value
-do_Cairo_inverse_transform_point (Value cv, Value pv)
+do_Cairo_device_to_user (Value cv, Value pv)
 {
     ENTER ();
     cairo_5c_t	    *c5c = cairo_5c_get (cv);
@@ -340,7 +343,7 @@
     
     x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate");
     y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate");
-    cairo_inverse_transform_point (c5c->cr, &x, &y);
+    cairo_device_to_user (c5c->cr, &x, &y);
     ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False);
     box = ret->structs.values;
     BoxValueSet (box, 0, NewDoubleFloat (x));
@@ -349,7 +352,7 @@
 }
 
 Value
-do_Cairo_inverse_transform_distance (Value cv, Value pv)
+do_Cairo_device_to_user_distance (Value cv, Value pv)
 {
     ENTER ();
     cairo_5c_t	    *c5c = cairo_5c_get (cv);
@@ -362,7 +365,7 @@
     
     x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate");
     y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate");
-    cairo_inverse_transform_distance (c5c->cr, &x, &y);
+    cairo_device_to_user_distance (c5c->cr, &x, &y);
     ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False);
     box = ret->structs.values;
     BoxValueSet (box, 0, NewDoubleFloat (x));
@@ -371,11 +374,11 @@
 }
 
 Value
-do_Cairo_init_clip (Value cv)
+do_Cairo_reset_clip (Value cv)
 {
     cairo_5c_t	    *c5c = cairo_5c_get (cv);
     if (!aborting)
-	cairo_init_clip (c5c->cr);
+	cairo_reset_clip (c5c->cr);
     return Void;
 }
 
@@ -389,6 +392,15 @@
 }
 
 Value
+do_Cairo_clip_preserve (Value cv)
+{
+    cairo_5c_t	    *c5c = cairo_5c_get (cv);
+    if (!aborting)
+	cairo_clip_preserve (c5c->cr);
+    return Void;
+}
+
+Value
 do_Cairo_get_operator (Value cv)
 {
     cairo_5c_t	    *c5c = cairo_5c_get (cv);

Index: gtk.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/gtk.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gtk.c	2 May 2005 20:24:38 -0000	1.8
+++ gtk.c	18 May 2005 06:21:15 -0000	1.9
@@ -301,7 +301,7 @@
     if (!been_here)
     {
 	/* trust to gdk to lock the display; Xlib is horribly broken */
-/*	XInitThreads (); */
+	XInitThreads ();
 	g_thread_init (NULL);
 	gdk_threads_init ();
 	been_here = 1;

Index: init.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/init.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- init.c	2 May 2005 20:24:38 -0000	1.13
+++ init.c	18 May 2005 06:21:15 -0000	1.14
@@ -38,6 +38,8 @@
 NamespacePtr	CairoNamespace;
 NamespacePtr	CairoSurfaceNamespace;
 NamespacePtr	CairoPatternNamespace;
+NamespacePtr	CairoImageNamespace;
+NamespacePtr	CairoPdfNamespace;
 Type		*typeCairo;
 Type		*typeCairoSurface;
 Type		*typeCairoStatus;
@@ -56,10 +58,9 @@
 Type		*typeCairoRgbaColor;
 Type		*typeCairoPattern;
 Type		*typeCairoPath;
-Type		*typeCairoMoveTo;
-Type		*typeCairoLineTo;
 Type		*typeCairoCurveTo;
-Type		*typeCairoClosePath;
+Type		*typeCairoScaledFont;
+Type		*typeCairoFontFace;
 
 Type		*typeCairoPatternExtend;
 Type		*typeCairoPatternFilter;
@@ -100,14 +101,12 @@
 #define PATTERN_S	"16"
 #define PATH_I		17
 #define PATH_S		"17"
-#define MOVE_TO_I	18
-#define MOVE_TO_S	"18"
-#define LINE_TO_I	19
-#define LINE_TO_S	"19"
 #define CURVE_TO_I	20
 #define CURVE_TO_S	"20"
-#define CLOSE_PATH_I	21
-#define CLOSE_PATH_S	"21"
+#define SCALED_FONT_I	22
+#define SCALED_FONT_S	"22"
+#define FONT_FACE_I	23
+#define FONT_FACE_S	"23"
 
 #define EXTEND_I	30
 #define EXTEND_S	"30"
@@ -140,7 +139,7 @@
 static void
 init_types (void)
 {
-    Symbol  *mt, *lt, *ct, *cp, *path;
+    Symbol  *ct, *path;
     ENTER ();
 
     CairoNamespace = BuiltinNamespace (/* parent */ 0, "Cairo")->namespace.namespace;
@@ -326,23 +325,9 @@
 				     typePrim[rep_foreign]);
 
     /*
-     * Recursive datatypes aren't supported by the simple API
+     * Path data structures
      */
-
-    typeCairoMoveTo = make_typedef ("move_to_t",
-				    CairoNamespace,
-				    publish_public,
-				    MOVE_TO_I,
-				    &mt,
-				    0);
-
-    typeCairoLineTo = make_typedef ("line_to_t",
-				    CairoNamespace,
-				    publish_public,
-				    LINE_TO_I,
-				    &lt,
-				    0);
-
+    
     typeCairoCurveTo = make_typedef ("curve_to_t",
 				     CairoNamespace,
 				     publish_public,
@@ -350,12 +335,13 @@
 				     &ct,
 				     0);
 
-    typeCairoClosePath = make_typedef ("close_path_t",
-				       CairoNamespace,
-				       publish_public,
-				       CLOSE_PATH_I,
-				       &cp,
-				       0);
+    ct->symbol.type = BuildStructType (6,
+				       typePrim[rep_float], "x1",
+				       typePrim[rep_float], "y1",
+				       typePrim[rep_float], "x2",
+				       typePrim[rep_float], "y2",
+				       typePrim[rep_float], "x3",
+				       typePrim[rep_float], "y3");
 
     typeCairoPath = make_typedef ("path_t",
 				  CairoNamespace,
@@ -363,38 +349,17 @@
 				  PATH_I,
 				  &path,
 				  BuildUnionType(5,
-						 NewTypeRef (typeCairoMoveTo, True), "move_to",
-						 NewTypeRef (typeCairoLineTo, True), "line_to",
+						 NewTypeRef (typeCairoPoint, True), "move_to",
+						 NewTypeRef (typeCairoPoint, True), "line_to",
 						 NewTypeRef (typeCairoCurveTo, True), "curve_to",
-						 NewTypeRef (typeCairoClosePath, True), "close_path",
-						 typePrim[rep_void], "end"));
-
-    mt->symbol.type = BuildStructType (3,
-				       typeCairoPath, "next",
-				       typePrim[rep_float], "x",
-				       typePrim[rep_float], "y");
-
-    lt->symbol.type = BuildStructType (3,
-				       typeCairoPath, "next",
-				       typePrim[rep_float], "x",
-				       typePrim[rep_float], "y");
-
-    ct->symbol.type = BuildStructType (7,
-				       typeCairoPath, "next",
-				       typePrim[rep_float], "x1",
-				       typePrim[rep_float], "y1",
-				       typePrim[rep_float], "x2",
-				       typePrim[rep_float], "y2",
-				       typePrim[rep_float], "x3",
-				       typePrim[rep_float], "y3");
-
-    cp->symbol.type = BuildStructType (1,
-				       typeCairoPath, "next");
+						 typePrim[rep_void], "close_path"));
 
-    
 
     CairoSurfaceNamespace = BuiltinNamespace (&CairoNamespace, "Surface")->namespace.namespace;
 
+    CairoImageNamespace = BuiltinNamespace (&CairoNamespace, "Image")->namespace.namespace;
+    
+    CairoPdfNamespace = BuiltinNamespace (&CairoNamespace, "Pdf")->namespace.namespace;
 
     CairoPatternNamespace = BuiltinNamespace (&CairoNamespace, "Pattern")->namespace.namespace;
 
@@ -421,6 +386,19 @@
 							  "BILINEAR",
 							  "GAUSSIAN"));
 
+    typeCairoScaledFont = make_typedef ("scaled_font_t",
+					CairoNamespace,
+					publish_public,
+					SCALED_FONT_I,
+					NULL,
+					typePrim[rep_foreign]);
+    typeCairoFontFace = make_typedef ("font_face_t",
+				      CairoNamespace,
+				      publish_public,
+				      FONT_FACE_I,
+				      NULL,
+				      typePrim[rep_foreign]);
+
     EXIT();
 }
 
@@ -466,180 +444,182 @@
 {
     ENTER ();
 	
-    static const struct fbuiltin_0 funcs_0[] = {
-	{ do_Cairo_create, "create", CAIRO_S, "", "\n"
-	    " cairo_t create ()\n"
+    static const struct fbuiltin_1 funcs_1[] = {
+	{ do_Cairo_create, "create", CAIRO_S, SURFACE_S, "\n"
+	    " cairo_t create (surface_t sv)\n"
 	    "\n"
-	    " Create a cairo context.\n"
+	    " Create a cairo context for the specified surface.\n"
 	},
-	{ 0 },
-    };
-    
-    static const struct fbuiltin_1 funcs_1[] = {
 	{ do_Cairo_destroy, "destroy", "v", CAIRO_S, "\n"
-	    " void destroy (cairo_t cairo)\n"
+	    " void destroy (cairo_t cr)\n"
 	    "\n"
 	    " destroy a rendering context.\n"},
-	{ do_Cairo_get_target_surface, "get_target_surface", SURFACE_S, CAIRO_S, "\n"
-	    " surface_t get_target_surface (cairo_t cairo)\n"
+	{ do_Cairo_get_target, "get_target", SURFACE_S, CAIRO_S, "\n"
+	    " surface_t get_target (cairo_t cr)\n"
 	    "\n"
 	    " Return current target surface\n" },
 	{ do_Cairo_status, "status", STATUS_S, CAIRO_S, "\n"
-	    " status_t status (cairo_t cairo)\n"
+	    " status_t status (cairo_t cr)\n"
 	    "\n"
 	    " Return the status of a cairo surface\n" },
 	{ do_Cairo_status_string, "status_string", "s", CAIRO_S, "\n"
-	    " string status_string (cairo_t cairo)\n"
+	    " string status_string (cairo_t cr)\n"
 	    "\n"
 	    " Return the status string of a cairo surface\n" },
 	{ do_Cairo_enable, "enable", "v", CAIRO_S, "\n"
-	    " void enable (cairo_t cairo)\n"
+	    " void enable (cairo_t cr)\n"
 	    "\n"
 	    " Enable screen updates from a cairo surface\n" },
 	{ do_Cairo_disable, "disable", "v", CAIRO_S, "\n"
-	    " void disable (cairo_t cairo)\n"
+	    " void disable (cairo_t cr)\n"
 	    "\n"
 	    " Disable screen updates from a cairo surface\n" },
 	{ do_Cairo_save, "save", "v", CAIRO_S, "\n"
-	    " void save (cairo_t cairo)\n"
+	    " void save (cairo_t cr)\n"
 	    "\n"
 	    " Save graphics state\n" },
 	{ do_Cairo_restore, "restore", "v", CAIRO_S, "\n"
-	    " void restore (cairo_t cairo)\n"
+	    " void restore (cairo_t cr)\n"
 	    "\n"
 	    " Restore graphics state\n" },
 	{ do_Cairo_identity_matrix, "identity_matrix", "v", CAIRO_S, "\n"
-	    " void identity_matrix (cairo_t cairo)\n"
+	    " void identity_matrix (cairo_t cr)\n"
 	    "\n"
 	    " Set transformation matrix to identity\n" },
-	{ do_Cairo_default_matrix, "default_matrix", "v", CAIRO_S, "\n"
-	    " void default_matrix (cairo_t cairo)\n"
-	    "\n"
-	    " Set transformation matrix to default\n" },
 	{ do_Cairo_new_path, "new_path", "v", CAIRO_S, "\n"
-	    " void new_path (cairo_t cairo)\n"
+	    " void new_path (cairo_t cr)\n"
 	    "\n"
 	    " Starts a new path\n" },
 	{ do_Cairo_close_path, "close_path", "v", CAIRO_S, "\n"
-	    " void close_path (cairo_t cairo)\n"
+	    " void close_path (cairo_t cr)\n"
 	    "\n"
 	    " Closes the current path\n" },
 	{ do_Cairo_fill, "fill", "v", CAIRO_S, "\n"
-	    " void fill (cairo_t cairo)\n"
+	    " void fill (cairo_t cr)\n"
 	    "\n"
 	    " Fill the current path\n" },
 	
+	{ do_Cairo_fill_preserve, "fill_preserve", "v", CAIRO_S, "\n"
+	    " void fill_preserve (cairo_t cr)\n"
+	    "\n"
+	    " Fill the current path without making an implicit call to new_path\n" },
+	
 	{ do_Cairo_stroke, "stroke", "v", CAIRO_S, "\n"
-	    " void stroke (cairo_t cairo)\n"
+	    " void stroke (cairo_t cr)\n"
 	    "\n"
 	    " Stroke the current path\n" },
 	
+	{ do_Cairo_stroke_preserve, "stroke_preserve", "v", CAIRO_S, "\n"
+	    " void stroke_preserve (cairo_t cr)\n"
+	    "\n"
+	    " Stroke the current path without making an implicit call to new_path\n" },
+	
 	{ do_Cairo_copy_page, "copy_page", "v", CAIRO_S, "\n"
-	    " void copy_page (cairo_t cairo)\n"
+	    " void copy_page (cairo_t cr)\n"
 	    "\n"
 	    " Write out the current page, leaving it intact.\n" },
 	
 	{ do_Cairo_show_page, "show_page", "v", CAIRO_S, "\n"
-	    " void show_page (cairo_t cairo)\n"
+	    " void show_page (cairo_t cr)\n"
 	    "\n"
 	    " Write out the current page, and erase it.\n" },
 	
-	{ do_Cairo_current_path_flat_list, "current_path_flat_list", PATH_S, CAIRO_S, "\n"
-	    " void current_path_flat (cairo_t cr)\n"
+	{ do_Cairo_copy_path, "copy_path", PATH_S, CAIRO_S, "\n"
+	    " void copy_path (cairo_t cr)\n"
 	    "\n"
-	    " Returns the current path with curves tesselated to lines\n" },
+	    " Returns the current path\n" },
 
-	{ do_Cairo_current_path_list, "current_path_list", PATH_S, CAIRO_S, "\n"
-	    " void current_path (cairo_t cr)\n"
+	{ do_Cairo_copy_path_flat, "copy_path_flat", PATH_S, CAIRO_S, "\n"
+	    " void copy_path (cairo_t cr)\n"
 	    "\n"
-	    " Returns the current path\n" },
+	    " Returns the current path with curves tesselated to lines\n" },
 	
-	{ do_Cairo_init_clip, "init_clip", "v", CAIRO_S, "\n"
-	    " void init_clip (cairo_t cairo)\n"
+	{ do_Cairo_reset_clip, "reset_clip", "v", CAIRO_S, "\n"
+	    " void reset_clip (cairo_t cr)\n"
 	    "\n"
-	    " Resets clip list to whole surface\n" },
-	
+	    " Reset clip to the entire surface.\n" },
+
 	{ do_Cairo_clip, "clip", "v", CAIRO_S, "\n"
-	    " void clip (cairo_t cairo)\n"
+	    " void clip (cairo_t cr)\n"
 	    "\n"
-	    " Clip to current path.  Does not empty path.\n" },
+	    " Clip to current path. Consumes path.\n" },
+
+	{ do_Cairo_clip_preserve, "clip_preserve", "v", CAIRO_S, "\n"
+	    " void clip_preserve (cairo_t cr)\n"
+	    "\n"
+	    " Clip to current path without consuming path.\n" },
 
 	{ do_Cairo_stroke_extents, "stroke_extents", RECT_S, CAIRO_S, "\n"
-	    " rect_t stroke_extents (cairo_t cairo)\n"
+	    " rect_t stroke_extents (cairo_t cr)\n"
 	    "\n"
 	    " Returns bounding box of stroking current path\n" },
 	
 	{ do_Cairo_fill_extents, "fill_extents", RECT_S, CAIRO_S, "\n"
-	    " rect_t fill_extents (cairo_t cairo)\n"
+	    " rect_t fill_extents (cairo_t cr)\n"
 	    "\n"
 	    " Returns bounding box of filling current path\n" },
 	
 	{ do_Cairo_get_operator, "get_operator", OPERATOR_S, CAIRO_S, "\n"
-	    " operator_t get_operator (cairo_t cairo)\n"
+	    " operator_t get_operator (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current operator\n" },
 	
 	{ do_Cairo_get_source, "get_source", PATTERN_S, CAIRO_S, "\n"
-	    " pattern_t get_source (cairo_t cairo)\n"
+	    " pattern_t get_source (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current source pattern\n" },
 	
 	{ do_Cairo_get_tolerance, "get_tolerance", "n", CAIRO_S, "\n"
-	    " real get_tolerance (cairo_t cairo)\n"
+	    " real get_tolerance (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current tolerance\n" },
 	
 	{ do_Cairo_get_current_point, "get_current_point", POINT_S, CAIRO_S, "\n"
-	    " point_t current_point (cairo_t cairo)\n"
+	    " point_t current_point (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current point\n" },
 	
 	{ do_Cairo_get_fill_rule, "get_fill_rule", FILL_RULE_S, CAIRO_S, "\n"
-	    " fill_rule_t get_fill_rule (cairo_t cairo)\n"
+	    " fill_rule_t get_fill_rule (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current fill rule\n" },
 	
 	{ do_Cairo_get_line_width, "get_line_width", "n", CAIRO_S, "\n"
-	    " real get_line_width (cairo_t cairo)\n"
+	    " real get_line_width (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current line width\n" },
-	
 	{ do_Cairo_get_line_cap, "get_line_cap", LINE_CAP_S, CAIRO_S, "\n"
-	    " line_cap_t get_line_cap (cairo_t cairo)\n"
+	    " line_cap_t get_line_cap (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current line_cap\n" },
-	
 	{ do_Cairo_get_line_join, "get_line_join", LINE_JOIN_S, CAIRO_S, "\n"
-	    " line_join_t get_line_join (cairo_t cairo)\n"
+	    " line_join_t get_line_join (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current line join\n" },
-	
 	{ do_Cairo_get_miter_limit, "get_miter_limit", "n", CAIRO_S, "\n"
-	    " real get_miter_limit (cairo_t cairo)\n"
+	    " real get_miter_limit (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current miter limit\n" },
-	
 	{ do_Cairo_get_matrix, "get_matrix", MATRIX_S, CAIRO_S, "\n"
-	    " matrix_t get_matrix (cairo_t cairo)\n"
+	    " matrix_t get_matrix (cairo_t cr)\n"
 	    "\n"
 	    " Returns the current transformation matrix\n" },
-	
+	{ do_Cairo_paint, "paint", "v", CAIRO_S, "\n"
+	    " void paint (cairo_t cr)\n"
+	    "\n"
+	    " Fill cr with the pattern\n" },
+	{ do_Cairo_get_font_matrix, "get_font_matrix", MATRIX_S, CAIRO_S, "\n"
+	    " matrix_t get_font_matrix (cairo_t cr)\n"
+	    "\n"
+	    " Returns the current font matrix\n" },
 	{ do_Cairo_font_extents, "font_extents", FONT_EXTENTS_S, CAIRO_S, "\n"
-	    " font_extents_t font_extents (cairo_t cairo)\n"
+	    " font_extents_t font_extents (cairo_t cr)\n"
 	    "\n"
 	    " Returns metrics for current font\n" },
 	{ 0 }
     };
     
     static const struct fbuiltin_2 funcs_2[] = {
-	{ do_Cairo_set_target_surface, "set_target_surface", "v", CAIRO_S SURFACE_S, "\n"
-	    " void set_target_surface (cairo_t cr, surface_t surface)\n"
-	    "\n"
-	    " Set target surface for drawing operations\n" },
-	{ do_Cairo_copy, "copy", "v", CAIRO_S CAIRO_S, "\n"
-	    " void copy (cairo_t dst, cairo_t src)\n"
-	    "\n"
-	    " Copy state from one rendering context to another\n" },
 	{ do_Cairo_set_operator, "set_operator", "v", CAIRO_S OPERATOR_S, "\n"
 	    " void set_operator (cairo_t cr, operator_t operator)\n"
 	    "\n"
@@ -676,10 +656,22 @@
 	    " void rotate (cairo_t cr, real radians)\n"
 	    "\n"
 	    " Rotate current transformation matrix by specified amount\n" },
+	{ do_Cairo_paint_with_alpha, "paint_with_alpha", "v", CAIRO_S "n", "\n"
+	    " void paint_with_alpha (cairo_t cr, real alpha)\n"
+	    "\n"
+	    " Fill cr with the source with the constant mask alpha\n" },
+	{ do_Cairo_mask, "mask", "v", CAIRO_S PATTERN_S, "\n"
+	    " void mask (cairo_t cr, pattern_t pattern)\n"
+	    "\n"
+	    " Fill cr with the source with the specified mask\n" },
+	{ do_Cairo_append_path, "append_path", "v", CAIRO_S PATH_S, "\n"
+	    " void append_path (cairo_t cr, path_t path)\n"
+	    "\n"
+	    " Append path to cr\n" },
 	{ do_Cairo_set_font, "set_font", "v", CAIRO_S "s", "\n"
-	    " void set_font (cairo_t cr, string name)\n"
+	    " void set_font (cairo_t cr, string fontname)\n"
 	    "\n"
-	    " Select and set current font from name.\n" },
+	    " Sets the current font using fontname\n" },
 	{ do_Cairo_set_font_size, "set_font_size", "v", CAIRO_S "n", "\n"
 	    " void set_font_size (cairo_t cr, real size)\n"
 	    "\n"
@@ -700,44 +692,34 @@
 	    " text_extents_t text_extents (cairo_t cr, string text)\n"
 	    "\n"
 	    " Appends text to current path\n" },
-	{ do_Cairo_concat_matrix, "concat_matrix", "v", CAIRO_S MATRIX_S, "\n"
-	    " void concat_matrix (cairo_t cr, matrix_t matrix)\n"
+	{ do_Cairo_transform, "transform", "v", CAIRO_S MATRIX_S, "\n"
+	    " void transform (cairo_t cr, matrix_t matrix)\n"
 	    "\n"
 	    " Mixes in another matrix to the current transformation\n" },
 	{ do_Cairo_set_matrix, "set_matrix", "v", CAIRO_S MATRIX_S, "\n"
 	    " void set_matrix (cairo_t cr, matrix_t matrix)\n"
 	    "\n"
 	    " Sets the transformation matrix\n" },
-	{ do_Cairo_transform_point, "transform_point", POINT_S, CAIRO_S POINT_S, "\n"
-	    " point_t transform_point (cairo_t cr, point_t)\n"
+	{ do_Cairo_user_to_device, "user_to_device", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t user_to_device (cairo_t cr, point_t)\n"
 	    "\n"
 	    " Transform a point from user to device space\n" },
-	{ do_Cairo_transform_distance, "transform_distance", POINT_S, CAIRO_S POINT_S, "\n"
-	    " point_t transform_distance (cairo_t cr, point_t point)\n"
+	{ do_Cairo_user_to_device_distance, "user_to_device_distance", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t user_to_device_distance (cairo_t cr, point_t point)\n"
 	    "\n"
 	    " Transform a distance from user to device space\n" },
-	{ do_Cairo_inverse_transform_point, "inverse_transform_point", POINT_S, CAIRO_S POINT_S, "\n"
-	    " point_t inverse_transform_point (cairo_t cr, point_t point)\n"
+	{ do_Cairo_device_to_user, "device_to_user", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t device_to_user (cairo_t cr, point_t point)\n"
 	    "\n"
 	    " Transform a point from device to user space\n" },
-	{ do_Cairo_inverse_transform_distance, "inverse_transform_distance", POINT_S, CAIRO_S POINT_S, "\n"
-	    " point_t inverse_transform_distance (cairo_t cr, point_t point)\n"
+	{ do_Cairo_device_to_user_distance, "device_to_user_distance", POINT_S, CAIRO_S POINT_S, "\n"
+	    " point_t device_to_user_distance (cairo_t cr, point_t point)\n"
 	    "\n"
 	    " Transform a distance from device to user space\n" },
 	{ 0 }
     };
 
     static const struct fbuiltin_3 funcs_3[] = {
-#if 0
-	{ do_Cairo_new_png, "new_png", CAIRO_S, "sii", "\n"
-	    " cairo_t new_png (string filename, int width, int height)\n"
-	    "\n"
-	    " Create a cairo png file.\n" },
-	{ do_Cairo_new_scratch, "new_scratch", CAIRO_S, CAIRO_S "ii", "\n"
-	    " cairo_t new_scratch (cairo_t cr, int width, int height)\n"
-	    "\n"
-	    " Create a scratch surface related to the given surface.\n" },
-#endif
 	{ do_Cairo_move_to, "move_to", "v", CAIRO_S "nn", "\n"
 	    " void move_to (cairo_t cr, real x, real y)\n"
 	    "\n"
@@ -767,11 +749,11 @@
 	    "\n"
 	    " Sets current dash pattern and offset\n" },
 	{ do_Cairo_in_fill, "in_fill", "b", CAIRO_S "nn", "\n"
-	    " bool in_fill (cairo_t cairo, real x, real y)\n"
+	    " bool in_fill (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Test whether (x,y) would be covered by filling the current path\n" },
 	{ do_Cairo_in_stroke, "in_stroke", "b", CAIRO_S "nn", "\n"
-	    " bool in_stroke (cairo_t cairo, real x, real y)\n"
+	    " bool in_stroke (cairo_t cr, real x, real y)\n"
 	    "\n"
 	    " Test whether (x,y) would be covered by stroking the current path\n" },
 	{ 0 }
@@ -782,10 +764,18 @@
 	    " void set_source_rgb (cairo_t cr, real red, real green, real blue)\n"
 	    "\n"
 	    " Set solid color source\n" },
-	{ do_Cairo_select_font, "select_font", "v", CAIRO_S "s" FONT_SLANT_S FONT_WEIGHT_S, "\n"
-	    " void select_font (cairo_t cr, string family, slant_t slant, weight_t weight)\n"
+	{ do_Cairo_set_source_surface, "set_source_surface", "v", CAIRO_S SURFACE_S "nn", "\n"
+	    " void set_source_surface (cairo_t cr, surface_t surface, real x, real y)\n"
 	    "\n"
-	    " Set current font\n" },
+	    " Set the source to surface and offset by x,y\n" },
+	{ do_Cairo_mask_surface, "mask_surface", "v", CAIRO_S SURFACE_S "nn", "\n"
+	    " void mask_surface (cairo_t cr, surface_t surface, real x, real y)\n"
+	    "\n"
+	    " Fill cr with the source using surface, offset by x,y, as the mask\n" },
+	{ do_Cairo_select_font_face, "select_font_face", "v", CAIRO_S "s" FONT_SLANT_S FONT_WEIGHT_S, "\n"
+	    " void select_font_face (cairo_t cr, string family, font_slant_t slant, font_weight_t weight)\n"
+	    "\n"
+	    " Select a font face using the specified family, slant and weight\n" },
 	{ 0 }
     };
 
@@ -826,6 +816,10 @@
     };
 
     static const struct fbuiltin_1 surfuncs_1[] = {
+	{ do_Cairo_Surface_finish, "finish", "v", SURFACE_S, "\n"
+	    " void finish (surface_t surface)\n"
+	    "\n"
+	    " Finish a surface. All output to the surface is finalized\n" },
 	{ do_Cairo_Surface_destroy, "destroy", "v", SURFACE_S, "\n"
 	    " void destroy (surface_t surface)\n"
 	    "\n"
@@ -846,14 +840,14 @@
     };
 
     static const struct fbuiltin_2 surfuncs_2[] = {
-	{ do_Cairo_Surface_create_image, "create_image", SURFACE_S, "nn", "\n"
-	    " surface_t create_image (real width, real height)\n"
-	    "\n"
-	    " Create an image surface\n" },
 	{ do_Cairo_Surface_write_to_png, "write_to_png", "v", SURFACE_S "s", "\n"
-	    " surface_t write_to_png (surface_t surface, string filename)\n"
+	    " void write_to_png (surface_t surface, string filename)\n"
 	    "\n"
-	    " Write a surface to a file in png format\n" },
+	    " Write a surface to filename in png format\n" },
+	{ do_Cairo_Surface_write_to_png_file, "write_to_png_file", "v", SURFACE_S "f", "\n"
+	    " void write_to_png (surface_t surface, file f)\n"
+	    "\n"
+	    " Write a surface to f in png format\n" },
 	{ 0 }
     };
     
@@ -866,22 +860,14 @@
 	    " surface_t create_similar (surface_t related, real width, real height)\n"
 	    "\n"
 	    " Create a similar surface related to another surface\n" },
-	{ 0 }
-    };
-
-    static const struct fbuiltin_5 surfuncs_5[] = {
-	{ do_Cairo_Surface_create_ps, "create_ps", SURFACE_S, "snnnn", "\n"
-	    " surface_t create_ps (string filename, real width_inches, real height_inches, real xppi, real yppi)\n"
+	{ do_Cairo_Surface_set_device_offset, "set_device_offset", "v", SURFACE_S "nn", "\n"
+	    " void set_device_offset (surface_t surface, real x, real y)\n"
 	    "\n"
-	    " Create a PostScript file and return a surface pointer for it\n" },
+	    " Sets the device offset for surface to x,y\n" },
 	{ 0 }
     };
 
     static const struct fbuiltin_1 patfuncs_1[] = {
-	{ do_Cairo_Pattern_create_png, "create_png", PATTERN_S, "s", "\n"
-	    " pattern_t create_png (string filename)\n"
-	    "\n"
-	    " Returns a pattern containing the specified png image\n" },
 	{ do_Cairo_Pattern_create_for_surface, "create_for_surface", PATTERN_S, CAIRO_S, "\n"
 	    " pattern_t create_for_surface (cairo_t cr)\n"
 	    "\n"
@@ -930,16 +916,47 @@
 	    " pattern_t create_radial (real cx0, real cy0, real radius0, real cx1, real cy1, real radius1)\n"
 	    "\n"
 	    " Create a radial gradient pattern\n" },
-	{ do_Cairo_Pattern_add_color_stop, "add_color_stop", STATUS_S, PATTERN_S "nnnnn", "\n"
-	    " status_t add_color_stop (pattern_t cr, real offset, real red, real green, real blue, real alpha)\n"
+	{ do_Cairo_Pattern_add_color_stop_rgba, "add_color_stop", STATUS_S, PATTERN_S "nnnnn", "\n"
+	    " status_t add_color_stop_rgba (pattern_t cr, real offset, real red, real green, real blue, real alpha)\n"
 	    "\n"
 	    " Add a color stop in a gradient pattern.\n" },
 	{ 0 }
     };
 
+    static const struct fbuiltin_1 imgfuncs_1[] = {
+	{ do_Cairo_Image_surface_create_from_png, "surface_create_from_png", SURFACE_S, "s", "\n"
+	    " surface_t surface_create_from_png (string filename)\n"
+	    "\n"
+	    " Create an image surface from the png image in filename\n" },
+	{ do_Cairo_Image_surface_create_from_png_file, "surface_create_from_png_file", SURFACE_S, "f", "\n"
+	    " surface_t surface_create_from_png_file (file f)\n"
+	    "\n"
+	    " Create an image surface from the png image in f\n" },
+	{ 0 }
+    };
+					 
+    static const struct fbuiltin_3 imgfuncs_3[] = {
+	{ do_Cairo_Image_surface_create, "surface_create", SURFACE_S, "nnn", "\n"
+	    " surface_t surface_create (int format, int width, int height)\n"
+	    "\n"
+	    " Create an image surface of the specified size in pixels\n" },
+	{ 0 }
+    };
+					 
+    static const struct fbuiltin_3 pdffuncs_3[] = {
+	{ do_Cairo_Pdf_surface_create, "surface_create", SURFACE_S, "snn", "\n"
+	    " surface_t surface_create (string filename, real width, real height)\n"
+	    "\n"
+	    " Create a PDF surface of the specified size in points, written to filename\n" },
+	{ do_Cairo_Pdf_surface_create, "surface_create_for_file", SURFACE_S, "snn", "\n"
+	    " surface_t surface_create (file f, real width, real height)\n"
+	    "\n"
+	    " Create a PDF surface of the specified size in points, written to f\n" },
+	{ 0 }
+    };
+					 
     init_types ();
     
-    BuiltinFuncs0 (&CairoNamespace, funcs_0);
     BuiltinFuncs1 (&CairoNamespace, funcs_1);
     BuiltinFuncs2 (&CairoNamespace, funcs_2);
     BuiltinFuncs3 (&CairoNamespace, funcs_3);
@@ -951,12 +968,16 @@
     BuiltinFuncs1 (&CairoSurfaceNamespace, surfuncs_1);
     BuiltinFuncs2 (&CairoSurfaceNamespace, surfuncs_2);
     BuiltinFuncs3 (&CairoSurfaceNamespace, surfuncs_3);
-    BuiltinFuncs5 (&CairoSurfaceNamespace, surfuncs_5);
     
     BuiltinFuncs1 (&CairoPatternNamespace, patfuncs_1);
     BuiltinFuncs2 (&CairoPatternNamespace, patfuncs_2);
     BuiltinFuncs4 (&CairoPatternNamespace, patfuncs_4);
     BuiltinFuncs6 (&CairoPatternNamespace, patfuncs_6);
 
+    BuiltinFuncs1 (&CairoImageNamespace, imgfuncs_1);
+    BuiltinFuncs3 (&CairoImageNamespace, imgfuncs_3);
+    
+    BuiltinFuncs3 (&CairoPdfNamespace, pdffuncs_3);
+
     RETURN(TrueVal);
 }

Index: pattern.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/pattern.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pattern.c	2 May 2005 20:24:38 -0000	1.5
+++ pattern.c	18 May 2005 06:21:15 -0000	1.6
@@ -129,189 +129,39 @@
 }
 
 Value
-do_Cairo_Pattern_create_for_surface (Value cv)
+do_Cairo_Pattern_create_for_surface (Value sv)
 {
     ENTER ();
-    cairo_5c_t	    *c5c = cairo_5c_get (cv);
-    cairo_surface_t *surface;
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
 
     if (aborting)
 	RETURN (Void);
-    surface = cairo_current_target_surface (c5c->cr);
-    RETURN (make_pattern_value (cairo_pattern_create_for_surface (surface)));
-}
-
-static void
-premultiply_data (png_structp   png,
-                  png_row_infop row_info,
-                  png_bytep     data)
-{
-    int i;
-
-    for (i = 0; i < row_info->rowbytes; i += 4) {
-	unsigned char  *base = &data[i];
-	unsigned char  blue = base[0];
-	unsigned char  green = base[1];
-	unsigned char  red = base[2];
-	unsigned char  alpha = base[3];
-	unsigned long	p;
-
-	red = (unsigned) red * (unsigned) alpha / 255;
-	green = (unsigned) green * (unsigned) alpha / 255;
-	blue = (unsigned) blue * (unsigned) alpha / 255;
-	p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
-	memcpy (base, &p, sizeof (unsigned long));
-    }
-}
-
-#if 0
-struct _cairo_matrix {
-    double m[3][2];
-};
-#endif
-
-struct _cairo_surface {
-    const void *backend;
-    unsigned int ref_count;
-
-    cairo_matrix_t matrix;
-    cairo_filter_t filter;
-    int repeat;
-};
-
-struct cairo_image_surface {
-    cairo_surface_t base;
-
-    /* libic-specific fields */
-    char *data;
-    int owns_data;
-};
-
-static cairo_surface_t *
-create_surface_from_png (const char *filename)
-{
-    FILE	    *f;
-    cairo_surface_t *surface;
-    char	    *buffer;
-    png_structp	    png;
-    png_infop	    info;
-    png_bytepp	    rows;
-    int		    i;
-    png_uint_32	    width, height;
-    png_uint_32	    stride;
-    int		    depth, color, interlace;
-    
-    png = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-    if (png == NULL)
-	return NULL;
-    info = png_create_info_struct (png);
-    if (info == NULL)
-    {
-	png_destroy_read_struct (&png, NULL, NULL);
-	return NULL;
-    }
-    if (setjmp (png->jmpbuf))
-    {
-	png_destroy_read_struct (&png, &info, NULL);
-	return NULL;
-    }
-    f = fopen (filename, "rb");
-    if (f == NULL)
-    {
-	png_destroy_read_struct (&png, &info, NULL);
-	return NULL;
-    }
-    png_init_io (png, f);
-    png_read_info (png, info);
-    png_get_IHDR (png, info, &width, &height, &depth, &color, &interlace,
-		  NULL, NULL);
-
-    if (color == PNG_COLOR_TYPE_PALETTE && depth <= 8)
-	png_set_expand (png);
-
-    if (color == PNG_COLOR_TYPE_GRAY && depth < 8)
-	png_set_expand (png);
-
-    if (png_get_valid (png, info, PNG_INFO_tRNS))
-	png_set_expand (png);
-
-    if (depth == 16)
-	png_set_strip_16 (png);
-
-    if (depth < 8)
-	png_set_packing (png);
-
-    if (color == PNG_COLOR_TYPE_GRAY || color == PNG_COLOR_TYPE_GRAY_ALPHA)
-	png_set_gray_to_rgb (png);
-
-    if (interlace != PNG_INTERLACE_NONE)
-	png_set_interlace_handling (png);
-
-    png_set_bgr (png);
-    png_set_filler (png, 255, PNG_FILLER_AFTER);
-
-    png_set_read_user_transform_fn (png, premultiply_data);
-
-    png_read_update_info (png, info);
-
-    stride = width * 4;
-    buffer = malloc (stride * height);
-    
-    rows = malloc (sizeof (png_bytep) * height);
-
-    for (i = 0; i < height; i++)
-	rows[i] = (png_bytep) (buffer + i * stride);
-    
-    png_read_image (png, rows);
-    png_read_end (png, info);
-
-    free (rows);
-    fclose (f);
-    png_destroy_read_struct (&png, &info, NULL);
-
-    surface = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32, 
-						   width, height, stride);
-    if (!surface)
-    {
-	free (buffer);
-	return NULL;
-    }
-    
-    /*
-     * XXX hack internal structure contents to hand buffer to cairo 
-     */
-    ((struct cairo_image_surface *) surface)->owns_data = 1;
-    
-    return surface;
+    RETURN (make_pattern_value (cairo_pattern_create_for_surface (c5s->surface)));
 }
 
 Value
-do_Cairo_Pattern_create_png (Value filenamev)
+do_Cairo_Pattern_add_color_stop_rgba (Value patv, Value offsetv,
+				      Value redv, Value greenv, Value bluev,
+				      Value alphav)
 {
     ENTER ();
-    char	    *filename = StrzPart (filenamev, "invalid filename");
-    cairo_surface_t *image;
-    cairo_pattern_t *pattern;
+    cairo_pattern_t *pat = get_cairo_pattern (patv);
+    double	    offset = DoublePart (offsetv, "offset invalid");
+    double	    red = DoublePart (redv, "red invalid");
+    double	    green = DoublePart (greenv, "green invalid");
+    double	    blue = DoublePart (bluev, "blue invalid");
+    double	    alpha = DoublePart (alphav, "alpha invalid");
 
     if (aborting)
 	RETURN(Void);
-    image = create_surface_from_png (filename);
-    if (!image)
-    {
-	RaiseStandardException (exception_open_error,
-				"cannot read png file",
-				1, filenamev);
-	RETURN (Void);
-    }
-    pattern = cairo_pattern_create_for_surface (image);
-    cairo_surface_destroy (image);
-    RETURN (make_pattern_value (pattern));
+    RETURN (IntToEnum (typeCairoStatus,
+		       cairo_pattern_add_color_stop_rgba (pat, offset, red,
+							  green, blue, alpha)));
 }
 
 Value
-do_Cairo_Pattern_add_color_stop (Value patv, Value offsetv,
-				 Value redv, Value greenv, Value bluev,
-				 Value alphav)
+do_Cairo_Pattern_add_color_stop_rgb (Value patv, Value offsetv,
+				     Value redv, Value greenv, Value bluev)
 {
     ENTER ();
     cairo_pattern_t *pat = get_cairo_pattern (patv);
@@ -319,13 +169,12 @@
     double	    red = DoublePart (redv, "red invalid");
     double	    green = DoublePart (greenv, "green invalid");
     double	    blue = DoublePart (bluev, "blue invalid");
-    double	    alpha = DoublePart (alphav, "alpha invalid");
 
     if (aborting)
 	RETURN(Void);
     RETURN (IntToEnum (typeCairoStatus,
-		       cairo_pattern_add_color_stop (pat, offset, red,
-						     green, blue, alpha)));
+		       cairo_pattern_add_color_stop_rgb (pat, offset, red,
+							 green, blue)));
 }
 
 Value

Index: surface.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- surface.c	2 May 2005 20:24:38 -0000	1.11
+++ surface.c	18 May 2005 06:21:15 -0000	1.12
@@ -93,8 +93,8 @@
 		return 0;
 	break;
     case CAIRO_5C_IMAGE:
-    case CAIRO_5C_PS:
     case CAIRO_5C_SCRATCH:
+    case CAIRO_5C_PDF:
 	break;
     }
     return c5s;
@@ -116,9 +116,11 @@
 	cairo_5c_tool_mark (c5s);
 	break;
     case CAIRO_5C_IMAGE:
-    case CAIRO_5C_PS:
     case CAIRO_5C_SCRATCH:
 	break;
+    case CAIRO_5C_PDF:
+	MemReference (c5s->u.pdf.file);
+	break;
     }
 }
 
@@ -130,14 +132,12 @@
 	return;
     
     switch (c5s->kind) {
-    case CAIRO_5C_PS:
-	FilePrintf (FileStdout, "Copied %d\n", c5s->copied);
+    case CAIRO_5C_PDF:
 	if (!c5s->copied)
 	{
-	    cairo_t *cr = cairo_create ();
+	    cairo_t *cr = cairo_create (c5s->surface);
 	    if (cr)
 	    {
-		cairo_set_target_surface (cr, c5s->surface);
 		cairo_copy_page (cr);
 		cairo_destroy (cr);
 	    }
@@ -156,9 +156,8 @@
 	break;
     case CAIRO_5C_IMAGE:
 	break;
-    case CAIRO_5C_PS:
-	fclose (c5s->u.ps.file);
-	c5s->u.ps.file = NULL;
+    case CAIRO_5C_PDF:
+	c5s->u.pdf.file = Void;
 	break;
     case CAIRO_5C_SCRATCH:
 	break;
@@ -236,11 +235,46 @@
     RETURN (ret);
 }
 
+
 Value
-do_Cairo_Surface_create_image (Value wv, Value hv)
+do_Cairo_Surface_write_to_png (Value sv, Value fv)
+{
+    ENTER ();
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+    char		*filename = StrzPart (fv, "invalid filename");
+    cairo_status_t	status;		
+    
+    if (aborting)
+	RETURN (Void);
+    status = cairo_surface_write_to_png (c5s->surface, filename);
+    RETURN (IntToEnum (typeCairoStatus, status));
+}
+
+Value
+do_Cairo_Surface_write_to_png_file (Value sv, Value fv)
+{
+    ENTER ();
+    RETURN (Void);
+}
+
+Value
+do_Cairo_Surface_set_device_offset (Value sv, Value xv, Value yv)
+{
+    ENTER ();
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+    double	x = DoublePart (xv, "invalid X value");
+    double	y = DoublePart (yv, "invalid Y value");
+    if (!aborting)
+	cairo_surface_set_device_offset (c5s->surface, x, y);
+    RETURN (Void);
+}
+
+Value
+do_Cairo_Surface_create_similar (Value sv, Value wv, Value hv)
 {
     ENTER ();
     cairo_5c_surface_t	*c5s;
+    cairo_5c_surface_t	*c5os = cairo_5c_surface_get (sv);
     int			width = IntPart (wv, "invalid width");
     int			height = IntPart (hv, "invalid height");
     Value		ret;
@@ -249,18 +283,18 @@
 	RETURN (Void);
     
     c5s = ALLOCATE (&Cairo5cSurfaceType, sizeof (cairo_5c_surface_t));
-    c5s->kind = CAIRO_5C_IMAGE;
+    c5s->kind = CAIRO_5C_SCRATCH;
     c5s->surface = 0;
     c5s->width = width;
     c5s->height = height;
     c5s->dirty = False;
-    c5s->recv_events = Void;
     c5s->copied = False;
+    c5s->recv_events = Void;
     
-    c5s->surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-					       width,
-					       height);
-    
+    c5s->surface = cairo_surface_create_similar (c5os->surface,
+						 CAIRO_FORMAT_ARGB32,
+						 width, height);
+						 
     ret = NewForeign (CairoSurfaceId, c5s, 
 		      cairo_surface_foreign_mark, cairo_surface_foreign_free);
 
@@ -268,67 +302,56 @@
 }
 
 Value
-do_Cairo_Surface_write_to_png (Value sv, Value fv)
+do_Cairo_Surface_finish (Value sv)
 {
     ENTER ();
     cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
-    char		*filename = StrzPart (fv, "invalid filename");
-    cairo_status_t	status;		
-    
+
+    if (!aborting)
+	cairo_surface_finish (c5s->surface);
+    RETURN (Void);
+}
+
+Value
+do_Cairo_Surface_destroy (Value sv)
+{
+    ENTER ();
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+
     if (aborting)
 	RETURN (Void);
-    status = cairo_surface_write_to_png (c5s->surface, filename);
-    RETURN (IntToEnum (typeCairoStatus, status));
+    cairo_5c_surface_destroy (c5s);
+    RETURN(Void);
 }
 
 Value
-do_Cairo_Surface_create_ps (Value fv, Value wv, Value hv, Value xppiv, Value yppiv)
+do_Cairo_Surface_width (Value sv)
 {
     ENTER ();
-    cairo_5c_surface_t	*c5s;
-    char		*filename = StrzPart (fv, "invalid filename");
-    double		width = DoublePart (wv, "invalid width");
-    double    		height = DoublePart (hv, "invalid height");
-    double		xppi = DoublePart (xppiv, "invalid x pixels per inch");
-    double		yppi = DoublePart (yppiv, "invalid y pixels per inch");
-    Value		ret;
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
 
     if (aborting)
 	RETURN (Void);
-    
-    c5s = ALLOCATE (&Cairo5cSurfaceType, sizeof (cairo_5c_surface_t));
-    c5s->kind = CAIRO_5C_PS;
-    c5s->surface = 0;
-    c5s->width = width * xppi;
-    c5s->height = height * yppi;
-    c5s->dirty = False;
-    c5s->copied = False;
-    c5s->recv_events = Void;
-    
-    c5s->u.ps.file = fopen (filename, "w");
-    
-    if (!c5s->u.ps.file)
-    {
-	RaiseStandardException (exception_open_error,
-				"can't open file",
-				0, fv);
-	RETURN (Void);
-    }
+    RETURN(Reduce (NewDoubleFloat (c5s->width)));
+}
 
-    c5s->surface = cairo_ps_surface_create (c5s->u.ps.file, width, height, xppi, yppi);
-    
-    ret = NewForeign (CairoSurfaceId, c5s, 
-		      cairo_surface_foreign_mark, cairo_surface_foreign_free);
+Value
+do_Cairo_Surface_height (Value sv)
+{
+    ENTER ();
+    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
 
-    RETURN (ret);
+    if (aborting)
+	RETURN (Void);
+    RETURN(Reduce (NewDoubleFloat (c5s->height)));
 }
 
+
 Value
-do_Cairo_Surface_create_similar (Value sv, Value wv, Value hv)
+do_Cairo_Image_surface_create (Value fv, Value wv, Value hv)
 {
     ENTER ();
     cairo_5c_surface_t	*c5s;
-    cairo_5c_surface_t	*c5os = cairo_5c_surface_get (sv);
     int			width = IntPart (wv, "invalid width");
     int			height = IntPart (hv, "invalid height");
     Value		ret;
@@ -337,18 +360,18 @@
 	RETURN (Void);
     
     c5s = ALLOCATE (&Cairo5cSurfaceType, sizeof (cairo_5c_surface_t));
-    c5s->kind = CAIRO_5C_SCRATCH;
+    c5s->kind = CAIRO_5C_IMAGE;
     c5s->surface = 0;
     c5s->width = width;
     c5s->height = height;
     c5s->dirty = False;
-    c5s->copied = False;
     c5s->recv_events = Void;
+    c5s->copied = False;
+    
+    c5s->surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+					       width,
+					       height);
     
-    c5s->surface = cairo_surface_create_similar (c5os->surface,
-						 CAIRO_FORMAT_ARGB32,
-						 width, height);
-						 
     ret = NewForeign (CairoSurfaceId, c5s, 
 		      cairo_surface_foreign_mark, cairo_surface_foreign_free);
 
@@ -356,35 +379,79 @@
 }
 
 Value
-do_Cairo_Surface_destroy (Value sv)
+do_Cairo_Image_surface_create_from_png (Value filenamev)
 {
     ENTER ();
-    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+    char		*filename = StrzPart (filenamev, "invalid filename");
+    cairo_surface_t	*image;
+    cairo_5c_surface_t	*c5s;
+    Value		ret;
 
     if (aborting)
+	RETURN(Void);
+    image = cairo_image_surface_create_from_png (filename);
+    if (!image)
+    {
+	RaiseStandardException (exception_open_error,
+				"cannot read png file",
+				1, filenamev);
 	RETURN (Void);
-    cairo_5c_surface_destroy (c5s);
-    RETURN(Void);
+    }
+
+    if (aborting)
+	RETURN (Void);
+    
+    c5s = ALLOCATE (&Cairo5cSurfaceType, sizeof (cairo_5c_surface_t));
+    c5s->kind = CAIRO_5C_IMAGE;
+    c5s->surface = 0;
+    c5s->width = cairo_image_surface_get_width (image);
+    c5s->height = cairo_image_surface_get_height (image);
+    c5s->dirty = False;
+    c5s->recv_events = Void;
+    c5s->copied = False;
+    ret = NewForeign (CairoSurfaceId, c5s, 
+		      cairo_surface_foreign_mark, cairo_surface_foreign_free);
+
+    RETURN (ret);
 }
 
 Value
-do_Cairo_Surface_width (Value sv)
+do_Cairo_Image_surface_create_from_png_file (Value filev)
 {
     ENTER ();
-    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
-
-    if (aborting)
-	RETURN (Void);
-    RETURN(NewInt (c5s->width));
+    /* XXX */
+    RETURN (Void);
 }
 
 Value
-do_Cairo_Surface_height (Value sv)
+do_Cairo_Pdf_surface_create (Value fnv, Value wv, Value hv)
 {
     ENTER ();
-    cairo_5c_surface_t	*c5s = cairo_5c_surface_get (sv);
+    cairo_5c_surface_t	*c5s;
+    char		*filename = StrzPart (fnv, "invalid filename");
+    double		width = DoublePart (wv, "invalid width_in_points");
+    double    		height = DoublePart (hv, "invalid height_in_points");
+    Value		ret;
 
     if (aborting)
 	RETURN (Void);
-    RETURN(NewInt (c5s->height));
+    
+    c5s = ALLOCATE (&Cairo5cSurfaceType, sizeof (cairo_5c_surface_t));
+    c5s->kind = CAIRO_5C_PDF;
+    c5s->surface = 0;
+    c5s->width = width;
+    c5s->height = height;
+    c5s->dirty = False;
+    c5s->copied = False;
+    c5s->recv_events = Void;
+    
+    c5s->u.pdf.file = Void;
+    
+    c5s->surface = cairo_pdf_surface_create (filename, width, height);
+    
+    ret = NewForeign (CairoSurfaceId, c5s, 
+		      cairo_surface_foreign_mark, cairo_surface_foreign_free);
+
+    RETURN (ret);
 }
+

Index: text.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/text.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- text.c	2 May 2005 20:24:38 -0000	1.7
+++ text.c	18 May 2005 06:21:15 -0000	1.8
@@ -36,7 +36,7 @@
 #include "cairo-5c.h"
 
 Value
-do_Cairo_select_font (Value cv, Value fv, Value sv, Value wv)
+do_Cairo_select_font_face (Value cv, Value fv, Value sv, Value wv)
 {
     cairo_5c_t		*c5c = cairo_5c_get (cv);
     char		*family = StrzPart (fv, "invalid family");
@@ -44,7 +44,7 @@
     cairo_font_weight_t	weight = EnumIntPart (wv, "invalid weight");
 
     if (!aborting)
-	cairo_select_font (c5c->cr, family, slant, weight);
+	cairo_select_font_face (c5c->cr, family, slant, weight);
     return Void;
 }
 
@@ -120,6 +120,21 @@
 }
 
 Value
+do_Cairo_get_font_matrix (Value cv)
+{
+    ENTER ();
+    cairo_5c_t		*c5c = cairo_5c_get (cv);
+    cairo_matrix_t	matrix;
+    Value		ret;
+    
+    if (aborting)
+	RETURN(Void);
+    cairo_get_font_matrix (c5c->cr, &matrix);
+    ret = new_cairo_matrix (&matrix);
+    RETURN(ret);
+}
+
+Value
 do_Cairo_font_extents (Value cv)
 {
     ENTER ();




More information about the cairo-commit mailing list