1package Font::TTF::LTSH;
2
3=head1 NAME
4
5Font::TTF::LTSH - Linear Threshold table
6
7=head1 DESCRIPTION
8
9Holds the linear threshold for each glyph. This is the ppem value at which a
10glyph's metrics become linear. The value is set to 1 if a glyph's metrics are
11always linear.
12
13=head1 INSTANCE VARIABLES
14
15=over 4
16
17=item glyphs
18
19An array of ppem values. One value per glyph
20
21=back
22
23=head1 METHODS
24
25=cut
26
27use strict;
28use vars qw(@ISA);
29use Font::TTF::Table;
30
31@ISA = qw(Font::TTF::Table);
32
33=head2 $t->read
34
35Reads the table
36
37=cut
38
39sub 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
59Outputs the LTSH to the given fh.
60
61=cut
62
63sub 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
77Returns the minimum size this table can be. If it is smaller than this, then the table
78must be bad and should be deleted or whatever.
79
80=cut
81
82sub minsize
83{
84    return 4;
85}
86
87
881;
89
90=head1 BUGS
91
92None known
93
94=head1 AUTHOR
95
96Martin Hosken L<http://scripts.sil.org/FontUtils>.
97
98
99=head1 LICENSING
100
101Copyright (c) 1998-2016, SIL International (http://www.sil.org)
102
103This module is released under the terms of the Artistic License 2.0.
104For details, see the full text of the license in the file LICENSE.
105
106
107
108=cut
109
110
111