I'm using 2.0.5
Attached is a sample script to replicate the behavior. Note that the
first font shown displays the vertical alignment, while the second,
being fixed height, does not. Both are pcf fonts that should be with
your X11 install.
On Sun, 7 Mar 2004, chromatic wrote:
>On Sun, 2004-03-07 at 11:47, Rob Spearman wrote:
>
>Hi Rob,
>
>> I found a bug with displaying pcf type fonts. The glyphs are printing
>> vertically aligned, which looks quite odd.
>>
>> I could be wrong, but it seems like someone would have caught this if it
>> was a freetype bug.
>>
>> I've been testing with the many pcf fonts that come with X11, such as
>>
>> /usr/X11R6/lib/X11/fonts/75dpi/helvO24-ISO8859-1.pcf.gz
>
>Which version of SDL Perl are you using? Can you send along a short
>test program, perhaps a variant of test/testfonttool.pl?
>
>-- c
>
--
Rob Spearman
President
=======================================================================
Digitalis Education Solutions tel 360.616.8915
P.O. Box 2976 fax 360.616.8917
Bremerton, WA 98310 http://digitaliseducation.com
=======================================================================
#!/usr/bin/env perl
use strict;
use SDL;
use SDL::App;
use SDL::Event;
use SDL::Tool::Font;
use SDL::Color;
my (%options,$app,$mode);
die "usage: $0 [-hw] [-fullscreen] [-width 640] [-height 480] [-bpp 24]\n"
if ( SDL::in ($ARGV[0], qw/ -h -? --help/ ));
chdir 'test' if -d 'test';
die "$0 must be run in the SDL_perl/test/ directory!"
unless (-d 'data');
for ( 0 .. @ARGV-1 )
{
$options{$ARGV[$_]} = $ARGV[$_ + 1] || 1;
}
$options{-flags} = SDL_SWSURFACE;
$options{-flags} |= SDL_HWPALETTE if ( $options{-hw} );
$options{-flags} |= SDL_FULLSCREEN if ( $options{-fullscreen} );
$options{-title} = $0;
$options{-width} ||= 800;
$options{-height} ||= 600;
$options{-depth} ||= $options{-bpp} || 24;
$app = new SDL::App %options;
my %ttfonts = (
'/usr/X11R6/lib/X11/fonts/misc/10x20-ISO8859-1.pcf.gz' => 0,
'/usr/X11R6/lib/X11/fonts/75dpi/helvR24-ISO8859-1.pcf.gz' => 0
);
my %sfonts = (
'24P_Arial_NeonYellow.png' => 0,
'24P_Copperplate_Blue.png' => 0,
);
my @fonts;
for ( reverse keys %ttfonts ) {
for $mode ( qw/ -normal -bold -italic -underline / ) {
if (-e "$_") {
print STDERR "Loading $_\n";
$ttfonts{"$_$mode"} = new SDL::Tool::Font
$mode => 1,
-ttfont => "$_",
-size => 20,
-fg => $SDL::Color::black,
-bg => $SDL::Color::black;
push @fonts, $ttfonts{"$_$mode"};
}
}
}
%ttfonts = reverse %ttfonts;
for ( reverse keys %sfonts) {
if (-e "data/$_") {
print STDERR "Loading $_\n";
$sfonts{$_} = new SDL::Tool::Font -sfont => "data/$_";
push @fonts, $sfonts{$_};
}
}
%sfonts = reverse %sfonts;
sub DrawFonts {
$app->fill(0,$SDL::Color::white);
my ($x,$y) = @_;
for my $font ( @fonts) {
$font->print($app,$x,$y,"SDLperl font test. ",
"This is " . ($ttfonts{$font} || $sfonts{$font}));
$y += 40;
}
$app->flip();
}
DrawFonts(10,10);
$app->loop( {
SDL_KEYDOWN() => sub {
my ($event) = @_;
$app->warp($options{-width}/2,$options{-height}/2) if
($event->key_sym() == SDLK_SPACE);
$app->fullscreen() if ($event->key_sym() == SDLK_f);
exit(0) if ($event->key_sym() == SDLK_ESCAPE);
},
SDL_QUIT() => sub { exit(0); }
} );