Re: Fw: Changing the font of an gtkbutton label

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

 



Luiz Rafael Culik Guimaraes wrote:

Dear friends
How to change the font of an button label
this is an generic piece of code i use
to change font for labels on menus and
gtklabels


        PangoFontDescription
*font_desc =
pango_font_description_from_string(prop->value.font);
        GtkRcStyle *style ;
switch( wWidget->type )
       {
           case XWT_TYPE_BUTTON:
           case XWT_TYPE_TOGGLEBUTTON:
           case XWT_TYPE_RADIOBUTTON:
           case XWT_TYPE_CHECKBOX:
   {

       GtkWidget *child =
gtk_bin_get_child(GTK_BIN(wSelf));

gtk_widget_modify_font(GTK_WIDGET(child),font_desc);
   }
break;
           case XWT_TYPE_LABEL:
       style =
gtk_widget_get_modifier_style(wMain);
               style -> font_desc =
font_desc;

gtk_widget_modify_style(GTK_WIDGET(wMain)
, style);
break;
}


For labels(GTK_LABEL) works properly,
what i'm doing wrong on this code



One of many ways will look like:

GtkWidget		*button;
PangoFontDescription	*pfd;

	button = gtk_button_new_with_label ("test");
	pfd = pango_font_description_from_string ("Sans 32");
	gtk_widget_modify_font ( GTK_WIDGET (gtk_bin_get_child (button)), pfd);
	pango_font_description_free (pfd);

I can't say what's wrong with your code, put a link to complete example which one can look/compile etc.

Olexiy


_______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux