<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Font::TTF::Mort;

=head1 NAME

Font::TTF::Mort - Glyph Metamorphosis table in a font

=head1 METHODS

=cut

use strict;
use vars qw(@ISA);
use Font::TTF::Utils;
use Font::TTF::AATutils;
use Font::TTF::Mort::Chain;

@ISA = qw(Font::TTF::Table);

=head2 $t-&gt;read

Reads the table into memory

=cut

sub read
{
    my ($self) = @_;
    my ($dat, $fh, $numChains);
    
    $self-&gt;SUPER::read or return $self;

    $fh = $self-&gt;{' INFILE'};

    $fh-&gt;read($dat, 8);
    ($self-&gt;{'version'}, $numChains) = TTF_Unpack("vL", $dat);
    
    my $chains = [];
    foreach (1 .. $numChains) {
        my $chain = new Font::TTF::Mort::Chain-&gt;new;
        $chain-&gt;read($fh);
        $chain-&gt;{' PARENT'} = $self;
        push @$chains, $chain;
    }

    $self-&gt;{'chains'} = $chains;

    $self;
}

=head2 $t-&gt;out($fh)

Writes the table to a file either from memory or by copying

=cut

sub out
{
    my ($self, $fh) = @_;
    
    return $self-&gt;SUPER::out($fh) unless $self-&gt;{' read'};

    my $chains = $self-&gt;{'chains'};
    $fh-&gt;print(TTF_Pack("vL", $self-&gt;{'version'}, scalar @$chains));

    foreach (@$chains) {
        $_-&gt;out($fh);
    }
}

=head2 $t-&gt;print($fh)

Prints a human-readable representation of the table

=cut

sub print
{
    my ($self, $fh) = @_;
    
    $self-&gt;read unless $self-&gt;{' read'};
    my $feat = $self-&gt;{' PARENT'}-&gt;{'feat'};
    $feat-&gt;read;
    my $post = $self-&gt;{' PARENT'}-&gt;{'post'};
    $post-&gt;read;
    
    $fh = 'STDOUT' unless defined $fh;

    $fh-&gt;printf("version %f\n", $self-&gt;{'version'});
    
    my $chains = $self-&gt;{'chains'};
    foreach (@$chains) {
        $_-&gt;print($fh);
    }
}

1;

=head1 BUGS

None known

=head1 AUTHOR

Jonathan Kew L&lt;Jonathan_Kew@sil.org&gt;. See L&lt;Font::TTF::Font&gt; for copyright and
licensing.

=cut

</pre></body></html>