line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Khonsu::Font; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
34
|
use parent 'Khonsu::Ra'; |
|
5
|
|
|
|
|
37
|
|
|
5
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub attributes { |
6
|
402
|
|
|
402
|
0
|
619
|
my $a = shift; |
7
|
|
|
|
|
|
|
return ( |
8
|
402
|
|
|
402
|
|
1421
|
colour => {$a->RW, $a->STR, default => sub { '#000' }}, |
9
|
402
|
|
|
402
|
|
898
|
size => {$a->RW, $a->NUM, default => sub { 9 }}, |
10
|
402
|
|
|
402
|
|
988
|
family => {$a->RW, $a->STR, default => sub { 'Times' }}, |
11
|
|
|
|
|
|
|
loaded => {$a->RW, $a->DHR}, |
12
|
402
|
|
|
402
|
|
1955
|
line_height => {$a->RW, $a->NUM, default => sub { $_[0]->size }}, |
13
|
402
|
|
|
|
|
9880
|
); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub load { |
17
|
1094
|
|
|
1094
|
0
|
2509
|
my ($self, $file, %attributes) = @_; |
18
|
1094
|
|
|
|
|
3495
|
$self->set_attributes(%attributes); |
19
|
1094
|
100
|
66
|
|
|
5599
|
if (!$attributes{line_height} && $self->size > $self->line_height) { |
20
|
20
|
|
|
|
|
105
|
$self->line_height($self->size); |
21
|
|
|
|
|
|
|
} |
22
|
1094
|
|
|
|
|
4512
|
return $self->find($file, $self->family); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub find { |
26
|
1094
|
|
|
1094
|
0
|
2549
|
my ($self, $file, $family, $enc) = @_; |
27
|
1094
|
|
|
|
|
3684
|
my $loaded = $self->loaded; |
28
|
1094
|
100
|
|
|
|
3159
|
unless ($loaded->{$family}) { |
29
|
549
|
|
50
|
|
|
2150
|
$loaded->{$family} = $file->pdf->corefont($family, -encoding => $enc || 'latin1'); |
30
|
549
|
|
|
|
|
14794581
|
$self->loaded($loaded); |
31
|
|
|
|
|
|
|
} |
32
|
1094
|
|
|
|
|
3733
|
return $loaded->{$family}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |