Subject: | PATCH for fonts on Solaris |
Attached is a patch that "fixes" the font face and sizes on Solaris. There is no "verdana" font on Solaris, and/or size 8 is WAY too small. The patch also makes it easy to change the default font family and size, and easy for any subclass to override it.
diff -c /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm.orig /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm
*** /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm.orig Fri Jun 27 02:57:44 2003
--- /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm Tue Feb 1 14:33:27 2005
***************
*** 225,230 ****
--- 225,232 ----
=cut
sub Populate { my ($cw, $args) = @_;
+ my $sFontFamily = &_font_family();
+ my $iFontSize = &_font_size();
$cw->SUPER::Populate($args);
$cw->ConfigSpecs(
# ? -title => ['SELF','title','Title','Generic Wizard'],
***************
*** 311,317 ****
# Tag text
$args->{-tag_text} = "Perl Wizard" unless exists $args->{-tag_text};
$args->{-tag_width} = 80 unless exists $args->{-tag_width};
! $cw->fontCreate(qw/TAG -family verdana -size 8 -weight bold/);
$cw->{tagtext} = $tagbox->Canvas(
-relief => 'flat',
-border => 1,
--- 313,323 ----
# Tag text
$args->{-tag_text} = "Perl Wizard" unless exists $args->{-tag_text};
$args->{-tag_width} = 80 unless exists $args->{-tag_width};
! $cw->fontCreate('TAG',
! -family => $sFontFamily,
! -size => $iFontSize,
! -weight => 'bold',
! );
$cw->{tagtext} = $tagbox->Canvas(
-relief => 'flat',
-border => 1,
***************
*** 339,358 ****
$cw->{desktop_dir} = "$ENV{HOME}/.gnome-desktop";
}
# Font used for &blank_frame titles
! $cw->fontCreate(qw/TITLE_FONT -family verdana -size 12 -weight bold/);
# Font used in multiple choices for radio title
! $cw->fontCreate(qw/RADIO_BOLD -family verdana -size 8 -weight demi/);
# Fonts used if -style=>"top"
! $cw->fontCreate(qw/TITLE_FONT_TOP -family verdana -size 8 -weight bold/);
! $cw->fontCreate(qw/SUBTITLE_FONT -family verdana -size 8 /);
# Font used in licence agreement XXX REMOVE TO CORRECT MODULE
! $cw->fontCreate(qw/SMALL_FONT -family verdana -size 8 /);
# Font used in all other places
! $cw->fontCreate(qw/DEFAULT_FONT -family verdana -size 8 /);
$cw->{defaultFont} = 'DEFAULT_FONT';
}
sub background { my ($self,$operand)=(shift,shift);
if (defined $operand){
$self->{background} = $operand;
--- 345,379 ----
$cw->{desktop_dir} = "$ENV{HOME}/.gnome-desktop";
}
# Font used for &blank_frame titles
! $cw->fontCreate('TITLE_FONT', -family => $sFontFamily, -size => $iFontSize*1.5, -weight => 'bold');
# Font used in multiple choices for radio title
! $cw->fontCreate('RADIO_BOLD', -family => $sFontFamily, -size => $iFontSize, -weight => 'demi');
# Fonts used if -style=>"top"
! $cw->fontCreate('TITLE_FONT_TOP', -family => $sFontFamily, -size => $iFontSize, -weight => 'bold');
! $cw->fontCreate('SUBTITLE_FONT', -family => $sFontFamily, -size => $iFontSize);
# Font used in licence agreement XXX REMOVE TO CORRECT MODULE
! $cw->fontCreate('SMALL_FONT', -family => $sFontFamily, -size => $iFontSize);
# Font used in all other places
! $cw->fontCreate('DEFAULT_FONT', -family => $sFontFamily, -size => $iFontSize);
$cw->{defaultFont} = 'DEFAULT_FONT';
}
+ # Private method: returns a font family name suitable for the operating system.
+ sub _font_family
+ {
+ return 'verdana' if ($^O =~ m!win32!i);
+ return 'helvetica' if ($^O =~ m!solaris!i);
+ return 'helvetica';
+ } # _font_family
+ # Private method: returns a font size suitable for the operating system.
+ sub _font_size
+ {
+ return 8 if ($^O =~ m!win32!i);
+ return 12 if ($^O =~ m!solaris!i);
+ return 10;
+ } # _font_family
+
sub background { my ($self,$operand)=(shift,shift);
if (defined $operand){
$self->{background} = $operand;