diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2007-01-16 13:16:32 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2007-01-16 13:16:32 +0000 |
commit | 9028047d34e7c856947556d9b0cef900aae731c2 (patch) | |
tree | f2c8109b76c2d44b3e01ee8d03c0f4fe6f16c1d6 /pango/pango-glyph-item.c | |
parent | 8c5c6f6259b17cf63859d26b28ab22eedfee7e86 (diff) | |
download | pango-9028047d34e7c856947556d9b0cef900aae731c2.tar.gz |
Fix width calculation. Was causing ellipsization to stop at a zero-width
2007-01-16 Behdad Esfahbod <behdad@gnome.org>
* pango/ellipsize.c (get_cluster_width): Fix width calculation.
Was causing ellipsization to stop at a zero-width glyph that was
part of a bigger cluster.
* pango/ellipsize.c (remove_one_span): Skip over zero-width clusters,
otherwise ellipsization will stop at a zero-width cluster.
* pango/pango-glyph-item.c (_pango_glyph_item_iter_next_cluster),
(_pango_glyph_item_iter_prev_cluster): Fix yet another bug with
in prev_cluster that was making it not work for any interesting
cluster.
svn path=/trunk/; revision=2158
Diffstat (limited to 'pango/pango-glyph-item.c')
-rw-r--r-- | pango/pango-glyph-item.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c index b33e7c4b..b42e0411 100644 --- a/pango/pango-glyph-item.c +++ b/pango/pango-glyph-item.c @@ -162,6 +162,7 @@ _pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) { int glyph_index = iter->end_glyph; PangoGlyphString *glyphs = iter->glyph_item->glyphs; + int cluster; PangoItem *item = iter->glyph_item->item; if (LTR (iter->glyph_item)) @@ -181,6 +182,7 @@ _pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) if (LTR (iter->glyph_item)) { + cluster = glyphs->log_clusters[glyph_index + 1]; while (TRUE) { glyph_index++; @@ -192,7 +194,7 @@ _pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) break; } - if (item->offset + glyphs->log_clusters[glyph_index] != iter->start_index) + if (glyphs->log_clusters[glyph_index] != cluster) { iter->end_index = item->offset + glyphs->log_clusters[glyph_index]; iter->end_char += g_utf8_strlen (iter->text + iter->start_index, @@ -203,6 +205,7 @@ _pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) } else /* RTL */ { + cluster = glyphs->log_clusters[glyph_index - 1]; while (TRUE) { glyph_index--; @@ -214,7 +217,7 @@ _pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter) break; } - if (item->offset + glyphs->log_clusters[glyph_index] != iter->start_index) + if (glyphs->log_clusters[glyph_index] != cluster) { iter->end_index = item->offset + glyphs->log_clusters[glyph_index]; iter->end_char += g_utf8_strlen (iter->text + iter->start_index, @@ -242,6 +245,7 @@ _pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) { int glyph_index = iter->start_glyph; PangoGlyphString *glyphs = iter->glyph_item->glyphs; + int cluster; PangoItem *item = iter->glyph_item->item; if (LTR (iter->glyph_item)) @@ -262,6 +266,7 @@ _pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) if (LTR (iter->glyph_item)) { + cluster = glyphs->log_clusters[glyph_index - 1]; while (TRUE) { glyph_index--; @@ -273,7 +278,7 @@ _pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) break; } - if (item->offset + glyphs->log_clusters[glyph_index] != iter->end_index) + if (glyphs->log_clusters[glyph_index] != cluster) { iter->start_index = item->offset + glyphs->log_clusters[glyph_index]; iter->start_char -= g_utf8_strlen (iter->text + iter->start_index, @@ -284,6 +289,7 @@ _pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) } else /* RTL */ { + cluster = glyphs->log_clusters[glyph_index + 1]; while (TRUE) { glyph_index++; @@ -295,7 +301,7 @@ _pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) break; } - if (item->offset + glyphs->log_clusters[glyph_index] != iter->start_index) + if (glyphs->log_clusters[glyph_index] != cluster) { iter->start_index = item->offset + glyphs->log_clusters[glyph_index]; iter->start_char -= g_utf8_strlen (iter->text + iter->start_index, |