Blame lib/Font/TTF/Vmtx.pm

Packit 5d935b
package Font::TTF::Vmtx;
Packit 5d935b
Packit 5d935b
=head1 NAME
Packit 5d935b
Packit 5d935b
Font::TTF::Vmtx - Vertical Metrics
Packit 5d935b
Packit 5d935b
=head1 DESCRIPTION
Packit 5d935b
Packit 5d935b
Contains the advance height and top side bearing for each glyph. Given the
Packit 5d935b
compressability of the data onto disk, this table uses information from
Packit 5d935b
other tables, and thus must do part of its output during the output of
Packit 5d935b
other tables
Packit 5d935b
Packit 5d935b
=head1 INSTANCE VARIABLES
Packit 5d935b
Packit 5d935b
The vertical metrics are kept in two arrays by glyph id. The variable names
Packit 5d935b
do not start with a space
Packit 5d935b
Packit 5d935b
=over 4
Packit 5d935b
Packit 5d935b
=item advance
Packit 5d935b
Packit 5d935b
An array containing the advance height for each glyph
Packit 5d935b
Packit 5d935b
=item top
Packit 5d935b
Packit 5d935b
An array containing the top side bearing for each glyph
Packit 5d935b
Packit 5d935b
=back
Packit 5d935b
Packit 5d935b
=head1 METHODS
Packit 5d935b
Packit 5d935b
=cut
Packit 5d935b
Packit 5d935b
use strict;
Packit 5d935b
use vars qw(@ISA);
Packit 5d935b
require Font::TTF::Hmtx;
Packit 5d935b
Packit 5d935b
@ISA = qw(Font::TTF::Hmtx);
Packit 5d935b
Packit 5d935b
Packit 5d935b
=head2 $t->read
Packit 5d935b
Packit 5d935b
Reads the vertical metrics from the TTF file into memory
Packit 5d935b
Packit 5d935b
=cut
Packit 5d935b
Packit 5d935b
sub read
Packit 5d935b
{
Packit 5d935b
    my ($self) = @_;
Packit 5d935b
    my ($numh, $numg);
Packit 5d935b
Packit 5d935b
    $numh = $self->{' PARENT'}{'vhea'}->read->{'numberOfVMetrics'};
Packit 5d935b
    $numg = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
Packit 5d935b
    $self->_read($numg, $numh, "advance", "top");
Packit 5d935b
}
Packit 5d935b
Packit 5d935b
Packit 5d935b
=head2 $t->out($fh)
Packit 5d935b
Packit 5d935b
Writes the metrics to a TTF file. Assumes that the C<vhea> has updated the
Packit 5d935b
numVMetrics from here
Packit 5d935b
Packit 5d935b
=cut
Packit 5d935b
Packit 5d935b
sub out
Packit 5d935b
{
Packit 5d935b
    my ($self, $fh) = @_;
Packit 5d935b
    my ($numg) = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
Packit 5d935b
    my ($numh) = $self->{' PARENT'}{'vhea'}{'numberOfVMetrics'};
Packit 5d935b
    $self->_out($fh, $numg, $numh, "advance", "top");
Packit 5d935b
}
Packit 5d935b
Packit 5d935b
1;
Packit 5d935b
Packit 5d935b
=head1 BUGS
Packit 5d935b
Packit 5d935b
None known
Packit 5d935b
Packit 5d935b
=head1 AUTHOR
Packit 5d935b
Packit 5d935b
Martin Hosken L<http://scripts.sil.org/FontUtils>. 
Packit 5d935b
Packit 5d935b
Packit 5d935b
=head1 LICENSING
Packit 5d935b
Packit 5d935b
Copyright (c) 1998-2016, SIL International (http://www.sil.org) 
Packit 5d935b
Packit 5d935b
This module is released under the terms of the Artistic License 2.0. 
Packit 5d935b
For details, see the full text of the license in the file LICENSE.
Packit 5d935b
Packit 5d935b
Packit 5d935b
Packit 5d935b
=cut
Packit 5d935b
Packit 5d935b