On Tue, 2012-11-06 at 18:09 +0100, Yann Leydier wrote:
> Hullo,
> 
> I'm trying to change the font (face and style) in a custom object 
> derived from Entry.
> 
> I use the following code:
>       Pango::FontDescription 
> fd(get_layout()->get_context()->get_font_description());
>       if (word.HasSerif())
>               fd.set_family("times");
>       else
>               fd.set_family("arial");
>       if (word.IsItalics())
>               fd.set_style(Pango::STYLE_ITALIC);
>       else
>               fd.set_style(Pango::STYLE_NORMAL);
>       get_layout()->get_context()->set_font_description(fd);
> 
> 
> This seems to need the widget to be associated to a fully functionnal 
> GdkWidow, so rather than putting this code in the constructor, I 
> connected it to a signal.
> 
> I tried map and map-event but it did not work. I thought that these 
> signals where emitted when (resp.) asking to associate and associating 
> the widget to a GdkWindow…
> 
> I also tried expose-event, which is supposed to be emitted when the 
> widget is rendered, and it changes the font only when the edit gets the 
> focus! O_O
> 
> Do you have any insight on the matter, please?

You can use the Gtk::Widget::signal_realize().  When it is emitted, the
Gdk::Window associated with the widget should be fully functional.

> 
> yann
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/gtkmm-list

-- 
José

_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to