Font-TTF

 view release on metacpan or  search on metacpan

lib/Font/TTF/GDEF.pm  view on Meta::CPAN

            }
            push (@reftables, [$ltables, $loc1]);
            $i++;
        }
        Font::TTF::Ttopen::out_final($fh, $out, \@reftables);
    }

    if (defined $self->{'MARKS'})
    {
        $macoff = $fh->tell() - $loc;
        $self->{'MARKS'}->out($fh);
    }
    
    if (defined $self->{'MARKSETS'})
    {

        my (@reftables, $ctables, $c, $out); 
        $ctables = {};      
        $mgsoff = $fh->tell() - $loc;
        $out = TTF_Pack('SS', 1, $#{$self->{'MARKSETS'}}+1);
        foreach $c (@{$self->{'MARKSETS'}})
        {
            $out .= pack('N', Font::TTF::Ttopen::ref_cache($c, $ctables, length($out), 'N'));
        }
        push (@reftables, [$ctables, 0]);
        Font::TTF::Ttopen::out_final($fh, $out, \@reftables);
    }

    $loc1 = $fh->tell();
    $fh->seek($loc + 4, 0);
    if ($mgsoff)
    { $fh->print(TTF_Pack('S5', $goff, $aoff, $loff, $macoff, $mgsoff)); }
    elsif ($macoff)
    { $fh->print(TTF_Pack('S4', $goff, $aoff, $loff, $macoff)); }
    else
    { $fh->print(TTF_Pack('S3', $goff, $aoff, $loff)); }
    $fh->seek($loc1, 0);
    $self;
}


=head2 $t->minsize()

Returns the minimum size this table can be. If it is smaller than this, then the table
must be bad and should be deleted or whatever.

=cut

sub minsize
{
    return 10;
}


=head2 $t->update

Sort COVERAGE tables.

=cut

sub update
{
    my ($self) = @_;
    
    return undef unless ($self->SUPER::update);
    
    unless ($Font::TTF::Coverage::dontsort)
    {
        if (defined $self->{'ATTACH'} and defined $self->{'ATTACH'}{'COVERAGE'} and !$self->{'ATTACH'}{'COVERAGE'}{'dontsort'} )
        {
            my @map = $self->{'ATTACH'}{'COVERAGE'}->sort();
            if (defined $self->{'ATTACH'}{'POINTS'})
            {
                # And also a POINTS array which now needs to be re-sorted
                my $newpoints = [];
                foreach (0 .. $#map)
                { push @{$newpoints}, $self->{'ATTACH'}{'POINTS'}[$map[$_]]; }
                $self->{'ATTACH'}{'POINTS'} = $newpoints;
            }
        }
        if (defined $self->{'LIG'} and defined $self->{'LIG'}{'COVERAGE'} and !$self->{'LIG'}{'COVERAGE'}{'dontsort'} )
        {
            my @map = $self->{'LIG'}{'COVERAGE'}->sort();
            if (defined $self->{'LIG'}{'LIGS'})
            {
                # And also a LIGS array which now needs to be re-sorted
                my $newligs = [];
                foreach (0 .. $#map)
                { push @{$newligs}, $self->{'LIG'}{'LIGS'}[$map[$_]]; }
                $self->{'LIG'}{'LIGS'} = $newligs;
            }
        }
        if (defined $self->{'MARKSETS'})
        {
            foreach (@{$self->{'MARKSETS'}})
            {$_->sort();}       # Don't care about map
        }
    }
    
    $self;
}

1;

=head1 AUTHOR

Martin Hosken L<http://scripts.sil.org/FontUtils>. 


=head1 LICENSING

Copyright (c) 1998-2016, SIL International (http://www.sil.org) 

This module is released under the terms of the Artistic License 2.0. 
For details, see the full text of the license in the file LICENSE.



=cut



( run in 2.930 seconds using v1.01-cache-2.11-cpan-98e64b0badf )