line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Khonsu::Font; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
39
|
use parent 'Khonsu::Ra'; |
|
5
|
|
|
|
|
41
|
|
|
5
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub attributes { |
6
|
402
|
|
|
402
|
0
|
605
|
my $a = shift; |
7
|
|
|
|
|
|
|
return ( |
8
|
402
|
|
|
402
|
|
1037
|
colour => {$a->RW, $a->STR, default => sub { '#000' }}, |
9
|
402
|
|
|
402
|
|
916
|
size => {$a->RW, $a->NUM, default => sub { 9 }}, |
10
|
402
|
|
|
402
|
|
1100
|
family => {$a->RW, $a->STR, default => sub { 'Times' }}, |
11
|
|
|
|
|
|
|
loaded => {$a->RW, $a->DHR}, |
12
|
402
|
|
|
402
|
|
2066
|
line_height => {$a->RW, $a->NUM, default => sub { $_[0]->size }}, |
13
|
402
|
|
|
|
|
9546
|
); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub load { |
17
|
1094
|
|
|
1094
|
0
|
2565
|
my ($self, $file, %attributes) = @_; |
18
|
1094
|
|
|
|
|
4159
|
$self->set_attributes(%attributes); |
19
|
1094
|
100
|
66
|
|
|
6148
|
if (!$attributes{line_height} && $self->size > $self->line_height) { |
20
|
20
|
|
|
|
|
94
|
$self->line_height($self->size); |
21
|
|
|
|
|
|
|
} |
22
|
1094
|
|
|
|
|
4896
|
return $self->find($file, $self->family); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub find { |
26
|
1094
|
|
|
1094
|
0
|
2894
|
my ($self, $file, $family, $enc) = @_; |
27
|
1094
|
|
|
|
|
3648
|
my $loaded = $self->loaded; |
28
|
1094
|
100
|
|
|
|
3457
|
unless ($loaded->{$family}) { |
29
|
549
|
|
50
|
|
|
2491
|
$loaded->{$family} = $file->pdf->corefont($family, -encoding => $enc || 'latin1'); |
30
|
549
|
|
|
|
|
14979298
|
$self->loaded($loaded); |
31
|
|
|
|
|
|
|
} |
32
|
1094
|
|
|
|
|
4320
|
return $loaded->{$family}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |