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
|
use Test::More;
use Test::Exception;
use strict;
use warnings;
use PDF::API2;
my $pdf = PDF::API2->new();
foreach my $font (qw(bankgothic courier courierbold courierboldoblique
courieroblique georgia georgiabold georgiabolditalic
georgiaitalic helvetica helveticabold helveticaboldoblique
helveticaoblique symbol timesbold timesbolditalic
timesitalic timesroman trebuchet trebuchetbold
trebuchetbolditalic trebuchetitalic verdana verdanabold
verdanabolditalic verdanaitalic webdings wingdings
zapfdingbats)) {
lives_ok(sub { $pdf->corefont($font) }, "Load font $font");
}
ok($pdf->is_standard_font('Helvetica'),
q{Helvetica is a standard font});
ok(!$pdf->is_standard_font('Comic Sans'),
q{Comic Sans is not a standard font});
require PDF::API2::Resource::Font::CoreFont;
my @names = PDF::API2::Resource::Font::CoreFont->names();
is(scalar(@names), 14,
q{names() returns 14 elements in array context});
my $arrayref = PDF::API2::Resource::Font::CoreFont->names();
is(ref($arrayref), 'ARRAY',
q{names() returns an array reference in scalar context});
is(scalar(@$arrayref), 14,
q{The array reference contains 14 elements});
@names = $pdf->standard_fonts();
is(scalar(@names), 14,
q{$pdf->standard_fonts() returns an array with 14 elements});
foreach my $name (@names) {
ok(PDF::API2::Resource::Font::CoreFont->is_standard($name),
qq{$name is a core font});
}
done_testing();
|