diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-08-07 22:06:15 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-08-08 03:01:16 -0400 |
commit | d9408041aa220c8a61e520de25bce9671ba4d0a9 (patch) | |
tree | ebe571aedf3b5add4c5b5199657160793da26713 /src/cairo-user-font.c | |
parent | b8fc845094e07ad2520a2c10f27c532bd3273720 (diff) | |
download | cairo-d9408041aa220c8a61e520de25bce9671ba4d0a9.tar.gz |
Add cairo_scaled_font_text_to_glyphs()
And update user-font text_to_glyphs() method to match.
Currently disable the win32-font text_to_glyphs(), until that one
is updated. Or better yet, remove it and implement ucs4_to_index().
It's the toy font API afterall.
Diffstat (limited to 'src/cairo-user-font.c')
-rw-r--r-- | src/cairo-user-font.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c index bcc3cfab7..1949269d0 100644 --- a/src/cairo-user-font.c +++ b/src/cairo-user-font.c @@ -265,12 +265,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, - cairo_glyph_t **glyphs, - int *num_glyphs) +_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_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED; @@ -280,25 +284,21 @@ _cairo_user_text_to_glyphs (void *abstract_font, if (face->scaled_font_methods.text_to_glyphs) { int i; + int orig_num_glyphs = *num_glyphs; - *glyphs = NULL; - *num_glyphs = -1; - - /* XXX currently user allocs glyphs array but cairo frees it */ status = face->scaled_font_methods.text_to_glyphs (&scaled_font->base, - utf8, glyphs, num_glyphs); + utf8, utf8_len, + glyphs, num_glyphs, + clusters, num_clusters, + backward); - if (status != CAIRO_STATUS_SUCCESS) { - status = _cairo_scaled_font_set_error (&scaled_font->base, status); - if (*glyphs) { - free (*glyphs); - *glyphs = NULL; - } + if (status != CAIRO_STATUS_SUCCESS) return status; - } - if (*num_glyphs < 0) + if (*num_glyphs < 0) { + *num_glyphs = orig_num_glyphs; return CAIRO_INT_STATUS_UNSUPPORTED; + } /* Convert from font space to user space and add x,y */ for (i = 0; i < *num_glyphs; i++) { |