1
#!/usr/local/bin/perl -w
5
use Tk::widgets qw(BrowseEntry Text Spinbox);
6
my %fopt = (-family => 'fixed', -weight => 'medium',
7
-slant => 'roman', -size => 12);
8
my $mw = MainWindow->new();
9
my $font = $mw->Font(%fopt);
10
my $family = $mw->BrowseEntry(-variable => \$fopt{-family},
11
-options => [sort $mw->fontFamilies()],
12
-command => [\&SetFont,$font,\%fopt]);
13
my $size = $mw->Spinbox(-width => 3, -textvariable => \$fopt{-size},
14
-from => 6, -to => 72,
15
-command => [\&SetFont,$font,\%fopt]);
16
my $weight = $mw->Optionmenu(-width => 3, -variable => \$fopt{-weight},
17
-options => [qw(medium bold)],
18
-command => [\&SetFont,$font,\%fopt]);
20
Tk::grid($mw->Label(-text => 'Family:',-justify => 'right'), $family,
21
$mw->Label(-text => 'Size:',-justify => 'right'), $size,
22
$mw->Label(-text => 'Weight:',-justify => 'right'), $weight,
26
my $text = $mw->Scrolled(Text => -font => $font, -width => 40, -height => 20)->grid(-sticky => 'nsew', -columnspan => 6);
29
for my $ch (0x20..0x7E,0xa0..0xff)
34
$text->insert(end => "$l\n");
39
#$text->insert('end',<<"END");
48
my ($font,$fopt) = @_;
51
$font->configure(%$fopt);
53
print "$$font @opt\n";