[cairo-commit] cairo-5c ChangeLog, 1.17, 1.18 cairo-5c.h, 1.11, 1.12 pattern.c, 1.3, 1.4 text.c, 1.5, 1.6

Keith Packard commit at pdx.freedesktop.org
Mon Mar 14 13:43:08 PST 2005


Committed by: keithp

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

Modified Files:
	ChangeLog cairo-5c.h pattern.c text.c 
Log Message:
2005-03-14  Keith Packard  <keithp at keithp.com>

	* cairo-5c.h:
	Must explicitly reference desired backends
	
	* pattern.c: (do_Cairo_current_pattern), (create_surface_from_png):
	Switch from deprecated functions to current ones
	
	* text.c: (do_Cairo_set_font):
	Fix sizing from supplied pattern
	
	* examples/graph.5c:
	metrics got fixed.


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-5c/ChangeLog,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ChangeLog	11 Feb 2005 21:15:46 -0000	1.17
+++ ChangeLog	14 Mar 2005 21:43:06 -0000	1.18
@@ -1,3 +1,17 @@
+2005-03-14  Keith Packard  <keithp at keithp.com>
+
+	* cairo-5c.h:
+	Must explicitly reference desired backends
+	
+	* pattern.c: (do_Cairo_current_pattern), (create_surface_from_png):
+	Switch from deprecated functions to current ones
+	
+	* text.c: (do_Cairo_set_font):
+	Fix sizing from supplied pattern
+	
+	* examples/graph.5c:
+	metrics got fixed.
+
 2005-01-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.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cairo-5c.h	11 Feb 2005 21:15:46 -0000	1.11
+++ cairo-5c.h	14 Mar 2005 21:43:06 -0000	1.12
@@ -38,7 +38,13 @@
 
 #include <nickle/builtin.h>
 #define Atom XAtom
+#undef True
+#undef False
 #include <cairo.h>
+#include <cairo-xlib.h>
+#include <cairo-png.h>
+#include <cairo-ps.h>
+#include <cairo-ft.h>
 #include <stdio.h>
 #include <unistd.h>
 #undef Atom

Index: pattern.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/pattern.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pattern.c	23 Dec 2004 22:39:40 -0000	1.3
+++ pattern.c	14 Mar 2005 21:43:06 -0000	1.4
@@ -93,7 +93,7 @@
 
     if (aborting)
 	return Void;
-    return make_pattern_value (cairo_current_pattern (c5c->cr));
+    return make_pattern_value (cairo_get_pattern (c5c->cr));
 }
 
 Value
@@ -164,13 +164,12 @@
     }
 }
 
-struct cairo_matrix {
+struct _cairo_matrix {
     double m[3][2];
 };
 
-struct cairo_surface {
+struct _cairo_surface {
     const void *backend;
-
     unsigned int ref_count;
 
     cairo_matrix_t matrix;
@@ -184,13 +183,6 @@
     /* libic-specific fields */
     char *data;
     int owns_data;
-
-    int width;
-    int height;
-    int stride;
-    int depth;
-
-    pixman_image_t *pixman_image;
 };
 
 static cairo_surface_t *
@@ -275,8 +267,8 @@
     fclose (f);
     png_destroy_read_struct (&png, &info, NULL);
 
-    surface = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_ARGB32, 
-					      width, height, stride);
+    surface = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32, 
+						   width, height, stride);
     if (!surface)
     {
 	free (buffer);

Index: text.c
===================================================================
RCS file: /cvs/cairo/cairo-5c/text.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- text.c	23 Dec 2004 22:39:40 -0000	1.5
+++ text.c	14 Mar 2005 21:43:06 -0000	1.6
@@ -54,25 +54,34 @@
     ENTER ();
     cairo_5c_t		*c5c = cairo_5c_get (cv);
     char		*name = StrzPart (fv, "invalid name");
-    FcPattern		*pat;
-    static FT_Library	ft_library;
+    FcPattern		*pat, *match;
     cairo_font_t	*font;
-    double		scale = 0;
+    double		size = 0;
+    cairo_matrix_t	*scale;
+    FcResult		result;
 
     if (aborting)
 	RETURN (Void);
-    if (!ft_library)
-	if (FT_Init_FreeType (&ft_library))
-	{
-	    RaiseStandardException (exception_open_error,
-				    "can't open FreeType",
-				    1, fv);
-	    RETURN (Void);
-	}
     pat = FcNameParse (name);
-    FcPatternGetDouble (pat, FC_SIZE, 0, &scale);
-    font = cairo_ft_font_create (ft_library, pat);
+
+    FcConfigSubstitute (0, pat, FcMatchPattern);
+    FcDefaultSubstitute (pat);
+
+    match = FcFontMatch (0, pat, &result);
     FcPatternDestroy (pat);
+    if (!match)
+    {
+	RaiseStandardException (exception_open_error,
+				"can't open font",
+				1, fv);
+	RETURN (Void);
+    }
+
+    FcPatternGetDouble (match, FC_SIZE, 0, &size);
+    scale = cairo_matrix_create ();
+    font = cairo_ft_font_create (match, scale);
+    cairo_matrix_destroy (scale);
+    FcPatternDestroy (match);
     if (!font)
     {
 	RaiseStandardException (exception_open_error,
@@ -81,8 +90,7 @@
 	RETURN (Void);
     }
     cairo_set_font (c5c->cr, font);
-    if (scale != 0)
-	cairo_scale_font(c5c->cr, scale);
+    cairo_scale_font (c5c->cr, size);
     cairo_font_destroy (font);
     RETURN(Void);
 }




More information about the cairo-commit mailing list