Font/TTF/LTSH.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 43 CC 2 SCAR 11.5
CC
2
Cov
0%
out
6.0
read
2.0
minsize
2.0
CRAP 3.1
1 package Font::TTF::LTSH;
2  
3 =head1 NAME
4  
5 Font::TTF::LTSH - Linear Threshold table
6  
7 =head1 DESCRIPTION
8  
9 Holds the linear threshold for each glyph. This is the ppem value at which a
10 glyph's metrics become linear. The value is set to 1 if a glyph's metrics are
11 always linear.
12  
13 =head1 INSTANCE VARIABLES
14  
15 =over 4
16  
17 =item glyphs
18  
19 An array of ppem values. One value per glyph
20  
21 =back
22  
23 =head1 METHODS
24  
25 =cut
26  
27 use strict;
28 use vars qw(@ISA);
29 use Font::TTF::Table;
30  
31 @ISA = qw(Font::TTF::Table);
32  
33 =head2 $t->read
34  
35 Reads the table
36  
37 =cut
38  
39 sub read
40 {
41 my ($self) = @_;
42 $self->SUPER::read or return $self;
43  
44 my ($fh) = $self->{' INFILE'};
45 my ($numg, $dat);
46  
47 $fh->read($dat, 4);
48 ($self->{'Version'}, $numg) = unpack("nn", $dat);
49 $self->{'Num'} = $numg;
50  
51 $fh->read($dat, $numg);
52 $self->{'glyphs'} = [unpack("C$numg", $dat)];
53 $self;
54 }
55  
56  
57 =head2 $t->out($fh)
58  
59 Outputs the LTSH to the given fh.
60  
61 =cut
62  
63 sub out
64 {
65 my ($self, $fh) = @_;
66 my ($numg) = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
67  
68 return $self->SUPER::out($fh) unless ($self->{' read'});
69  
70 $fh->print(pack("nn", 0, $numg));
71 $fh->print(pack("C$numg", @{$self->{'glyphs'}}));
72 $self;
73 }
74
75 =head2 $t->minsize()
76  
77 Returns the minimum size this table can be. If it is smaller than this, then the table
78 must be bad and should be deleted or whatever.
79  
80 =cut
81  
82 sub minsize
83 {
84 return 4;
85 }
86  
87  
88 1;
89  
90 =head1 BUGS
91  
92 None known
93  
94 =head1 AUTHOR
95  
96 Martin Hosken L<http://scripts.sil.org/FontUtils>.
97  
98  
99 =head1 LICENSING
100  
101 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
102  
103 This module is released under the terms of the Artistic License 2.0.
104 For details, see the full text of the license in the file LICENSE.
105  
106  
107  
108 =cut
109  
110