Re: Setting Font Faces and Sizes
- From: rahed <raherh gmail com>
- To: gtk-perl-list gnome org
- Subject: Re: Setting Font Faces and Sizes
- Date: Sat, 06 Jan 2007 18:06:10 +0100
muppet <scott asofyet org> writes:
It looks like you actually got a copy of the font description from
Gtk2::Style::font_desc, which means your changes aren't happening to
the object in place. Odd. Try using modify_font(), instead:
#!/usr/bin/perl -w
use Gtk2 -init;
my $window = Gtk2::Window->new;
$window->ensure_style;
my $fontdesc = $window->get_style->font_desc;
dumpit ("before", $fontdesc, $window);
$fontdesc->set_weight ("bold");
dumpit ("after1", $fontdesc, $window);
$window->modify_font ($fontdesc);
dumpit ("after2", $fontdesc, $window);
sub dumpit {
my ($label, $fontdesc, $widget) = @_;
printf "%10s: %s %10s %s %10s\n",
$label, $fontdesc, $fontdesc->get_weight,
$widget->get_style->font_desc,
$widget->get_style->font_desc->get_weight;
}
__END__
Thank you, applying modify_font on changed font description makes it
permanent.
--
Radek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]