Subject: | font regression: asking for bold causes size to be ignored |
In older versions of Perl/Tk, a font could be specified like this, and
it would work:
-font=>[-size=>'32',-weight=>'bold']
In this version, the fonts seem to have been upgraded to look much
better (yay!), but along the way there seems to have been a regression,
because including the -weight parameter causes the -size parameter to be
ignored in many cases. I'm guessing that what's happening is that if
Perl/Tk can't find a font with both the required size *and* the required
weight, it ignores both the size and the weight. This will break lots of
preexisting code.
The code sample attached demonstrates the bug on my system; the label
that's supposed to be 32-point bold is actually displayed in a smaller
font, not 32 point. Reproducing this bug may depend on what fonts you
have installed on your system.
$ perl --version
This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$ uname -a
Linux rintintin 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008
x86_64 GNU/Linux
Subject: | font_bug.pl |
#!/usr/local/bin/perl
use Tk;
# Main Window
my $mw = new MainWindow;
my $label = $mw -> Label(-text=>"32-point bold",-font=>[-weight=>'bold']) -> pack();
my $label = $mw -> Label(-text=>"32-point, no bold",-font=>[-size=>'32']) -> pack();
my $button = $mw -> Button(-text => "Quit",
-command => sub { exit })
-> pack();
MainLoop;