diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-05-16 09:32:59 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-05-16 09:32:59 -0400 |
commit | ff16b948572c1bdc301d27af41b34566d28c6610 (patch) | |
tree | 3b667bcb9bac0f02da3b20aae2d9b4fed31bbcb3 /pango/pango-layout.c | |
parent | 4587e5d2231b717dd116253a49badc1ba3aa5db5 (diff) | |
download | pango-ff16b948572c1bdc301d27af41b34566d28c6610.tar.gz |
Provide access to PangoLayout.n_chars
This lets us avoid a bunch of g_utf8_strlen() calls, when
Pango is already maintaining this information anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=650208
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 0b17ea87..5952fa85 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -1096,6 +1096,26 @@ pango_layout_get_text (PangoLayout *layout) } /** + * pango_layout_get_character_count: + * @layout: a #PangoLayout + * + * Returns the number of Unicode characters in the + * the text of @layout. + * + * Return value: the number of Unicode characters + * in the text of @layout + * + * Since: 1.30 + */ +gint +pango_layout_get_character_count (PangoLayout *layout) +{ + g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); + + return layout->n_chars; +} + +/** * pango_layout_set_markup: * @layout: a #PangoLayout * @markup: marked-up text |