Using gtkmm 3.0 with c++, in a Gtk::Window
, I have a Gtk::Label
named "bezeichnung" showing text.
How can I change the font of this label?
There seems to be no function to set the font for a Gtk::Label
. To deal with functions of the general Gtk::Widget
from which Gtk::Label
derives is difficult to understand, since it uses Pango. This is my code so far:
Pango::FontDescription font;
font.set_family("Monospace");
font.set_weight(Pango::WEIGHT_ULTRABOLD);
font.set_size(14 * PANGO_SCALE);
bezeichnung = Gtk::Label("leer");
bezeichnung.set_halign(Gtk::ALIGN_CENTER);
auto context = bezeichnung.create_pango_context();
context->set_font_description(font);
The font does not change. How can I set the changed Pango context back to the label?