Re: setting the font of a dialog widget



On 26/04/2008, Garth's KidStuff <garthskidstuff gmail com> wrote:
I just now got back to this problem.  Maybe I'm misunderstanding something,
but it seems that the solution you recommend is solely a solution for
Gtk::Labels -- not for general widgets.  I can change the font size for
labels -- but not for other widgets (e.g. CheckButton, RadioButton.).
That's my issue.

All of the button classes are containers with a single 'display'
widget packed inside. The display widget is usually a label, but it
can be anything (a pixmap, for example, or an hbox with a pixmap and a
couple of labels).

So to use pangomarkup to set the font size, cast the button to GtkBin
and get the child, then use gtk_label_set_markup() to set the label's
font size.

  label = gtk_bin_get_child (GTK_BIN (button))
  gtk_label_set_markup (GTK_LABEL (label), "...")

You can also set the font size from resource files. If you want to set
the size for all labels, that might be a better solution. Pangomarkup
is good if you want to mix font sizes or attributes within a single
label.

See:

http://library.gnome.org/devel/gtk/stable/gtk-Resource-Files.html

John



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