# HG changeset patch # User Kenichi Handa # Date 1171970727 0 # Node ID 4a4222f7a38db8b83c609cfe5c3be5b78c00081b # Parent 429fb762384ad8e9fe72aa367b8335a5bfbee916 (x_draw_composite_glyph_string_foreground): Fix indexing into elements of s->cmp and s->char2b. diff -r 429fb762384a -r 4a4222f7a38d src/xterm.c --- a/src/xterm.c Tue Feb 20 11:02:20 2007 +0000 +++ b/src/xterm.c Tue Feb 20 11:25:27 2007 +0000 @@ -1434,7 +1434,7 @@ x_draw_composite_glyph_string_foreground (s) struct glyph_string *s; { - int i, x; + int i, j, x; /* If first glyph of S has a left box line, start drawing the text of S to the right of that box line. */ @@ -1501,34 +1501,33 @@ } else { - for (i = 0; i < s->nchars; i++) - if (COMPOSITION_GLYPH (s->cmp, s->gidx) != '\t') + for (i = 0, j = s->gidx; i < s->nchars; i++, j++) + if (COMPOSITION_GLYPH (s->cmp, j) != '\t') { - int xx = x + s->cmp->offsets[s->gidx * 2]; - int yy = y - s->cmp->offsets[s->gidx * 2 + 1]; - - font->driver->draw (s, s->gidx, s->gidx + 1, xx, yy, 0); + int xx = x + s->cmp->offsets[j * 2]; + int yy = y - s->cmp->offsets[j * 2 + 1]; + + font->driver->draw (s, j, j + 1, xx, yy, 0); if (s->face->overstrike) - font->driver->draw (s, s->gidx, s->gidx + 1, xx + 1, yy, 0); - s->gidx++; + font->driver->draw (s, j, j + 1, xx + 1, yy, 0); } } } #endif /* USE_FONT_BACKEND */ else { - for (i = 0; i < s->nchars; i++, ++s->gidx) + for (i = 0, j = s->gidx; i < s->nchars; i++, j++) if (s->face) { XDrawString16 (s->display, s->window, s->gc, - x + s->cmp->offsets[s->gidx * 2], - s->ybase - s->cmp->offsets[s->gidx * 2 + 1], - s->char2b + s->gidx, 1); + x + s->cmp->offsets[j * 2], + s->ybase - s->cmp->offsets[j * 2 + 1], + s->char2b + j, 1); if (s->face->overstrike) XDrawString16 (s->display, s->window, s->gc, - x + s->cmp->offsets[s->gidx * 2] + 1, - s->ybase - s->cmp->offsets[s->gidx * 2 + 1], - s->char2b + s->gidx, 1); + x + s->cmp->offsets[j * 2] + 1, + s->ybase - s->cmp->offsets[j * 2 + 1], + s->char2b + j, 1); } } }