From: handa Date: Wed, 18 Nov 2009 06:44:12 +0000 (+0000) Subject: (update_seq_area): Fix previous change. X-Git-Tag: REL-0-9-11~36 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c54eac96a418fcdbb410a2a7dd39d22536a62660;p=m17n%2Flibotf.git (update_seq_area): Fix previous change. --- diff --git a/example/otfview.c b/example/otfview.c index 8827481..14604ed 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -530,15 +530,19 @@ update_seq_area () XtSetValues (seq_image, arg, 1); if (gstring.used > 0) - { - char *buf = alloca (gstring.used * 5); - - sprintf (buf, "%04X", gstring.glyphs[0].glyph_id); - for (i = 1; i < gstring.used; i++) - sprintf (buf + 4 + (i - 1) * 5, " %04X", gstring.glyphs[i].glyph_id); - XtSetArg (arg[0], XtNlabel, buf); - XtSetValues (code_list, arg, 1); - } + { + int size = render_width / FONT_WIDTH; + char *buf = alloca (size + 1); + + sprintf (buf, "%04X", gstring.glyphs[0].glyph_id); + for (i = 1, x = 4; i < gstring.used; i++, x += 5) + sprintf (buf + x, " %04X", gstring.glyphs[i].glyph_id); + while (x < size) + buf[x] = ' '; + buf[x] = '\0'; + XtSetArg (arg[0], XtNlabel, buf); + XtSetValues (code_list, arg, 1); + } free (gstring.glyphs); }