[Glade-users] Changing Text Size

Tomi Manninen oh2bns@sral.fi
10 Jul 2003 21:05:01 +0300


On Tue, 2003-07-01 at 20:42, Ishan Chattopadhyaya wrote:

> void
> apply_font_to_widget (GtkWidget *widget, gchar *fload)
> {
>     GtkStyle *style = gtk_style_new();
>     gdk_font_unref(style->font);
>     style->font = gdk_font_load(fload);
>     gtk_widget_set_style(GTK_WIDGET(widget), style);
> }

GdkFont etc. are deprecated in GTK+ 2 so I think this
would be more appropriate:

void apply_font_to_widget(GtkWidget *widget, gchar *font)
{
        PangoFontDescription *fontdesc;

        fontdesc = pango_font_description_from_string(font);
        gtk_widget_modify_font(widget, fontdesc);
        pango_font_description_free(fontdesc);
}

-- 
Tomi Manninen           Internet:  oh2bns@sral.fi
OH2BNS                  AX.25:     oh2bns@oh2rbi.fin.eu
KP20ME04                Amprnet:   oh2bns@oh2rbi.ampr.org