summaryrefslogtreecommitdiff
path: root/src/cairo-gstate.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-06-26 16:15:12 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-06-26 16:20:59 -0400
commit047566fd526f7936a49b630ed47c570dd70e837f (patch)
tree21a2bb01dbb51b89b7dc1a5ec14e19880bfc77a6 /src/cairo-gstate.c
parentdff0dd0c63e530e21471531299a8f260cf88f001 (diff)
Add cairo_show_text_glyphs API
New public API: cairo_text_cluster_t cairo_has_show_text_glyphs() cairo_show_text_glyphs() Add accompanying gstate and surface functions, and surface backend methods. No backends implement them just yet.
Diffstat (limited to 'src/cairo-gstate.c')
-rw-r--r--src/cairo-gstate.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 2579de79..0eb6e7d2 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1497,10 +1497,21 @@ _cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
return cairo_scaled_font_status (gstate->scaled_font);
}
+cairo_bool_t
+_cairo_gstate_has_show_text_glyphs (cairo_gstate_t *gstate)
+{
+ return _cairo_surface_has_show_text_glyphs (gstate->target);
+}
+
cairo_status_t
-_cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
- const cairo_glyph_t *glyphs,
- int num_glyphs)
+_cairo_gstate_show_text_glyphs (cairo_gstate_t *gstate,
+ const char *utf8,
+ int utf8_len,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs,
+ const cairo_text_cluster_t *clusters,
+ int num_clusters,
+ cairo_bool_t backward)
{
cairo_status_t status;
cairo_pattern_union_t source_pattern;
@@ -1543,14 +1554,19 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
* rasterizer is something like ten times slower than freetype's for huge
* sizes. So, no win just yet. For now, do it for insanely-huge sizes,
* just to make sure we don't make anyone unhappy. When we get a really
- * fast rasterizer in cairo, we may want to readjust this. */
- if (_cairo_scaled_font_get_max_scale (gstate->scaled_font) <= 10240) {
- status = _cairo_surface_show_glyphs (gstate->target,
- gstate->op,
- &source_pattern.base,
- transformed_glyphs,
- num_glyphs,
- gstate->scaled_font);
+ * fast rasterizer in cairo, we may want to readjust this.
+ *
+ * Needless to say, do this only if show_text_glyphs is not available. */
+ if (_cairo_gstate_has_show_text_glyphs (gstate) ||
+ _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= 10240) {
+ status = _cairo_surface_show_text_glyphs (gstate->target,
+ gstate->op,
+ &source_pattern.base,
+ utf8, utf8_len,
+ transformed_glyphs, num_glyphs,
+ clusters, num_clusters,
+ backward,
+ gstate->scaled_font);
} else {
cairo_path_fixed_t path;