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

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 8 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 / 68 CC 5 SCAR 26.1
CC
5
Cov
0%
print
30.0
new
2.0
read
2.0
CRAP 13.7
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: Rearrangement.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::Mort::Rearrangement;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::Mort::Rearrangement
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
67 my ($classes, $states) = AAT_read_state_table($fh, 0);
68 $self->{'classes'} = $classes;
69 $self->{'states'} = $states;
70
71 $self;
72 }
73
74 =head2 $t->pack_sub()
75
76 =cut
77
78 sub pack_sub
79 {
80 my ($self) = @_;
81
82 return AAT_pack_state_table($self->{'classes'}, $self->{'states'}, 0);
83 }
84
85 =head2 $t->print($fh)
86
87 Prints a human-readable representation of the table
88
89 =cut
90
91 sub print
92 {
93 my ($self, $fh) = @_;
94
95 my $post = $self->post();
96
97 $fh = 'STDOUT' unless defined $fh;
98
99 $self->print_classes($fh);
100
101 $fh->print("\n");
102 my $states = $self->{'states'};
103 my @verbs = ( "0", "Ax->xA", "xD->Dx", "AxD->DxA",
104 "ABx->xAB", "ABx->xBA", "xCD->CDx", "xCD->DCx",
105 "AxCD->CDxA", "AxCD->DCxA", "ABxD->DxAB", "ABxD->DxBA",
106 "ABxCD->CDxAB", "ABxCD->CDxBA", "ABxCD->DCxAB", "ABxCD->DCxBA");
107 foreach (0 .. $#$states) {
108 $fh->printf("\t\tState %d:", $_);
109 my $state = $states->[$_];
110 foreach (@$state) {
111 my $flags;
112 $flags .= "!" if ($_->{'flags'} & 0x4000);
113 $flags .= "<" if ($_->{'flags'} & 0x8000);
114 $flags .= ">" if ($_->{'flags'} & 0x2000);
115 $fh->printf("\t(%s%d,%s)", $flags, $_->{'nextState'}, $verbs[($_->{'flags'} & 0x000f)]);
116 }
117 $fh->print("\n");
118 }
119 }
120
121 1;
122
123 =head1 BUGS
124
125 None known
126
127 =head1 AUTHOR
128
129 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
130 licensing.
131
132 =cut
133