Re: Changing fonts in Glade



I dont use glade much, but I assume that it does not do any style
modifications for you...here is some code to get you on your way:

static void
gtk_label_set_font(GtkWidget *label, const gchar *font)
{
    GtkFont *old_font;
    GtkStyle *old_style;
    GtkStyle *style;
    old_style = gtk_widget_get_style(label);
    style = gtk_style_copy(old_style);
    old_font = style->font;
    style->font = gdk_font_new(font);
    if(style->font)
    {
        gdk_font_ref(style->font);
        gdk_font_unref(old_font);
    }
    else
    {
       style->font = old_font;
    }
    gtk_widget_set_style(widget, style);
}

No guarantees as to the perfection of this code...its all dont on the
fly, but I've written similar stuff before and it looks pretty sane.

Later,
Chris

On 27 Aug 2001 09:54:41 -0400, Flavio Alberto Lopes Soares wrote:
> There's some way to change fonts for Label Widget (for example) and
> other widgets direct in Glade and generate the correct code when I build
> the project or the only way is adding code in C code generated ?
> 
> Thankx
> 
> flavio
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
--

http://glimmer.sourceforge.net - My pet project
http://uberhackers.dhs.org - My personal website

./configure --prefix=/dev/mocha --enable-caffeine





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]