Re: gtk_widget_modify_font not working



On Thu, 18 Jul 2002, Sean Davey wrote:

I'm trying to do something like:

PangoFontDescription* p = pango_font_description_from_string("Sans 9");
gtk_widget_modify_font(GTK_WIDGET(next_button), p);

I've tried many combinations of font names (Helvetica, Times, etc.)
and have printed out the results of pango_context_list_families and
they all seem to be there. p is valid but the widgets are all in a
serif font of large size no matter what I do. I've tried to change
the font of buttons, notebooks, menus and menubars without success.

Any suggestions? Is there some place I can track down an error
message?

Sorry, don't know.

On a related note, is there a way to set the default font for all
widgets?

But I do know this:

void set_app_font (const char *fontname)
{
    GtkSettings *settings;

    settings = gtk_settings_get_default();
    g_object_set(G_OBJECT(settings), "gtk-font-name", fontname,
                 NULL);
}

Usage example:

   set_app_font("Sans 12");

Allin Cottrell.





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