| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PDF::TextBlock::Font; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
45
|
use strict; |
|
|
6
|
|
|
|
|
15
|
|
|
|
6
|
|
|
|
|
186
|
|
|
4
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
153
|
|
|
5
|
6
|
|
|
6
|
|
30
|
use Class::Accessor::Fast; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
32
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
189
|
use base qw( Class::Accessor::Fast ); |
|
|
6
|
|
|
|
|
22
|
|
|
|
6
|
|
|
|
|
690
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( pdf font fillcolor size )); |
|
9
|
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
42
|
use constant mm => 25.4 / 72; |
|
|
6
|
|
|
|
|
21
|
|
|
|
6
|
|
|
|
|
517
|
|
|
11
|
6
|
|
|
6
|
|
41
|
use constant in => 1 / 72; |
|
|
6
|
|
|
|
|
36
|
|
|
|
6
|
|
|
|
|
332
|
|
|
12
|
6
|
|
|
6
|
|
55
|
use constant pt => 1; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
1315
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
PDF::TextBlock::Font - A font object to override the defaults PDF::TextBlock uses |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
TODO add from t/* |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
You can hand PDF::TextBlock objects from this class whenever you want to override |
|
27
|
|
|
|
|
|
|
the font defaults. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 METHODS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 apply_defaults |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Applies defaults for you wherever you didn't explicitly set a different value. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub apply_defaults { |
|
38
|
34
|
|
|
34
|
1
|
110
|
my ($self) = @_; |
|
39
|
34
|
50
|
|
|
|
666
|
die "pdf attribute (your PDF::API object) required" unless $self->pdf; |
|
40
|
34
|
|
|
|
|
837
|
my %defaults = ( |
|
41
|
|
|
|
|
|
|
# font is a PDF::API2::Resource::Font::CoreFont (or PDF::Builder) |
|
42
|
|
|
|
|
|
|
font => $self->pdf->corefont( 'Helvetica', -encoding => 'latin1' ), |
|
43
|
|
|
|
|
|
|
fillcolor => 'black', |
|
44
|
|
|
|
|
|
|
size => 10 / pt, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
34
|
|
|
|
|
1737050
|
foreach my $att (keys %defaults) { |
|
47
|
102
|
100
|
|
|
|
4633
|
$self->$att($defaults{$att}) unless defined $self->$att; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#my %fonts = ( |
|
51
|
|
|
|
|
|
|
# Helvetica => { |
|
52
|
|
|
|
|
|
|
# Bold => $pdf->corefont( 'Helvetica-Bold', -encoding => 'latin1' ), |
|
53
|
|
|
|
|
|
|
# Roman => $pdf->corefont( 'Helvetica', -encoding => 'latin1' ), |
|
54
|
|
|
|
|
|
|
# Italic => $pdf->corefont( 'Helvetica-Oblique', -encoding => 'latin1' ), |
|
55
|
|
|
|
|
|
|
# }, |
|
56
|
|
|
|
|
|
|
# Gotham => { |
|
57
|
|
|
|
|
|
|
# Bold => $pdf->ttfont('Gotham-Bold.ttf', -encode => 'latin1'), |
|
58
|
|
|
|
|
|
|
# Roman => $pdf->ttfont('Gotham-Light.otf', -encode => 'latin1'), |
|
59
|
|
|
|
|
|
|
# }, |
|
60
|
|
|
|
|
|
|
#); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Jay Hannah, C<< >> |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 BUGS / SUPPORT |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
See PDF::TextBlock. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Copyright 2009-2013 Jay Hannah, all rights reserved. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
77
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; # End of PDF::TextBlock::Font |