(update_seq_area): Fix previous change.
authorhanda <handa>
Wed, 18 Nov 2009 06:44:12 +0000 (06:44 +0000)
committerhanda <handa>
Wed, 18 Nov 2009 06:44:12 +0000 (06:44 +0000)
example/otfview.c

index 8827481..14604ed 100644 (file)
@@ -530,15 +530,19 @@ update_seq_area ()
   XtSetValues (seq_image, arg, 1);
 
   if (gstring.used > 0)
   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);
 }
 
   free (gstring.glyphs);
 }