Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 58338
Status: resolved
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: DJIBEL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: 804.028_502



Subject: Font, size and fontActual
Dear, I have a problem with font size. I have test this program #!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new( -background => 'white',); $mw->fontCreate('bigfont', -size => 48); my %big = $mw->fontActual('bigfont'); print %big,"\n\n"; my $size = $mw->fontActual('bigfont', -size); print $size; The result is -weightnormal-underline0-familyArial-slantroman-size-64-overstrike0 -64 The size return is not -48. Where is the problem ? I am using ActivePerl 5.10 1007 on a XP or Vista computer. Best Regards, Djibril
On 2010-06-11 13:19:36, DJIBEL wrote: Show quoted text
> Dear, > > I have a problem with font size. I have test this program > > #!/usr/bin/perl > use strict; > use warnings; > use Tk; > > my $mw = MainWindow->new( -background => 'white',); > > $mw->fontCreate('bigfont', -size => 48); > my %big = $mw->fontActual('bigfont'); > print %big,"\n\n"; > > my $size = $mw->fontActual('bigfont', -size); > print $size; > > The result is > -weightnormal-underline0-familyArial-slantroman-size-64-overstrike0 > > -64 > > > The size return is not -48. Where is the problem ? > > I am using ActivePerl 5.10 1007 on a XP or Vista computer. >
In Perl/Tk negative font sizes are pixels, and positive are points. Both are usually not the same; this depends on your monitor and window system settings. When creating a font, you can choose whether to specify the pixel size (negative) or point size (positive). When querying the size, you always get the pixel size (negative). In your case, you should probably use a negative size: $mw->fontCreate('bigfont', -size => -48); if you expect to get the same result when querying the size. Regards, Slaven
Thank you Slaven. Djibril