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

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 56 CC 3 SCAR 16.1
CC
3
Cov
0%
print
12.0
new
2.0
read
2.0
CRAP 5.0
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: Noncontextual.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::Mort::Noncontextual;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::Mort::Noncontextual
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
42 @ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Mort::Subtable);
43
44 sub new
45 {
46 my ($class, $direction, $orientation, $subFeatureFlags) = @_;
47 my ($self) = {
48 'direction' => $direction,
49 'orientation' => $orientation,
50 'subFeatureFlags' => $subFeatureFlags
51 };
52
53 $class = ref($class) || $class;
54 bless $self, $class;
55 }
56
57 =head2 $t->read
58
59 Reads the table into memory
60
61 =cut
62
63 sub read
64 {
65 my ($self, $fh) = @_;
66 my ($dat);
67
68 my ($format, $lookup) = AAT_read_lookup($fh, 2, $self->{'length'} - 8, undef);
69 $self->{'format'} = $format;
70 $self->{'lookup'} = $lookup;
71
72 $self;
73 }
74
75 =head2 $t->pack_sub($fh)
76
77 =cut
78
79 sub pack_sub
80 {
81 my ($self) = @_;
82
83 return AAT_pack_lookup($self->{'format'}, $self->{'lookup'}, 2, undef);
84 }
85
86 =head2 $t->print($fh)
87
88 Prints a human-readable representation of the table
89
90 =cut
91
92 sub print
93 {
94 my ($self, $fh) = @_;
95
96 my $post = $self->post();
97
98 $fh = 'STDOUT' unless defined $fh;
99
100 my $lookup = $self->{'lookup'};
101 $fh->printf("\t\tLookup format %d\n", $self->{'format'});
102 if (defined $lookup) {
103 foreach (sort { $a <=> $b } keys %$lookup) {
104 $fh->printf("\t\t\t%d [%s] -> %d [%s])\n", $_, $post->{'VAL'}[$_], $lookup->{$_}, $post->{'VAL'}[$lookup->{$_}]);
105 }
106 }
107 }
108
109 1;
110
111 =head1 BUGS
112
113 None known
114
115 =head1 AUTHOR
116
117 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
118 licensing.
119
120 =cut
121