summaryrefslogtreecommitdiff
path: root/pango/pango-glyph-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pango-glyph-item.c')
-rw-r--r--pango/pango-glyph-item.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c
index 6ca256c9..0030cda8 100644
--- a/pango/pango-glyph-item.c
+++ b/pango/pango-glyph-item.c
@@ -163,6 +163,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))
@@ -182,6 +183,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++;
@@ -193,7 +195,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,
@@ -204,6 +206,7 @@ _pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter)
}
else /* RTL */
{
+ cluster = glyphs->log_clusters[glyph_index - 1];
while (TRUE)
{
glyph_index--;
@@ -215,7 +218,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,
@@ -243,6 +246,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))
@@ -263,6 +267,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--;
@@ -274,7 +279,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,
@@ -285,6 +290,7 @@ _pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter)
}
else /* RTL */
{
+ cluster = glyphs->log_clusters[glyph_index + 1];
while (TRUE)
{
glyph_index++;
@@ -296,7 +302,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,