#include <m17n-gui.h>
#include <m17n-misc.h>
-#define FONT_PT_SIZE 60
+#define FONT_PT_SIZE 40
gint
delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
gdImagePtr image;
int bg_color;
unsigned char *title;
- int allocated, len;
+ int title_len;
+ int allocated;
MSymbol utf8;
char *family_names = NULL;
+ gtk_init (&argc, &argv);
+
if (argc < 2)
{
fprintf (stderr, "Usage: gdkdraw LANGUAGE\n");
utf8 = msymbol ("utf-8");
allocated = nchars * 4; /* Usually this is enough. */
title = malloc (allocated);
- len = mconv_encode_buffer (utf8, mt, title, allocated);
- while (len < 0 && merror_code == MCONVERSION_RESULT_INSUFFICIENT_DST)
+ title_len = mconv_encode_buffer (utf8, mt, title, allocated);
+ while (title_len < 0 && merror_code == MCONVERSION_RESULT_INSUFFICIENT_DST)
{
allocated += allocated;
title = realloc (title, allocated);
- len = mconv_encode_buffer (utf8, mt, title, allocated);
+ title_len = mconv_encode_buffer (utf8, mt, title, allocated);
}
- if (len < 0)
+ if (title_len < 0)
{
fprintf (stderr, "Encoding of native language name failed.");
exit (1);
}
- title[len] = '\0';
+ title[title_len] = '\0';
{
MPlist *param = mplist ();
mplist_add (param, Mdevice, msymbol ("gd"));
mplist_add (param, Mface, face);
frame = mframe (param);
+ m17n_object_unref (fontset);
m17n_object_unref (face);
m17n_object_unref (param);
int array_size, num_glyphs;
MPlist *family_list;
int family_name_len;
- char *p;
memset (&control, 0, sizeof (control));
control.anti_alias = 1;
- metric.x, - metric.y,
mt, 0, mtext_len (mt), &control);
m17n_object_unref (frame);
- m17n_object_unref (mt);
if (family_list)
{
guchar *pixels, *p;
int x, y;
PangoAttrList *attr_list;
- PangoAttribute *attr_size, *attr_family;
-
- gtk_init (&argc, &argv);
+ PangoAttribute *attr_size;
attr_list = pango_attr_list_new ();
attr_size = pango_attr_size_new (FONT_PT_SIZE * PANGO_SCALE);
- attr_family = family_names ? pango_attr_family_new (family_names) : NULL;
+ attr_size->start_index = 0, attr_size->end_index = title_len;
pango_attr_list_insert (attr_list, attr_size);
- if (attr_family)
- pango_attr_list_insert (attr_list, attr_family);
+ if (family_names)
+ {
+ PangoAttribute *attr_family;
+
+ attr_family = pango_attr_family_new (family_names);
+ attr_family->start_index = 0, attr_family->end_index = title_len;
+ pango_attr_list_insert (attr_list, attr_family);
+ }
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8,
metric.width, metric.height);
box = gtk_vbox_new (FALSE, 0);
text = gtk_image_new_from_pixbuf (pixbuf);
label = gtk_label_new ((gchar *) title);
- gtk_label_set_attributes (GTK_LABEL (label), attr_list);
gtk_box_pack_start (GTK_BOX (box), text, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, FALSE, 0);
GTK_SIGNAL_FUNC (destroy), NULL);
gtk_widget_show (text);
gtk_widget_show (label);
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
gtk_widget_show (box);
gtk_widget_show (window);
gtk_main ();