summaryrefslogtreecommitdiff
path: root/pango/glyphstring.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-07-24 19:04:47 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-07-24 19:04:47 +0000
commit4a52f3061f0b2b435f055caba1df400158a42c16 (patch)
tree00ce24d0aebb44c8169b3d7bf28f53ac5028d294 /pango/glyphstring.c
parent9ac01d78116aedd4654077a1e3f1d08b062a3c57 (diff)
downloadpango-4a52f3061f0b2b435f055caba1df400158a42c16.tar.gz
Fix up right-to-left case. (Based on patch from Damon Chaplin, #117325)
Thu Jul 24 15:02:56 2003 Owen Taylor <otaylor@redhat.com> * pango/glyphstring.c (pango_glyph_string_get_logical_widths): Fix up right-to-left case. (Based on patch from Damon Chaplin, #117325)
Diffstat (limited to 'pango/glyphstring.c')
-rw-r--r--pango/glyphstring.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index 6fad2a35..4c10f56e 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -281,17 +281,20 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
int last_cluster = 0;
int width = 0;
int last_cluster_width = 0;
- const char *p = text;
+ const char *p = text; /* Points to start of current cluster */
for (i=0; i<=glyphs->num_glyphs; i++)
{
int glyph_index = (embedding_level % 2 == 0) ? i : glyphs->num_glyphs - i - 1;
-
+
+ /* If this glyph belongs to a new cluster, or we're at the end, find
+ * the start of the next cluster, and assign the widths for this cluster.
+ */
if (i == glyphs->num_glyphs || p != text + glyphs->log_clusters[glyph_index])
{
int next_cluster = last_cluster;
- if (glyph_index > 0 && glyph_index < glyphs->num_glyphs)
+ if (i < glyphs->num_glyphs)
{
while (p < text + glyphs->log_clusters[glyph_index])
{
@@ -316,7 +319,7 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
}
if (i < glyphs->num_glyphs)
- width += glyphs->glyphs[i].geometry.width;
+ width += glyphs->glyphs[glyph_index].geometry.width;
}
}