API3/Compat/API2/Basic/TTF/Mort.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 67 CC 4 SCAR 17.0
CC
4
Cov
0%
print
12.0
out
6.0
read
2.0
CRAP 5.5
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 #=======================================================================
12 #
13 # THIS IS A REUSED PERL MODULE, FOR PROPER LICENCING TERMS SEE BELOW:
14 #
15 #
16 # Copyright Jonathan Kew L<Jonathan_Kew@sil.org>
17 #
18 # No warranty or expression of effectiveness, least of all regarding
19 # anyone's safety, is implied in this software or documentation.
20 #
21 # This specific module is licensed under the Perl Artistic License.
22 #
23 #
24 # $Id: Mort.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::Mort;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::Mort - Glyph Metamorphosis table in a font
32
33 =head1 METHODS
34
35 =cut
36
37 use strict;
38 use vars qw(@ISA);
39 use PDF::API3::Compat::API2::Basic::TTF::Utils;
40 use PDF::API3::Compat::API2::Basic::TTF::AATutils;
41 use PDF::API3::Compat::API2::Basic::TTF::Mort::Chain;
42
43 @ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Table);
44
45 =head2 $t->read
46
47 Reads the table into memory
48
49 =cut
50
51 sub read
52 {
53 my ($self) = @_;
54 my ($dat, $fh, $numChains);
55
56 $self->SUPER::read or return $self;
57
58 $fh = $self->{' INFILE'};
59
60 $fh->read($dat, 8);
61 ($self->{'version'}, $numChains) = TTF_Unpack("fL", $dat);
62
63 my $chains = [];
64 foreach (1 .. $numChains) {
65 my $chain = new PDF::API3::Compat::API2::Basic::TTF::Mort::Chain->new;
66 $chain->read($fh);
67 $chain->{' PARENT'} = $self;
68 push @$chains, $chain;
69 }
70
71 $self->{'chains'} = $chains;
72
73 $self;
74 }
75
76 =head2 $t->out($fh)
77
78 Writes the table to a file either from memory or by copying
79
80 =cut
81
82 sub out
83 {
84 my ($self, $fh) = @_;
85
86 return $self->SUPER::out($fh) unless $self->{' read'};
87
88 my $chains = $self->{'chains'};
89 $fh->print(TTF_Pack("fL", $self->{'version'}, scalar @$chains));
90
91 foreach (@$chains) {
92 $_->out($fh);
93 }
94 }
95
96 =head2 $t->print($fh)
97
98 Prints a human-readable representation of the table
99
100 =cut
101
102 sub print
103 {
104 my ($self, $fh) = @_;
105
106 $self->read unless $self->{' read'};
107 my $feat = $self->{' PARENT'}->{'feat'};
108 $feat->read;
109 my $post = $self->{' PARENT'}->{'post'};
110 $post->read;
111
112 $fh = 'STDOUT' unless defined $fh;
113
114 $fh->printf("version %f\n", $self->{'version'});
115
116 my $chains = $self->{'chains'};
117 foreach (@$chains) {
118 $_->print($fh);
119 }
120 }
121
122 1;
123
124 =head1 BUGS
125
126 None known
127
128 =head1 AUTHOR
129
130 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
131 licensing.
132
133 =cut
134