Font/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 package Font::TTF::Mort::Noncontextual;
2  
3 =head1 NAME
4  
5 Font::TTF::Mort::Noncontextual - Noncontextual Mort subtable for AAT
6  
7 =head1 METHODS
8  
9 =cut
10  
11 use strict;
12 use vars qw(@ISA);
13 use Font::TTF::Utils;
14 use Font::TTF::AATutils;
15  
16 @ISA = qw(Font::TTF::Mort::Subtable);
17  
18 sub new
19 {
20 my ($class, $direction, $orientation, $subFeatureFlags) = @_;
21 my ($self) = {
22 'direction' => $direction,
23 'orientation' => $orientation,
24 'subFeatureFlags' => $subFeatureFlags
25 };
26  
27 $class = ref($class) || $class;
28 bless $self, $class;
29 }
30  
31 =head2 $t->read
32  
33 Reads the table into memory
34  
35 =cut
36  
37 sub read
38 {
39 my ($self, $fh) = @_;
40 my ($dat);
41
42 my ($format, $lookup) = AAT_read_lookup($fh, 2, $self->{'length'} - 8, undef);
43 $self->{'format'} = $format;
44 $self->{'lookup'} = $lookup;
45  
46 $self;
47 }
48  
49 =head2 $t->pack_sub($fh)
50  
51 =cut
52  
53 sub pack_sub
54 {
55 my ($self) = @_;
56
57 return AAT_pack_lookup($self->{'format'}, $self->{'lookup'}, 2, undef);
58 }
59  
60 =head2 $t->print($fh)
61  
62 Prints a human-readable representation of the table
63  
64 =cut
65  
66 sub print
67 {
68 my ($self, $fh) = @_;
69
70 my $post = $self->post();
71
72 $fh = 'STDOUT' unless defined $fh;
73  
74 my $lookup = $self->{'lookup'};
75 $fh->printf("\t\tLookup format %d\n", $self->{'format'});
76 if (defined $lookup) {
77 foreach (sort { $a <=> $b } keys %$lookup) {
78 $fh->printf("\t\t\t%d [%s] -> %d [%s])\n", $_, $post->{'VAL'}[$_], $lookup->{$_}, $post->{'VAL'}[$lookup->{$_}]);
79 }
80 }
81 }
82  
83 1;
84  
85 =head1 BUGS
86  
87 None known
88  
89 =head1 AUTHOR
90  
91 Jonathan Kew L<http://scripts.sil.org/FontUtils>.
92  
93  
94 =head1 LICENSING
95  
96 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
97  
98 This module is released under the terms of the Artistic License 2.0.
99 For details, see the full text of the license in the file LICENSE.
100  
101  
102  
103 =cut
104  
105