/usr/lib/perl5/SDLx/TTF.pm is in libsdl-perl 2.540-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | package SDLx::TTF;
use strict;
use warnings;
use Carp;
use SDL;
use SDL::TTF;
use SDL::TTF::Font;
sub new
{
my ($class, $font) = @_;
my $self = {};
unless ( SDL::Config->has('SDL_ttf') ) {
Carp::cluck("SDL_ttf support has not been compiled");
}
unless ( SDL::TTF::was_init() )
{
Carp::cluck ("Cannot init TTF: " . SDL::get_error() ) unless SDL::TTF::init() == 0;
$self->{inited} = 1;
$self->{style} = {
normal => TTF_STYLE_NORMAL,
bold => TTF_STYLE_BOLD,
italic => TTF_STYLE_ITALIC,
underline => TTF_STYLE_UNDERLINE,
strikethrough => TTF_STYLE_STRIKETHROUGH
};
}
my $ttf_font;
unless ( $ttf_font = SDL::TTF::open_font($font, $size ))
{
Carp::cluck ("Cannot make a TTF font from location ($font) or size($size), due to: ". SDL::get_error );
}
$self->{ttf_font} = $ttf_font;
if ( $style && ( my $t_style = $self->{style}->{$style} ) )
{
SDL::TTF::set_font_style($ttf_font, $t_style);
}
return bless $self, $class;
}
sub DESTROY {
my $self = shift;
SDL::TTF::quit if $self->{inited};
}
1;
|