Introduce src dir.
[librarian.git] / src / librarian / font-optimizer / ext / Font-TTF / lib / Font / TTF / Vmtx.pm
1 package Font::TTF::Vmtx;
2
3 =head1 NAME
4
5 Font::TTF::Vmtx - Vertical Metrics
6
7 =head1 DESCRIPTION
8
9 Contains the advance height and top side bearing for each glyph. Given the
10 compressability of the data onto disk, this table uses information from
11 other tables, and thus must do part of its output during the output of
12 other tables
13
14 =head1 INSTANCE VARIABLES
15
16 The vertical metrics are kept in two arrays by glyph id. The variable names
17 do not start with a space
18
19 =over 4
20
21 =item advance
22
23 An array containing the advance height for each glyph
24
25 =item top
26
27 An array containing the top side bearing for each glyph
28
29 =back
30
31 =head1 METHODS
32
33 =cut
34
35 use strict;
36 use vars qw(@ISA);
37 require Font::TTF::Hmtx;
38
39 @ISA = qw(Font::TTF::Hmtx);
40
41
42 =head2 $t->read
43
44 Reads the vertical metrics from the TTF file into memory
45
46 =cut
47
48 sub read
49 {
50     my ($self) = @_;
51     my ($numh, $numg);
52
53     $numh = $self->{' PARENT'}{'vhea'}->read->{'numberOfVMetrics'};
54     $numg = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
55     $self->_read($numg, $numh, "advance", "top");
56 }
57
58
59 =head2 $t->out($fh)
60
61 Writes the metrics to a TTF file. Assumes that the C<vhea> has updated the
62 numVMetrics from here
63
64 =cut
65
66 sub out
67 {
68     my ($self, $fh) = @_;
69     my ($numg) = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
70     my ($numh) = $self->{' PARENT'}{'vhea'}{'numberOfVMetrics'};
71     $self->_out($fh, $numg, $numh, "advance", "top");
72 }
73
74 1;
75
76 =head1 BUGS
77
78 None known
79
80 =head1 AUTHOR
81
82 Martin Hosken Martin_Hosken@sil.org. See L<Font::TTF::Font> for copyright and
83 licensing.
84
85 =cut
86