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: Vmtx.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25#
26#=======================================================================
27package PDF::API3::Compat::API2::Basic::TTF::Vmtx;
28
29=head1 NAME
30
31PDF::API3::Compat::API2::Basic::TTF::Vmtx - Vertical Metrics
32
33=head1 DESCRIPTION
34
35Contains the advance height and top side bearing for each glyph. Given the
36compressability of the data onto disk, this table uses information from
37other tables, and thus must do part of its output during the output of
38other tables
39
40=head1 INSTANCE VARIABLES
41
42The vertical metrics are kept in two arrays by glyph id. The variable names
43do not start with a space
44
45=over 4
46
47=item advance
48
49An array containing the advance height for each glyph
50
51=item top
52
53An array containing the top side bearing for each glyph
54
55=back
56
57=head1 METHODS
58
59=cut
60
61use strict;
62use vars qw(@ISA);
63require PDF::API3::Compat::API2::Basic::TTF::Hmtx;
64
65@ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Hmtx);
66
67
68=head2 $t->read
69
70Reads the vertical metrics from the TTF file into memory
71
72=cut
73
74sub read
75{
76    my ($self) = @_;
77    my ($numh, $numg);
78
79    $numh = $self->{' PARENT'}{'vhea'}->read->{'numberOfVMetrics'};
80    $numg = $self->{' PARENT'}{'maxp'}->read->{'numGlyphs'};
81    $self->_read($numg, $numh, "advance", "top");
82}
83
84
85=head2 $t->out($fh)
86
87Writes the metrics to a TTF file. Assumes that the C<vhea> has updated the
88numVMetrics from here
89
90=cut
91
92sub out
93{
94    my ($self, $fh) = @_;
95    my ($numg) = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
96    my ($numh) = $self->{' PARENT'}{'vhea'}{'numberOfVMetrics'};
97    $self->_out($fh, $numg, $numh, "advance", "top");
98}
99
1001;
101
102=head1 BUGS
103
104None known
105
106=head1 AUTHOR
107
108Martin Hosken Martin_Hosken@sil.org. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
109licensing.
110
111=cut
112
113