line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::TextBlock::Font; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
5
|
use Class::Accessor::Fast; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
28
|
use base qw( Class::Accessor::Fast ); |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
117
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( pdf font fillcolor size )); |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use constant mm => 25.4 / 72; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
83
|
|
11
|
1
|
|
|
1
|
|
7
|
use constant in => 1 / 72; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
12
|
1
|
|
|
1
|
|
15
|
use constant pt => 1; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
203
|
|
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
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
39
|
0
|
0
|
|
|
|
|
die "pdf attribute (your PDF::API object) required" unless $self->pdf; |
40
|
0
|
|
|
|
|
|
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
|
0
|
|
|
|
|
|
foreach my $att (keys %defaults) { |
47
|
0
|
0
|
|
|
|
|
$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 |