View Full Version : How to change Gtk::Label font?
mdurham
December 4th, 2005, 05:37 AM
Hi each,
I'm using gtkmm (well, trying to!)
Any advice on how to change the font type & size and bg colour of a Gtk::Label or/and Gtk::Entry?
I can't find an example anywhere.
TIA Mike
nagilum
December 4th, 2005, 12:47 PM
Though I don't have an example for gtkmm here's one in plain C. The font of any GtkWidget can be modified like this.
GtkWidget *label;
label = gtk_label_new ("hello world");
gtk_widget_modify_font (label,
pango_font_description_from_string ("Monospace 10")
);
Roptaty
December 4th, 2005, 01:14 PM
You can also use Pangos markup language
Gtk::Label lab;
lab.set_markup("<span background=\"black\" foreground=\"red\">Gin and Tonic</span>");
mdurham
December 4th, 2005, 08:14 PM
Thanks guys that's a great help.
Mike
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.