From 4d871157306ed904aedf91fa8845e2b491acb586 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 18 Nov 2005 10:46:43 +0000 Subject: [PATCH] (truncate_gstring): Be sure to truncate at glapheme-cluster boundary. --- src/draw.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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); + } } -- 1.7.10.4