Re: Notify signal font size has changed



On 08.09.2014 22:20, Torsten Schoenfeld wrote:
In principle, GtkSettings' "notify::gtk-font-name" can be used for this,
but it's not available in perl-Gtk2, only perl-Gtk3:

perl -MGtk3=-init -E'my $s = Gtk3::Settings::get_default (); say $s->get
("gtk-font-name"); $s->signal_connect ("notify::gtk-font-name", sub {
say $s->get ("gtk-font-name") }); Gtk3::main ();'

That was not entirely correct, it turns out.  While
gtk_settings_get_default is not bound in perl-Gtk2 (patches welcome),
gtk_widget_get_settings is.  So try this:

perl -MGtk2=-init -E'my $w = Gtk2::Window->new; my $s =
$w->get_settings; say $s->get ("gtk-font-name"); $s->signal_connect
("notify::gtk-font-name", sub { say $s->get ("gtk-font-name"); });
Gtk2->main ();'

To parse the font name, you can use Pango::FontDescription->from_string.


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