[cairo-commit] 2 commits - doc/public src/cairo-analysis-surface.c src/cairo.c src/cairo-gstate.c src/cairo.h src/cairoint.h src/cairo-meta-surface.c src/cairo-meta-surface-private.h src/cairo-misc.c src/cairo-paginated-surface.c src/cairo-pdf-operators.c src/cairo-pdf-operators-private.h src/cairo-pdf-surface.c src/cairo-pdf-surface-private.h src/cairo-scaled-font.c src/cairo-surface.c src/cairo-user-font.c src/test-meta-surface.c src/test-paginated-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Sep 17 21:28:19 PDT 2008


 doc/public/Makefile.am                 |    4 +-
 doc/public/cairo-sections.txt          |    1 
 doc/public/tmpl/cairo-scaled-font.sgml |    2 -
 doc/public/tmpl/cairo-text.sgml        |    9 ++++-
 doc/public/tmpl/cairo-user-fonts.sgml  |    2 -
 src/cairo-analysis-surface.c           |    5 +-
 src/cairo-gstate.c                     |   26 +++++++--------
 src/cairo-meta-surface-private.h       |    2 -
 src/cairo-meta-surface.c               |    6 +--
 src/cairo-misc.c                       |    4 +-
 src/cairo-paginated-surface.c          |    4 +-
 src/cairo-pdf-operators-private.h      |    2 -
 src/cairo-pdf-operators.c              |   14 ++++----
 src/cairo-pdf-surface-private.h        |    2 -
 src/cairo-pdf-surface.c                |    6 +--
 src/cairo-scaled-font.c                |   44 +++++++++++--------------
 src/cairo-surface.c                    |    8 +---
 src/cairo-user-font.c                  |   23 ++++++-------
 src/cairo.c                            |   19 +++++------
 src/cairo.h                            |   56 ++++++++++++++++++++-------------
 src/cairoint.h                         |   48 ++++++++++++++--------------
 src/test-meta-surface.c                |    5 +-
 src/test-paginated-surface.c           |    5 +-
 23 files changed, 154 insertions(+), 143 deletions(-)

New commits:
commit 1fe7088a113f8a9cb40d436f10af4967662cd02a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Sep 18 00:26:07 2008 -0400

    [show_text_glyphs] Replace the bool backward with cairo_text_cluster_flags
    
    Chris rightfully complained that having a boolean function argument is
    new in cairo_show_text_glyphs, and indeed avoiding them has been one
    of the API design criteria for cairo.  Trying to come up with alternatives,
    Owen suggested using a flag type which nicely solves the problem AND
    future-proofs such a complex API.
    
    Please welcome _flags_t APIs to cairo.h

diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 160de46..c179e92 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -398,6 +398,7 @@ cairo_glyph_t
 cairo_font_slant_t
 cairo_font_weight_t
 cairo_text_cluster_t
+cairo_text_cluster_flags_t
 cairo_select_font_face
 cairo_set_font_size
 cairo_set_font_matrix
diff --git a/doc/public/tmpl/cairo-scaled-font.sgml b/doc/public/tmpl/cairo-scaled-font.sgml
index 1abf0f3..0a0599a 100644
--- a/doc/public/tmpl/cairo-scaled-font.sgml
+++ b/doc/public/tmpl/cairo-scaled-font.sgml
@@ -133,7 +133,7 @@ size and transformation and a certain set of font options.
 @num_glyphs: 
 @clusters: 
 @num_clusters: 
- at backward: 
+ at cluster_flags: 
 @Returns: 
 
 
diff --git a/doc/public/tmpl/cairo-text.sgml b/doc/public/tmpl/cairo-text.sgml
index 0883f27..64c63da 100644
--- a/doc/public/tmpl/cairo-text.sgml
+++ b/doc/public/tmpl/cairo-text.sgml
@@ -79,6 +79,13 @@ Cairo has two sets of text rendering capabilities:
 @num_bytes: 
 @num_glyphs: 
 
+<!-- ##### ENUM cairo_text_cluster_flags_t ##### -->
+<para>
+
+</para>
+
+ at CAIRO_TEXT_CLUSTER_FLAG_BACKWARD: 
+
 <!-- ##### FUNCTION cairo_select_font_face ##### -->
 <para>
 
@@ -211,7 +218,7 @@ Cairo has two sets of text rendering capabilities:
 @num_glyphs: 
 @clusters: 
 @num_clusters: 
- at backward: 
+ at cluster_flags: 
 
 
 <!-- ##### FUNCTION cairo_font_extents ##### -->
diff --git a/doc/public/tmpl/cairo-user-fonts.sgml b/doc/public/tmpl/cairo-user-fonts.sgml
index c8f3534..5b6dc58 100644
--- a/doc/public/tmpl/cairo-user-fonts.sgml
+++ b/doc/public/tmpl/cairo-user-fonts.sgml
@@ -68,7 +68,7 @@ this feature (1.8 and later).
 @num_glyphs: 
 @clusters: 
 @num_clusters: 
- at backward: 
+ at cluster_flags: 
 @Returns: 
 
 
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index c9f3e85..abed123 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -634,7 +634,7 @@ _cairo_analysis_surface_show_text_glyphs (void			    *abstract_surface,
 					  int			     num_glyphs,
 					  const cairo_text_cluster_t *clusters,
 					  int			     num_clusters,
-					  cairo_bool_t		     backward,
+					  cairo_text_cluster_flags_t cluster_flags,
 					  cairo_scaled_font_t	    *scaled_font)
 {
     cairo_analysis_surface_t *surface = abstract_surface;
@@ -648,8 +648,7 @@ _cairo_analysis_surface_show_text_glyphs (void			    *abstract_surface,
 								     source,
 								     utf8, utf8_len,
 								     glyphs, num_glyphs,
-								     clusters, num_clusters,
-								     backward,
+								     clusters, num_clusters, cluster_flags,
 								     scaled_font);
     if (backend_status == CAIRO_INT_STATUS_UNSUPPORTED && surface->target->backend->show_glyphs) {
 	int remaining_glyphs = num_glyphs;
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 2980770..7c80d09 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1461,16 +1461,16 @@ _cairo_gstate_get_font_extents (cairo_gstate_t *gstate,
 }
 
 cairo_status_t
-_cairo_gstate_text_to_glyphs (cairo_gstate_t	    *gstate,
-			      double		     x,
-			      double		     y,
-			      const char	    *utf8,
-			      int		     utf8_len,
-			      cairo_glyph_t	   **glyphs,
-			      int		    *num_glyphs,
-			      cairo_text_cluster_t **clusters,
-			      int		    *num_clusters,
-			      cairo_bool_t	    *backward)
+_cairo_gstate_text_to_glyphs (cairo_gstate_t	         *gstate,
+			      double		          x,
+			      double		          y,
+			      const char	         *utf8,
+			      int		          utf8_len,
+			      cairo_glyph_t	        **glyphs,
+			      int		         *num_glyphs,
+			      cairo_text_cluster_t      **clusters,
+			      int		         *num_clusters,
+			      cairo_text_cluster_flags_t *cluster_flags)
 {
     cairo_status_t status;
 
@@ -1482,7 +1482,7 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t	    *gstate,
 					     utf8, utf8_len,
 					     glyphs, num_glyphs,
 					     clusters, num_clusters,
-					     backward);
+					     cluster_flags);
 }
 
 cairo_status_t
@@ -1536,7 +1536,7 @@ _cairo_gstate_show_text_glyphs (cairo_gstate_t		   *gstate,
 				int			    num_glyphs,
 				const cairo_text_cluster_t *clusters,
 				int			    num_clusters,
-				cairo_bool_t		    backward)
+				cairo_text_cluster_flags_t  cluster_flags)
 {
     cairo_status_t status;
     cairo_pattern_union_t source_pattern;
@@ -1594,7 +1594,7 @@ _cairo_gstate_show_text_glyphs (cairo_gstate_t		   *gstate,
 						  utf8, utf8_len,
 						  transformed_glyphs, num_glyphs,
 						  clusters, num_clusters,
-						  backward,
+						  cluster_flags,
 						  gstate->scaled_font);
     } else {
 	cairo_path_fixed_t path;
diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h
index bd16a5b..9a1b169 100644
--- a/src/cairo-meta-surface-private.h
+++ b/src/cairo-meta-surface-private.h
@@ -114,7 +114,7 @@ typedef struct _cairo_command_show_text_glyphs {
     unsigned int		 num_glyphs;
     cairo_text_cluster_t	*clusters;
     int				 num_clusters;
-    cairo_bool_t		 backward;
+    cairo_text_cluster_flags_t   cluster_flags;
     cairo_scaled_font_t		*scaled_font;
 } cairo_command_show_text_glyphs_t;
 
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index d939efe..77503d5 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -418,7 +418,7 @@ _cairo_meta_surface_show_text_glyphs (void			    *abstract_surface,
 				      int			     num_glyphs,
 				      const cairo_text_cluster_t    *clusters,
 				      int			     num_clusters,
-				      cairo_bool_t		     backward,
+				      cairo_text_cluster_flags_t     cluster_flags,
 				      cairo_scaled_font_t	    *scaled_font)
 {
     cairo_status_t status;
@@ -469,7 +469,7 @@ _cairo_meta_surface_show_text_glyphs (void			    *abstract_surface,
 	memcpy (command->clusters, clusters, sizeof (clusters[0]) * num_clusters);
     }
 
-    command->backward = backward;
+    command->cluster_flags = cluster_flags;
 
     command->scaled_font = cairo_scaled_font_reference (scaled_font);
 
@@ -926,7 +926,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
 							 command->show_text_glyphs.utf8, command->show_text_glyphs.utf8_len,
 							 dev_glyphs, num_glyphs,
 							 command->show_text_glyphs.clusters, command->show_text_glyphs.num_clusters,
-							 command->show_text_glyphs.backward,
+							 command->show_text_glyphs.cluster_flags,
 							 command->show_text_glyphs.scaled_font);
 
 	    free (dev_glyphs);
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index b927c94..27050a2 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -240,7 +240,7 @@ slim_hidden_def (cairo_text_cluster_free);
  * @num_glyphs: number of glyphs
  * @clusters: array of cluster mapping information
  * @num_clusters: number of clusters in the mapping
- * @backward: whether the text to glyphs mapping goes backward
+ * @cluster_flags: cluster flags
  *
  * Check that clusters cover the entire glyphs and utf8 arrays,
  * and that cluster boundaries are UTF-8 boundaries.
@@ -257,7 +257,7 @@ _cairo_validate_text_clusters (const char		   *utf8,
 			       int			    num_glyphs,
 			       const cairo_text_cluster_t  *clusters,
 			       int			    num_clusters,
-			       cairo_bool_t		    backward)
+			       cairo_text_cluster_flags_t   cluster_flags)
 {
     cairo_status_t status;
     unsigned int n_bytes  = 0;
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 2640a8b..5b1a08f 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -622,7 +622,7 @@ _cairo_paginated_surface_show_text_glyphs (void			    *abstract_surface,
 					  int			     num_glyphs,
 					  const cairo_text_cluster_t *clusters,
 					  int			     num_clusters,
-					  cairo_bool_t		     backward,
+					  cairo_text_cluster_flags_t cluster_flags,
 					  cairo_scaled_font_t	    *scaled_font)
 {
     cairo_paginated_surface_t *surface = abstract_surface;
@@ -649,7 +649,7 @@ _cairo_paginated_surface_show_text_glyphs (void			    *abstract_surface,
 					      utf8, utf8_len,
 					      glyphs, num_glyphs,
 					      clusters, num_clusters,
-					      backward,
+					      cluster_flags,
 					      scaled_font);
     CAIRO_MUTEX_LOCK (scaled_font->mutex);
 
diff --git a/src/cairo-pdf-operators-private.h b/src/cairo-pdf-operators-private.h
index a85839b..7ff843b 100644
--- a/src/cairo-pdf-operators-private.h
+++ b/src/cairo-pdf-operators-private.h
@@ -159,7 +159,7 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t	  *pdf_operators,
 				       int                         num_glyphs,
 				       const cairo_text_cluster_t *clusters,
 				       int                         num_clusters,
-				       cairo_bool_t                backward,
+				       cairo_text_cluster_flags_t  cluster_flags,
 				       cairo_scaled_font_t	  *scaled_font);
 
 #endif /* CAIRO_PDF_OPERATORS_H */
diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index 435503c..0b6c00e 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -1251,7 +1251,7 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t      *pdf_operators,
 				   int                         utf8_len,
 				   cairo_glyph_t              *glyphs,
 				   int                         num_glyphs,
-				   cairo_bool_t                backward,
+				   cairo_text_cluster_flags_t  cluster_flags,
 				   cairo_scaled_font_t	      *scaled_font)
 {
     cairo_scaled_font_subsets_glyph_t subset_glyph;
@@ -1316,7 +1316,7 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t      *pdf_operators,
 	if (status)
 	    return status;
 
-	if (backward)
+	if ((cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD))
 	    cur_glyph--;
 	else
 	    cur_glyph++;
@@ -1338,7 +1338,7 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t	  *pdf_operators,
 				       int                         num_glyphs,
 				       const cairo_text_cluster_t *clusters,
 				       int                         num_clusters,
-				       cairo_bool_t                backward,
+				       cairo_text_cluster_flags_t  cluster_flags,
 				       cairo_scaled_font_t	  *scaled_font)
 {
     cairo_status_t status;
@@ -1391,25 +1391,25 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t	  *pdf_operators,
 
     if (num_clusters > 0) {
 	cur_text = utf8;
-	if (backward)
+	if ((cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD))
 	    cur_glyph = glyphs + num_glyphs;
 	else
 	    cur_glyph = glyphs;
 	for (i = 0; i < num_clusters; i++) {
-	    if (backward)
+	    if ((cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD))
 		cur_glyph -= clusters[i].num_glyphs;
 	    status = _cairo_pdf_operators_emit_cluster (pdf_operators,
 							cur_text,
 							clusters[i].num_bytes,
 							cur_glyph,
 							clusters[i].num_glyphs,
-							backward,
+							cluster_flags,
 							scaled_font);
 	    if (status)
 		return status;
 
 	    cur_text += clusters[i].num_bytes;
-	    if (!backward)
+	    if (!(cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD))
 		cur_glyph += clusters[i].num_glyphs;
 	}
     } else {
diff --git a/src/cairo-pdf-surface-private.h b/src/cairo-pdf-surface-private.h
index a2962f8..ab222de 100644
--- a/src/cairo-pdf-surface-private.h
+++ b/src/cairo-pdf-surface-private.h
@@ -96,7 +96,7 @@ typedef struct _cairo_pdf_smask_group
     int			  num_glyphs;
     cairo_text_cluster_t *clusters;
     int                   num_clusters;
-    cairo_bool_t          backward;
+    cairo_bool_t          cluster_flags;
     cairo_scaled_font_t	 *scaled_font;
 } cairo_pdf_smask_group_t;
 
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index f72f829..f6f8679 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -4037,7 +4037,7 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t     *surface,
 							group->utf8, group->utf8_len,
 							group->glyphs, group->num_glyphs,
 							group->clusters, group->num_clusters,
-							group->backward,
+							group->cluster_flags,
 							group->scaled_font);
 	break;
     }
@@ -4808,7 +4808,7 @@ _cairo_pdf_surface_show_text_glyphs (void			*abstract_surface,
 				     int			 num_glyphs,
 				     const cairo_text_cluster_t *clusters,
 				     int                         num_clusters,
-				     cairo_bool_t                backward,
+				     cairo_text_cluster_flags_t  cluster_flags,
 				     cairo_scaled_font_t	*scaled_font)
 {
     cairo_pdf_surface_t *surface = abstract_surface;
@@ -4910,7 +4910,7 @@ _cairo_pdf_surface_show_text_glyphs (void			*abstract_surface,
 							utf8, utf8_len,
 							glyphs, num_glyphs,
 							clusters, num_clusters,
-							backward,
+							cluster_flags,
 							scaled_font);
 	if (status)
 	    return status;
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 73c783e..dce4eaa 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -1325,8 +1325,8 @@ slim_hidden_def (cairo_scaled_font_glyph_extents);
  * @num_glyphs: pointer to number of glyphs
  * @clusters: pointer to array of cluster mapping information to fill, or %NULL
  * @num_clusters: pointer to number of clusters, or %NULL
- * @backward: pointer to whether the text to glyphs mapping goes backward, or
- *            %NULL
+ * @cluster_flags: pointer to location to store cluster flags corresponding to the
+ *                 output @clusters, or %NULL
  *
  * Converts UTF-8 text to an array of glyphs, optionally with cluster
  * mapping, that can be used to render later using @scaled_font.
@@ -1340,7 +1340,7 @@ slim_hidden_def (cairo_scaled_font_glyph_extents);
  * after the call, the user is responsible for freeing the allocated glyph
  * array using cairo_glyph_free().
  *
- * If @clusters is not %NULL, @num_clusters and @backward should not be %NULL,
+ * If @clusters is not %NULL, @num_clusters and @cluster_flags should not be %NULL,
  * and cluster mapping will be computed.
  * The semantics of how cluster array allocation works is similar to the glyph
  * array.  That is,
@@ -1362,21 +1362,19 @@ slim_hidden_def (cairo_scaled_font_glyph_extents);
  * int num_glyphs;
  * cairo_text_cluster_t *clusters = NULL;
  * int num_clusters;
- * cairo_bool_t backward;
+ * cairo_text_cluster_flags_t cluster_flags;
  *
  * status = cairo_scaled_font_text_to_glyphs (scaled_font,
  *                                            x, y,
  *                                            utf8, utf8_len,
  *                                            &amp;glyphs, &amp;num_glyphs,
- *                                            &amp;clusters, &amp;num_clusters,
- *                                            &amp;backward);
+ *                                            &amp;clusters, &amp;num_clusters, &amp;cluster_flags);
  *
  * if (status == CAIRO_STATUS_SUCCESS) {
  *     cairo_show_text_glyphs (cr,
  *                             utf8, utf8_len,
  *                             *glyphs, *num_glyphs,
- *                             *clusters, *num_clusters,
- *                             *backward);
+ *                             *clusters, *num_clusters, *cluster_flags);
  *
  *     cairo_glyph_free (*glyphs);
  *     cairo_text_cluster_free (*clusters);
@@ -1414,21 +1412,19 @@ slim_hidden_def (cairo_scaled_font_glyph_extents);
  * cairo_text_cluster_t stack_clusters[40];
  * cairo_text_cluster_t *clusters = stack_clusters;
  * int num_clusters = sizeof (stack_clusters) / sizeof (stack_clusters[0]);
- * cairo_bool_t backward;
+ * cairo_text_cluster_flags_t cluster_flags;
  *
  * status = cairo_scaled_font_text_to_glyphs (scaled_font,
  *                                            x, y,
  *                                            utf8, utf8_len,
  *                                            &amp;glyphs, &amp;num_glyphs,
- *                                            &amp;clusters, &amp;num_clusters,
- *                                            &amp;backward);
+ *                                            &amp;clusters, &amp;num_clusters, &amp;cluster_flags);
  *
  * if (status == CAIRO_STATUS_SUCCESS) {
  *     cairo_show_text_glyphs (cr,
  *                             utf8, utf8_len,
  *                             *glyphs, *num_glyphs,
- *                             *clusters, *num_clusters,
- *                             *backward);
+ *                             *clusters, *num_clusters, *cluster_flags);
  *
  *     if (glyphs != stack_glyphs)
  *         cairo_glyph_free (*glyphs);
@@ -1437,7 +1433,7 @@ slim_hidden_def (cairo_scaled_font_glyph_extents);
  * }
  * </programlisting></informalexample>
  *
- * For details of how @clusters, @num_clusters, and @backward map input
+ * For details of how @clusters, @num_clusters, and @cluster_flags map input
  * UTF-8 text to the output glyphs see cairo_show_text_glyphs().
  *
  * The output values can be readily passed to cairo_show_text_glyphs()
@@ -1461,7 +1457,7 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t   *scaled_font,
 				  int		        *num_glyphs,
 				  cairo_text_cluster_t **clusters,
 				  int		        *num_clusters,
-				  cairo_bool_t	        *backward)
+				  cairo_text_cluster_flags_t *cluster_flags)
 {
     int i;
     int num_chars = 0;
@@ -1488,9 +1484,9 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t   *scaled_font,
 	utf8_len = 0;
 
     /* No NULLs for non-NULLs! */
-    if ((utf8_len && utf8         == NULL) ||
-	(clusters && num_clusters == NULL) ||
-	(clusters && backward     == NULL)) {
+    if ((utf8_len && utf8          == NULL) ||
+	(clusters && num_clusters  == NULL) ||
+	(clusters && cluster_flags == NULL)) {
 	status = CAIRO_STATUS_NULL_POINTER;
 	goto BAIL;
     }
@@ -1511,12 +1507,12 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t   *scaled_font,
 	num_clusters = NULL;
     }
 
-    if (backward) {
-	*backward = FALSE;
+    if (cluster_flags) {
+	*cluster_flags = FALSE;
     }
 
-    if (!clusters && backward) {
-	backward = NULL;
+    if (!clusters && cluster_flags) {
+	cluster_flags = NULL;
     }
 
     /* Apart from that, no negatives */
@@ -1549,7 +1545,7 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t   *scaled_font,
 						       utf8, utf8_len,
 						       glyphs, num_glyphs,
 						       clusters, num_clusters,
-						       backward);
+						       cluster_flags);
 
         if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
 
@@ -1583,7 +1579,7 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t   *scaled_font,
 		    status = _cairo_validate_text_clusters (utf8, utf8_len,
 							    *glyphs, *num_glyphs,
 							    *clusters, *num_clusters,
-							    *backward);
+							    *cluster_flags);
 		}
 	    }
 
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index db920a3..ead6f1b 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2217,7 +2217,7 @@ _cairo_surface_show_text_glyphs (cairo_surface_t	    *surface,
 				 int			     num_glyphs,
 				 const cairo_text_cluster_t *clusters,
 				 int			     num_clusters,
-				 cairo_bool_t		     backward,
+				 cairo_text_cluster_flags_t  cluster_flags,
 				 cairo_scaled_font_t	    *scaled_font)
 {
     cairo_status_t status;
@@ -2272,8 +2272,7 @@ _cairo_surface_show_text_glyphs (cairo_surface_t	    *surface,
 	    status = surface->backend->show_text_glyphs (surface, op, dev_source,
 							 utf8, utf8_len,
 							 glyphs, num_glyphs,
-							 clusters, num_clusters,
-							 backward,
+							 clusters, num_clusters, cluster_flags,
 							 dev_scaled_font);
 	}
 	if (status == CAIRO_INT_STATUS_UNSUPPORTED && surface->backend->show_glyphs) {
@@ -2311,8 +2310,7 @@ _cairo_surface_show_text_glyphs (cairo_surface_t	    *surface,
 	    status = surface->backend->show_text_glyphs (surface, op, dev_source,
 							 utf8, utf8_len,
 							 glyphs, num_glyphs,
-							 clusters, num_clusters,
-							 backward,
+							 clusters, num_clusters, cluster_flags,
 							 dev_scaled_font);
 	}
     }
diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index f49943b..0f46c58 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -271,16 +271,16 @@ _cairo_user_ucs4_to_index (void	    *abstract_font,
 }
 
 static cairo_int_status_t
-_cairo_user_text_to_glyphs (void		 *abstract_font,
-			    double		  x,
-			    double		  y,
-			    const char		 *utf8,
-			    int			  utf8_len,
-			    cairo_glyph_t	**glyphs,
-			    int			  *num_glyphs,
-			    cairo_text_cluster_t **clusters,
-			    int			  *num_clusters,
-			    cairo_bool_t	  *backward)
+_cairo_user_text_to_glyphs (void		      *abstract_font,
+			    double		       x,
+			    double		       y,
+			    const char		      *utf8,
+			    int			       utf8_len,
+			    cairo_glyph_t	     **glyphs,
+			    int			       *num_glyphs,
+			    cairo_text_cluster_t      **clusters,
+			    int			       *num_clusters,
+			    cairo_text_cluster_flags_t *cluster_flags)
 {
     cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED;
 
@@ -295,8 +295,7 @@ _cairo_user_text_to_glyphs (void		 *abstract_font,
 	status = face->scaled_font_methods.text_to_glyphs (&scaled_font->base,
 							   utf8, utf8_len,
 							   glyphs, num_glyphs,
-							   clusters, num_clusters,
-							   backward);
+							   clusters, num_clusters, cluster_flags);
 
 	if (status != CAIRO_STATUS_SUCCESS)
 	    return status;
diff --git a/src/cairo.c b/src/cairo.c
index 6b919a3..399c38d 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -3077,7 +3077,7 @@ cairo_show_text (cairo_t *cr, const char *utf8)
     cairo_glyph_t *glyphs = NULL, *last_glyph;
     cairo_text_cluster_t *clusters = NULL;
     int utf8_len, num_glyphs, num_clusters;
-    cairo_bool_t backward;
+    cairo_text_cluster_flags_t cluster_flags;
     double x, y;
 
     if (cr->status)
@@ -3095,7 +3095,7 @@ cairo_show_text (cairo_t *cr, const char *utf8)
 					   utf8, utf8_len,
 					   &glyphs, &num_glyphs,
 					   cairo_has_show_text_glyphs (cr) ? &clusters : NULL, &num_clusters,
-					   &backward);
+					   &cluster_flags);
     if (status)
 	goto BAIL;
 
@@ -3106,7 +3106,7 @@ cairo_show_text (cairo_t *cr, const char *utf8)
 					     utf8, utf8_len,
 					     glyphs, num_glyphs,
 					     clusters, num_clusters,
-					     backward);
+					     cluster_flags);
     if (status)
 	goto BAIL;
 
@@ -3208,7 +3208,7 @@ slim_hidden_def (cairo_has_show_text_glyphs);
  * @num_glyphs: number of glyphs to show
  * @clusters: array of cluster mapping information
  * @num_clusters: number of clusters in the mapping
- * @backward: whether the text to glyphs mapping goes backward
+ * @cluster_flags: cluster mapping flags
  *
  * This operation has rendering effects similar to cairo_show_glyphs()
  * but, if the target surface supports it, uses the provided text and
@@ -3224,7 +3224,8 @@ slim_hidden_def (cairo_has_show_text_glyphs);
  * and @glyphs in entirety.
  *
  * The first cluster always covers bytes from the beginning of @utf8.
- * If @backward is %FALSE, the first cluster also covers the beginning
+ * If @cluster_flags do not have the %CAIRO_TEXT_CLUSTER_FLAG_BACKWARD
+ * set, the first cluster also covers the beginning
  * of @glyphs, otherwise it covers the end of the @glyphs array and
  * following clusters move backward.
  *
@@ -3240,7 +3241,7 @@ cairo_show_text_glyphs (cairo_t			   *cr,
 			int			    num_glyphs,
 			const cairo_text_cluster_t *clusters,
 			int			    num_clusters,
-			cairo_bool_t		    backward)
+			cairo_text_cluster_flags_t  cluster_flags)
 {
     cairo_status_t status;
 
@@ -3275,8 +3276,7 @@ cairo_show_text_glyphs (cairo_t			   *cr,
      * and that cluster boundaries are UTF-8 boundaries. */
     status = _cairo_validate_text_clusters (utf8, utf8_len,
 					    glyphs, num_glyphs,
-					    clusters, num_clusters,
-					    backward);
+					    clusters, num_clusters, cluster_flags);
     if (status == CAIRO_STATUS_INVALID_CLUSTERS) {
 	/* Either got invalid UTF-8 text, or cluster mapping is bad.
 	 * Differentiate those. */
@@ -3297,8 +3297,7 @@ cairo_show_text_glyphs (cairo_t			   *cr,
     status = _cairo_gstate_show_text_glyphs (cr->gstate,
 					     utf8, utf8_len,
 					     glyphs, num_glyphs,
-					     clusters, num_clusters,
-					     !!backward);
+					     clusters, num_clusters, cluster_flags);
     if (status)
 	_cairo_set_error (cr, status);
 }
diff --git a/src/cairo.h b/src/cairo.h
index a201507..ad6d5b5 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -893,6 +893,19 @@ cairo_public void
 cairo_text_cluster_free (cairo_text_cluster_t *clusters);
 
 /**
+ * cairo_text_cluster_flags_t:
+ * @CAIRO_TEXT_CLUSTER_FLAG_BACKWARD: The clusters in the cluster array
+ * map to glyphs in the glyph array from end to start.
+ *
+ * Specifies properties of a text cluster mapping.
+ *
+ * Since: 1.8
+ **/
+typedef enum _cairo_text_cluster_flags {
+    CAIRO_TEXT_CLUSTER_FLAG_BACKWARD = 0x00000001
+} cairo_text_cluster_flags_t;
+
+/**
  * cairo_text_extents_t:
  * @x_bearing: the horizontal distance from the origin to the
  *   leftmost part of the glyphs as drawn. Positive if the
@@ -1231,7 +1244,7 @@ cairo_show_text_glyphs (cairo_t			   *cr,
 			int			    num_glyphs,
 			const cairo_text_cluster_t *clusters,
 			int			    num_clusters,
-			cairo_bool_t		    backward);
+			cairo_text_cluster_flags_t  cluster_flags);
 
 cairo_public void
 cairo_text_path  (cairo_t *cr, const char *utf8);
@@ -1376,16 +1389,16 @@ cairo_scaled_font_glyph_extents (cairo_scaled_font_t   *scaled_font,
 				 cairo_text_extents_t  *extents);
 
 cairo_public cairo_status_t
-cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t   *scaled_font,
-				  double		 x,
-				  double		 y,
-				  const char	        *utf8,
-				  int		         utf8_len,
-				  cairo_glyph_t	       **glyphs,
-				  int		        *num_glyphs,
-				  cairo_text_cluster_t **clusters,
-				  int		        *num_clusters,
-				  cairo_bool_t	        *backward);
+cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t        *scaled_font,
+				  double		      x,
+				  double		      y,
+				  const char	             *utf8,
+				  int		              utf8_len,
+				  cairo_glyph_t	            **glyphs,
+				  int		             *num_glyphs,
+				  cairo_text_cluster_t      **clusters,
+				  int		             *num_clusters,
+				  cairo_text_cluster_flags_t *cluster_flags);
 
 cairo_public cairo_font_face_t *
 cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
@@ -1525,7 +1538,8 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
  * @num_glyphs: pointer to number of glyphs
  * @clusters: pointer to array of cluster mapping information to fill, or %NULL
  * @num_clusters: pointer to number of clusters
- * @backward: pointer to whether the text to glyphs mapping goes backward
+ * @cluster_flags: pointer to location to store cluster flags corresponding to the
+ *                 output @clusters
  *
  * #cairo_user_scaled_font_text_to_glyphs_func_t is the type of function which
  * is called to convert input text to an array of glyphs.  This is used by the
@@ -1551,7 +1565,7 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
  * If the value @glyphs points at has changed after the call, cairo will
  * free the allocated glyph array using cairo_glyph_free().
  *
- * If @clusters is not %NULL, @num_clusters and @backward are also non-%NULL,
+ * If @clusters is not %NULL, @num_clusters and @cluster_flags are also non-%NULL,
  * and cluster mapping should be computed.
  * The semantics of how cluster array allocation works is similar to the glyph
  * array.  That is,
@@ -1581,14 +1595,14 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
  *
  * Since: 1.8
  **/
-typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_scaled_font_t   *scaled_font,
-									const char	      *utf8,
-									int		       utf8_len,
-									cairo_glyph_t	     **glyphs,
-									int		      *num_glyphs,
-									cairo_text_cluster_t **clusters,
-									int		      *num_clusters,
-									cairo_bool_t	      *backward);
+typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_scaled_font_t        *scaled_font,
+									const char	           *utf8,
+									int		            utf8_len,
+									cairo_glyph_t	          **glyphs,
+									int		           *num_glyphs,
+									cairo_text_cluster_t      **clusters,
+									int		           *num_clusters,
+									cairo_text_cluster_flags_t *cluster_flags);
 
 /**
  * cairo_user_scaled_font_unicode_to_glyph_func_t:
diff --git a/src/cairoint.h b/src/cairoint.h
index e40a51a..1a6697d 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -431,16 +431,16 @@ struct _cairo_scaled_font_backend {
      * then just converting characters one by one.
      */
     cairo_warn cairo_int_status_t
-    (*text_to_glyphs) (void                  *scaled_font,
-		       double		      x,
-		       double		      y,
-		       const char	     *utf8,
-		       int		      utf8_len,
-		       cairo_glyph_t	    **glyphs,
-		       int		     *num_glyphs,
-		       cairo_text_cluster_t **clusters,
-		       int		     *num_clusters,
-		       cairo_bool_t	     *backward);
+    (*text_to_glyphs) (void                       *scaled_font,
+		       double		           x,
+		       double		           y,
+		       const char	          *utf8,
+		       int		           utf8_len,
+		       cairo_glyph_t	         **glyphs,
+		       int		          *num_glyphs,
+		       cairo_text_cluster_t      **clusters,
+		       int		          *num_clusters,
+		       cairo_text_cluster_flags_t *cluster_flags);
 
     unsigned long
     (*ucs4_to_index)		(void			     *scaled_font,
@@ -792,7 +792,7 @@ struct _cairo_surface_backend {
 				 int			     num_glyphs,
 				 const cairo_text_cluster_t *clusters,
 				 int			     num_clusters,
-				 cairo_bool_t		     backward,
+				 cairo_text_cluster_flags_t  cluster_flags,
 				 cairo_scaled_font_t	    *scaled_font);
 };
 
@@ -1224,16 +1224,16 @@ _cairo_gstate_set_font_face (cairo_gstate_t    *gstate,
 			     cairo_font_face_t *font_face);
 
 cairo_private cairo_status_t
-_cairo_gstate_text_to_glyphs (cairo_gstate_t	    *gstate,
-			      double		     x,
-			      double		     y,
-			      const char	    *utf8,
-			      int		     utf8_len,
-			      cairo_glyph_t	   **glyphs,
-			      int		    *num_glyphs,
-			      cairo_text_cluster_t **clusters,
-			      int		    *num_clusters,
-			      cairo_bool_t	    *backward);
+_cairo_gstate_text_to_glyphs (cairo_gstate_t	         *gstate,
+			      double		          x,
+			      double		          y,
+			      const char	         *utf8,
+			      int		          utf8_len,
+			      cairo_glyph_t	        **glyphs,
+			      int		         *num_glyphs,
+			      cairo_text_cluster_t      **clusters,
+			      int		         *num_clusters,
+			      cairo_text_cluster_flags_t *cluster_flags);
 
 cairo_private cairo_status_t
 _cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
@@ -1252,7 +1252,7 @@ _cairo_gstate_show_text_glyphs (cairo_gstate_t		   *gstate,
 				int			    num_glyphs,
 				const cairo_text_cluster_t *clusters,
 				int			    num_clusters,
-				cairo_bool_t		    backward);
+			        cairo_text_cluster_flags_t  cluster_flags);
 
 cairo_private cairo_status_t
 _cairo_gstate_glyph_path (cairo_gstate_t      *gstate,
@@ -1358,7 +1358,7 @@ _cairo_validate_text_clusters (const char		   *utf8,
 			       int			    num_glyphs,
 			       const cairo_text_cluster_t  *clusters,
 			       int			    num_clusters,
-			       cairo_bool_t		    backward);
+			       cairo_text_cluster_flags_t   cluster_flags);
 
 /* cairo-path-fixed.c */
 cairo_private void
@@ -1763,7 +1763,7 @@ _cairo_surface_show_text_glyphs (cairo_surface_t	    *surface,
 				 int			     num_glyphs,
 				 const cairo_text_cluster_t *clusters,
 				 int			     num_clusters,
-				 cairo_bool_t		     backward,
+				 cairo_text_cluster_flags_t  cluster_flags,
 				 cairo_scaled_font_t	    *scaled_font);
 
 cairo_private cairo_status_t
diff --git a/src/test-meta-surface.c b/src/test-meta-surface.c
index 4d56e1b..4d1527a 100644
--- a/src/test-meta-surface.c
+++ b/src/test-meta-surface.c
@@ -273,7 +273,7 @@ _test_meta_surface_show_text_glyphs (void		    *abstract_surface,
 				     int		     num_glyphs,
 				     const cairo_text_cluster_t *clusters,
 				     int		     num_clusters,
-				     cairo_bool_t	     backward,
+				     cairo_text_cluster_flags_t cluster_flags,
 				     cairo_scaled_font_t    *scaled_font)
 {
     test_meta_surface_t *surface = abstract_surface;
@@ -295,8 +295,7 @@ _test_meta_surface_show_text_glyphs (void		    *abstract_surface,
     status = _cairo_surface_show_text_glyphs (surface->meta, op, source,
 					      utf8, utf8_len,
 					      glyphs, num_glyphs,
-					      clusters, num_clusters,
-					      backward,
+					      clusters, num_clusters, cluster_flags,
 					      scaled_font);
     CAIRO_MUTEX_LOCK (scaled_font->mutex);
 
diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c
index 5d86986..7ae58e2 100644
--- a/src/test-paginated-surface.c
+++ b/src/test-paginated-surface.c
@@ -250,7 +250,7 @@ _test_paginated_surface_show_text_glyphs (void			    *abstract_surface,
 					  int			     num_glyphs,
 					  const cairo_text_cluster_t *clusters,
 					  int			     num_clusters,
-					  cairo_bool_t		     backward,
+					  cairo_text_cluster_flags_t cluster_flags,
 					  cairo_scaled_font_t	    *scaled_font)
 {
     test_paginated_surface_t *surface = abstract_surface;
@@ -273,8 +273,7 @@ _test_paginated_surface_show_text_glyphs (void			    *abstract_surface,
     status = _cairo_surface_show_text_glyphs (surface->target, op, source,
 					      utf8, utf8_len,
 					      glyphs, num_glyphs,
-					      clusters, num_clusters,
-					      backward,
+					      clusters, num_clusters, cluster_flags,
 					      scaled_font);
     CAIRO_MUTEX_LOCK (scaled_font->mutex);
 
commit a8cd426a4c79a7165b312f550ecc6a87b61303a3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Sep 18 00:25:02 2008 -0400

    [doc] Fix glob for doc sources

diff --git a/doc/public/Makefile.am b/doc/public/Makefile.am
index d83dd55..464cf47 100644
--- a/doc/public/Makefile.am
+++ b/doc/public/Makefile.am
@@ -14,8 +14,8 @@ SCAN_OPTIONS=--deprecated-guards="CAIRO_DISABLE_DEPRECATED" --ignore-decorators=
 DOC_SOURCE_DIR=../../src
 
 # Used for dependencies
-HFILE_GLOB=$(top_srcdir)/src/cairo-*.h
-CFILE_GLOB=$(top_srcdir)/src/cairo-*.c
+HFILE_GLOB=$(top_srcdir)/src/cairo*.h
+CFILE_GLOB=$(top_srcdir)/src/cairo*.c
 
 # Headers to ignore
 IGNORE_HFILES= \


More information about the cairo-commit mailing list