[cairo-commit] cairo/src cairo-font-options.c, 1.1, 1.2 cairo-gstate-private.h, 1.12, 1.13 cairo-gstate.c, 1.147, 1.148 cairo.c, 1.113, 1.114 cairo.h, 1.138, 1.139 cairoint.h, 1.167, 1.168

Owen Taylor commit at pdx.freedesktop.org
Mon Jul 25 12:29:26 PDT 2005


Committed by: otaylor

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv4510/src

Modified Files:
	cairo-font-options.c cairo-gstate-private.h cairo-gstate.c 
	cairo.c cairo.h cairoint.h 
Log Message:
2005-07-25  Owen Taylor  <otaylor at redhat.com>

        reviewed by: cworth

        * src/cairo.[ch] src/cairo-gstate-private.h src/cairo-gstate.c
        src/cairoint.c: Add cairo_{get,set}_font_options().

        * doc/public/Makefile.am (IGNORE_HFILES): Add cairo-xlib-private.h

        * doc/public/cairo-sections.txt: Update


Index: cairo-font-options.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font-options.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-font-options.c	21 Jul 2005 13:52:13 -0000	1.1
+++ cairo-font-options.c	25 Jul 2005 19:29:24 -0000	1.2
@@ -174,7 +174,7 @@
 }
 
 /**
- * cairo_font_options_equual:
+ * cairo_font_options_equal:
  * @options: a #cairo_font_options_t
  * @other: another #cairo_font_options_t
  * 

Index: cairo-gstate-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate-private.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cairo-gstate-private.h	15 Jun 2005 02:45:23 -0000	1.12
+++ cairo-gstate-private.h	25 Jul 2005 19:29:24 -0000	1.13
@@ -97,6 +97,7 @@
     cairo_font_face_t *font_face;
     cairo_scaled_font_t *scaled_font;	/* Specific to the current CTM */
     cairo_matrix_t font_matrix;
+    cairo_font_options_t font_options;
 
     cairo_clip_t clip;
 

Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- cairo-gstate.c	21 Jul 2005 13:52:13 -0000	1.147
+++ cairo-gstate.c	25 Jul 2005 19:29:24 -0000	1.148
@@ -121,6 +121,8 @@
     cairo_matrix_init_scale (&gstate->font_matrix,
 			     CAIRO_GSTATE_DEFAULT_FONT_SIZE, 
 			     CAIRO_GSTATE_DEFAULT_FONT_SIZE);
+
+    _cairo_font_options_init_default (&gstate->font_options);
     
     gstate->clip.mode = _cairo_surface_get_clip_mode (target);
     gstate->clip.region = NULL;
@@ -1866,6 +1868,24 @@
 }
 
 cairo_status_t
+_cairo_gstate_set_font_options (cairo_gstate_t             *gstate,
+				const cairo_font_options_t *options)
+{
+    _cairo_gstate_unset_font (gstate);
+
+    gstate->font_options = *options;
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
+void
+_cairo_gstate_get_font_options (cairo_gstate_t       *gstate,
+				cairo_font_options_t *options)
+{
+    *options = gstate->font_options;
+}
+
+cairo_status_t
 _cairo_gstate_get_font_face (cairo_gstate_t     *gstate,
 			     cairo_font_face_t **font_face)
 {
@@ -1984,6 +2004,8 @@
 	return status;
 
     cairo_surface_get_font_options (gstate->target, &options);
+    cairo_font_options_merge (&options, &gstate->font_options);
+    
     gstate->scaled_font = cairo_scaled_font_create (gstate->font_face,
 						    &gstate->font_matrix,
 						    &gstate->ctm,

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- cairo.c	6 Jul 2005 21:52:01 -0000	1.113
+++ cairo.c	25 Jul 2005 19:29:24 -0000	1.114
@@ -1793,6 +1793,49 @@
 }
 
 /**
+ * cairo_set_font_options:
+ * @cr: a #cairo_t
+ * @options: font options to use
+ * 
+ * Sets a set of custom font rendering options for the #cairo_t.
+ * Rendering options are derived by merging these options with the
+ * options derived from underlying surface; if the value in @options
+ * has a default value (like %CAIRO_ANTIALIAS_DEFAULT), then the value
+ * from the surface is used.
+ **/
+void
+cairo_set_font_options (cairo_t                    *cr,
+			const cairo_font_options_t *options)
+{
+    if (cr->status) {
+	_cairo_error (cr, cr->status);
+	return;
+    }
+
+    cr->status = _cairo_gstate_set_font_options (cr->gstate, options);
+    if (cr->status)
+	_cairo_error (cr, cr->status);
+}
+
+/**
+ * cairo_get_font_options:
+ * @cr: a #cairo_t
+ * @options: a #cairo_font_options_t object into which to store
+ *   the retrieved options. All existing values are overwritten
+ * 
+ * Retrieves font rendering options set via #cairo_set_font_options.
+ * Note that the returned options do not include any options derived
+ * from the underlying surface; they are literally the options
+ * passed to cairo_set_font_options().
+ **/
+void
+cairo_get_font_options (cairo_t              *cr,
+			cairo_font_options_t *options)
+{
+    _cairo_gstate_get_font_options (cr->gstate, options);
+}
+
+/**
  * cairo_text_extents:
  * @cr: a #cairo_t
  * @utf8: a string of text, encoded in utf-8

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- cairo.h	23 Jul 2005 16:48:13 -0000	1.138
+++ cairo.h	25 Jul 2005 19:29:24 -0000	1.139
@@ -821,6 +821,14 @@
 		       cairo_matrix_t *matrix);
 
 void
+cairo_set_font_options (cairo_t                    *cr,
+			const cairo_font_options_t *options);
+
+void
+cairo_get_font_options (cairo_t              *cr,
+			cairo_font_options_t *options);
+
+void
 cairo_show_text (cairo_t *cr, const char *utf8);
 
 void

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- cairoint.h	22 Jul 2005 09:04:59 -0000	1.167
+++ cairoint.h	25 Jul 2005 19:29:24 -0000	1.168
@@ -1207,6 +1207,14 @@
 _cairo_gstate_set_font_matrix (cairo_gstate_t	    *gstate, 
 			       const cairo_matrix_t *matrix);
 
+void
+_cairo_gstate_get_font_options (cairo_gstate_t       *gstate,
+				cairo_font_options_t *options);
+     
+cairo_private cairo_status_t
+_cairo_gstate_set_font_options (cairo_gstate_t	           *gstate, 
+				const cairo_font_options_t *options);
+
 cairo_private cairo_status_t
 _cairo_gstate_get_font_face (cairo_gstate_t     *gstate, 
 			     cairo_font_face_t **font_face);




More information about the cairo-commit mailing list