| 1 | package PDF::Make::Font; | ||||||||||||||||||||
| 2 | 59 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 59 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 59 | our $VERSION = '0.15'; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # Load the XS via PDF::Make | ||||||||||||||||||||
| 8 | 59 | require PDF::Make; | |||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | # Font types | ||||||||||||||||||||
| 11 | 59 | ▶ | use constant { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 59 | TYPE_TYPE1 => 0, | |||||||||||||||||||
| 13 | TYPE_TRUETYPE => 1, | ||||||||||||||||||||
| 14 | TYPE_CID_TRUETYPE => 2, | ||||||||||||||||||||
| 15 | 59 | }; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | # Standard 14 font names | ||||||||||||||||||||
| 18 | 59 | our @STD14_NAMES = qw( | |||||||||||||||||||
| 19 | Helvetica | ||||||||||||||||||||
| 20 | Helvetica-Bold | ||||||||||||||||||||
| 21 | Helvetica-Oblique | ||||||||||||||||||||
| 22 | Helvetica-BoldOblique | ||||||||||||||||||||
| 23 | Times-Roman | ||||||||||||||||||||
| 24 | Times-Bold | ||||||||||||||||||||
| 25 | Times-Italic | ||||||||||||||||||||
| 26 | Times-BoldItalic | ||||||||||||||||||||
| 27 | Courier | ||||||||||||||||||||
| 28 | Courier-Bold | ||||||||||||||||||||
| 29 | Courier-Oblique | ||||||||||||||||||||
| 30 | Courier-BoldOblique | ||||||||||||||||||||
| 31 | Symbol | ||||||||||||||||||||
| 32 | ZapfDingbats | ||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 22 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.8
Pod
documented
| |||||||||||||||||||||
| 36 | 22 | my ($class, %opts) = @_; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 22 | ▶ | if (my $file = $opts{file}) { | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 39 | 0 | return $class->from_file($file, $opts{arena}); | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | elsif (my $bytes = $opts{bytes}) { | ||||||||||||||||||||
| 42 | 0 | return $class->from_bytes($bytes, $opts{arena}); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | ▶ | elsif (my $std14 = $opts{standard14} // $opts{std14}) { | |||||||||||||||||||
|
Condition100%3/3
$opts{"standard14"} // $opts{"std14"}
MC/DC100%2/2
$opts{"standard14"} // $opts{"std14"}
$opts{"standard14"}
$opts{"std14"}
Truth table100%3/3
A // B
A= $opts{"standard14"}B= $opts{"std14"}
| |||||||||||||||||||||
| 45 | 19 | return $class->standard14($std14, $opts{arena}); | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | else { | ||||||||||||||||||||
| 48 | 3 | require Carp; | |||||||||||||||||||
| 49 | 3 | Carp::croak("PDF::Make::Font: must specify file, bytes, or standard14"); | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 6 | ▶ | sub is_standard14 { | ||||||||||||||||||
|
Subroutine
is_standard14: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 54 | 6 | my $self = shift; | |||||||||||||||||||
| 55 | 6 | return $self->type == TYPE_TYPE1; | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 4 | ▶ | sub is_truetype { | ||||||||||||||||||
|
Subroutine
is_truetype: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||
| 59 | 4 | my $self = shift; | |||||||||||||||||||
| 60 | 4 | ▶ | return $self->type == TYPE_TRUETYPE || $self->type == TYPE_CID_TRUETYPE; | ||||||||||||||||||
|
Condition33%1/3
$self->type == 1 || $self->type == 2
MC/DC0%0/2
$self->type == 1 || $self->type == 2
$self->type == 1
$self->type == 2
Truth table33%1/3
A || B
A= $self->type == 1B= $self->type == 2
| |||||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 59 | 1; | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||