From: handa Date: Fri, 18 Nov 2005 10:46:43 +0000 (+0000) Subject: (truncate_gstring): Be sure to truncate at X-Git-Tag: REL-1-3-0~71 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d871157306ed904aedf91fa8845e2b491acb586;p=m17n%2Fm17n-lib.git (truncate_gstring): Be sure to truncate at glapheme-cluster boundary. --- diff --git a/src/draw.c b/src/draw.c index 2e5d6b8..01abd7d 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1576,9 +1576,15 @@ truncate_gstring (MFrame *frame, MText *mt, MGlyphString *gstring) pos = gstring->to; } else if (i == 0) - pos++; - compose_glyph_string (frame, mt, gstring->from, pos, gstring); - layout_glyph_string (frame, gstring); + { + g = find_glyph_in_gstring (gstring, gstring->from, 1); + pos = g->to; + } + if (pos < gstring->to) + { + compose_glyph_string (frame, mt, gstring->from, pos, gstring); + layout_glyph_string (frame, gstring); + } }