From c54eac96a418fcdbb410a2a7dd39d22536a62660 Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 18 Nov 2009 06:44:12 +0000 Subject: [PATCH] (update_seq_area): Fix previous change. --- example/otfview.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) 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); } -- 1.7.10.4