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

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 2 SCAR 12.0
CC
2
Cov
0%
out
6.0
read
2.0
BEGIN
2.0
CRAP 3.3
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 Martin Hosken <Martin_Hosken@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: LTSH.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::LTSH;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::LTSH - Linear Threshold table
32
33 =head1 DESCRIPTION
34
35 Holds the linear threshold for each glyph. This is the ppem value at which a
36 glyph's metrics become linear. The value is set to 1 if a glyph's metrics are
37 always linear.
38
39 =head1 INSTANCE VARIABLES
40
41 =over 4
42
43 =item glyphs
44
45 An array of ppem values. One value per glyph
46
47 =back
48
49 =head1 METHODS
50
51 =cut
52
53 use strict;
54 use vars qw(@ISA);
55 use PDF::API3::Compat::API2::Basic::TTF::Table;
56
57 @ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Table);
58
59 =head2 $t->read
60
61 Reads the table
62
63 =cut
64
65 sub read
66 {
67 my ($self) = @_;
68 my ($fh) = $self->{' INFILE'};
69 my ($numg, $dat);
70
71 $self->SUPER::read or return $self;
72
73 $fh->read($dat, 4);
74 ($self->{'Version'}, $numg) = unpack("nn", $dat);
75 $self->{'Num'} = $numg;
76
77 $fh->read($dat, $numg);
78 $self->{'glyphs'} = [unpack("C$numg", $dat)];
79 $self;
80 }
81
82
83 =head2 $t->out($fh)
84
85 Outputs the LTSH to the given fh.
86
87 =cut
88
89 sub out
90 {
91 my ($self, $fh) = @_;
92 my ($numg) = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
93
94 return $self->SUPER::out($fh) unless ($self->{' read'});
95
96 $fh->print(pack("nn", 0, $numg));
97 $fh->print(pack("C$numg", @{$self->{'glyphs'}}));
98 $self;
99 }
100
101
102 1;
103
104 =head1 BUGS
105
106 None known
107
108 =head1 AUTHOR
109
110 Martin Hosken Martin_Hosken@sil.org. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
111 licensing.
112
113 =cut
114