summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/public/cairo-sections.txt1
-rw-r--r--doc/public/tmpl/cairo-scaled-font.sgml2
-rw-r--r--doc/public/tmpl/cairo-text.sgml9
-rw-r--r--doc/public/tmpl/cairo-user-fonts.sgml2
-rw-r--r--src/cairo-analysis-surface.c5
-rw-r--r--src/cairo-gstate.c26
-rw-r--r--src/cairo-meta-surface-private.h2
-rw-r--r--src/cairo-meta-surface.c6
-rw-r--r--src/cairo-misc.c4
-rw-r--r--src/cairo-paginated-surface.c4
-rw-r--r--src/cairo-pdf-operators-private.h2
-rw-r--r--src/cairo-pdf-operators.c14
-rw-r--r--src/cairo-pdf-surface-private.h2
-rw-r--r--src/cairo-pdf-surface.c6
-rw-r--r--src/cairo-scaled-font.c44
-rw-r--r--src/cairo-surface.c8
-rw-r--r--src/cairo-user-font.c23
-rw-r--r--src/cairo.c19
-rw-r--r--src/cairo.h56
-rw-r--r--src/cairoint.h48
-rw-r--r--src/test-meta-surface.c5
-rw-r--r--src/test-paginated-surface.c5
22 files changed, 152 insertions, 141 deletions
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 160de465..c179e922 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 1abf0f3b..0a0599a5 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:
-@backward:
+@cluster_flags:
@Returns:
diff --git a/doc/public/tmpl/cairo-text.sgml b/doc/public/tmpl/cairo-text.sgml
index 0883f270..64c63dae 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>
+
+@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:
-@backward:
+@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 c8f35346..5b6dc582 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:
-@backward:
+@cluster_flags:
@Returns:
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index c9f3e853..abed1235 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 29807709..7c80d09a 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 bd16a5be..9a1b169c 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 d939efea..77503d59 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 b927c941..27050a24 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 2640a8bf..5b1a08f7 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 a85839bb..7ff843b1 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 435503ca..0b6c00e5 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 a2962f84..ab222ded 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 f72f8299..f6f8679e 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 73c783e8..dce4eaab 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 db920a35..ead6f1ba 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 f49943b6..0f46c58e 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 6b919a32..399c38d2 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 a2015076..ad6d5b5c 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 e40a51ad..1a6697db 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 4d56e1b7..4d1527aa 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 5d86986c..7ae58e21 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);