summaryrefslogtreecommitdiff
path: root/pango/glyphstring.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-07-15 13:59:20 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-07-15 14:00:31 -0400
commit67052645e6afcd7f72ef852c99ee88897d2022da (patch)
tree90ae6efbad01f32febc2fea57c8b1dd1005a6fdc /pango/glyphstring.c
parent4d6f980b9f67e7e969e6f5afeb6f216c0a99e6f4 (diff)
downloadpango-67052645e6afcd7f72ef852c99ee88897d2022da.tar.gz
Handle NUL in text in places that g_utf8_strlen () was used
While pango-layout doesn't allow NUL in text, the lower level API should handle it correctly. We were using g_utf8_strlen() in a number of places. This is problematic since that function stops processing at NUL even if length>1. We now use an internal pango_utf8_strlen() instead. Inspired by: Bug 588678 – pango crash: install a new theme from gnome-appearance-properties
Diffstat (limited to 'pango/glyphstring.c')
-rw-r--r--pango/glyphstring.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index 2e3a9f80..9e7c5f85 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -320,7 +320,9 @@ pango_glyph_string_get_width (PangoGlyphString *glyphs)
* @text: the text corresponding to the glyphs
* @length: the length of @text, in bytes
* @embedding_level: the embedding level of the string
- * @logical_widths: an array whose length is g_utf8_strlen (text, length)
+ * @logical_widths: an array whose length is the number of characters in
+ * text (equal to g_utf8_strlen (text, length) unless
+ * text has NUL bytes)
* to be filled in with the resulting character widths.
*
* Given a #PangoGlyphString resulting from pango_shape() and the corresponding
@@ -337,7 +339,7 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
{
/* Build a PangoGlyphItem so we can use PangoGlyphItemIter.
* This API should have been made to take a PangoGlyphItem... */
- PangoItem item = {0, length, g_utf8_strlen (text, length),
+ PangoItem item = {0, length, pango_utf8_strlen (text, length),
{NULL, NULL, NULL,
embedding_level, PANGO_GRAVITY_AUTO, 0,
PANGO_SCRIPT_UNKNOWN, NULL,