Font-TTF

 view release on metacpan or  search on metacpan

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


Tidies the cmap table.

Removes MS Fmt12 cmap if it is no longer needed.

Removes from all cmaps any codepoint that map to GID=0. Note that such entries will
be re-introduced as necessary depending on the cmap format.

=cut

sub update
{
    my ($self) = @_;
    my ($max, $code, $gid, @keep);
    
    return undef unless ($self->SUPER::update);

    foreach my $s (@{$self->{'Tables'}})
    {
        $max = 0;
        while (($code, $gid) = each %{$s->{'val'}})

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

    $self;
}


=head2 $t->update

Updates the RAM file copy C<' dat'> to be the same as the array.

=cut

sub update
{
    my ($self) = @_;

    return undef unless ($self->{' read'} && $#{$self->{'val'}} >= 0);
    $self->{' dat'} = TTF_Pack("s*", @{$self->{'val'}});
    $self;
}

1;

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

            $first = $e;
        }

        $last = $e;
    }

    $r[++$#r] = [$first, $last];
    @r;
}

sub update
{
    my ($self) = @_;
    my ($eblc) = $self->{' PARENT'}->{'EBLC'};
    my ($bst_array) = [];
    my ($offset) = 4;
    my ($i);
    my ($bitmap_array) = $self->{'bitmap'};
    my ($istao) = 8 + 48 * $eblc->{'Num'};

    $eblc->{'bitmapSizeTable'} = $bst_array;

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

    return undef;
}

=head2 $f->update

Sends update to all the tables in the font and then resets all the isDirty
flags on each table. The data structure in now consistent as a font (we hope).

=cut

sub update
{
    my ($self) = @_;
    
    $self->tables_do(sub { $_[0]->update; });

    $self;
}

=head2 $f->dirty

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

    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();

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

}

=head2 $g->update

Generates a C<$self->{'DAT'}> from the internal structures, if the data has
been read into structures in the first place. If you are building a glyph
from scratch you will need to set the instance variable C<' isDirty'>.

=cut

sub update
{
    my ($self) = @_;
    my ($dat, $loc, $len, $flag, $x, $y, $i, $comp, $num, @rflags, $repeat);

    return $self unless ($self->{' isDirty'});
    $self->read_dat->update_bbox;
    $self->{' DAT'} = TTF_Out_Fields($self, \%fields, 10);
    $num = $self->{'numberOfContours'};
    if ($num > 0)
    {

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

    $self;
}


=head2 $g->update_bbox

Updates the bounding box for this glyph according to the points in the glyph

=cut

sub update_bbox
{
    my ($self) = @_;
    my ($num, $maxx, $minx, $maxy, $miny, $i, $comp, $x, $y, $compg);

    return $self unless (defined $self->{' read'} && $self->{' read'} > 1);       # only if read_dat done
    $miny = $minx = 65537; $maxx = $maxy = -65537;
    $num = $self->{'numberOfContours'};
    if ($num > 0)
    {
        for ($i = 0; $i < $self->{'numPoints'}; $i++)

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

    $self;
}
    

=head2 $t->update

Updates the head table based on the glyph data and the hmtx table

=cut

sub update
{
    my ($self) = @_;
    my ($num, $i, $loc, $hmtx);
    my ($xMin, $yMin, $xMax, $yMax, $lsbx);

    return undef unless ($self->SUPER::update);

    $num = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
    return undef unless (defined $self->{' PARENT'}{'hmtx'} && defined $self->{' PARENT'}{'loca'});
    $hmtx = $self->{' PARENT'}{'hmtx'}->read;

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

    return 36;
}


=head2 $t->update

Updates various parameters in the hhea table from the hmtx table.

=cut

sub update
{
    my ($self) = @_;
    my ($hmtx) = $self->{' PARENT'}{'hmtx'};
    my ($glyphs);
    my ($num, $res);
    my ($i, $maw, $mlsb, $mrsb, $mext, $aw, $lsb, $ext);

    return undef unless ($self->SUPER::update);
    return undef unless (defined $hmtx && defined $self->{' PARENT'}{'loca'});

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

    $self;
}


=head2 $t->update

Updates the lsb values from the xMin from the each glyph

=cut

sub update
{
    my ($self) = @_;
    my ($numg) = $self->{' PARENT'}{'maxp'}{'numGlyphs'};
    my ($i);

    return undef unless ($self->SUPER::update);
# lsb & xMin must always be the same, regardless of any flags!
#    return $self unless ($self->{' PARENT'}{'head'}{'flags'} & 2);        # lsb & xMin the same

    $self->{' PARENT'}{'loca'}->update;

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



=head2 $t->update

Calculates all the maximum values for a font based on the glyphs in the font.
Only those fields which require hinting code interpretation are ignored and
left as they were read.

=cut

sub update
{
    my ($self) = @_;
    my ($i, $num, @n, @m, $j);
    my (@name) = qw(maxPoints maxContours maxCompositePoints maxCompositeContours
                    maxSizeOfInstructions maxComponentElements maxComponentDepth);

    return undef unless ($self->SUPER::update);
    return undef if ($self->{'version'} == 0.5);        # only got numGlyphs
    return undef unless (defined $self->{' PARENT'}{'loca'});
    $self->{' PARENT'}{'loca'}->update;

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

Updates the C<firstChar> and C<lastChar> values based on the MS table in the
cmap.

Updates the sTypoAscender, sTypoDescender & sTypoLineGap to be the same values
as Ascender, Descender and Linegap from the hhea table (assuming it is dirty)
and also sets usWinAscent to be the sum of Ascender+Linegap and usWinDescent to
be the negative of Descender.

=cut

sub update
{
    my ($self) = @_;
    my ($map, @keys, $table, $i, $avg, $hmtx);

    return undef unless ($self->SUPER::update);

    $self->{' PARENT'}{'cmap'}->update;
    $map = $self->{' PARENT'}{'cmap'}->find_ms || return undef;
    $hmtx = $self->{' PARENT'}{'hmtx'}->read;

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

is required to ensure that the memory version of the table is consistent
and that other parameters in other tables have been updated accordingly.
I.e. by the end of sending C<update> to all the tables, the memory version
of the font should be entirely consistent.

Some tables which do no work indicate to themselves the need to update
themselves by setting isDirty above 1. This method resets that accordingly.

=cut

sub update
{
    my ($self) = @_;

    if ($self->{' isDirty'})
    {
        $self->read;
        $self->{' isDirty'} = 0;
        return $self;
    }
    else

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

Sort COVERAGE table and RULES for all lookups.

Unless $t->{' PARENT'}{' noharmony'} is true, update will make sure that GPOS and GSUB include 
the same scripts and languages. Any added scripts and languages will have empty feature sets.

=cut

# Assumes we are called on both GSUB and GPOS. So simply ADDS scripts and languages to $self that it finds
# in the other table.

sub update
{
    my ($self) = @_;
    
    return undef unless ($self->SUPER::update);
    
    if (defined ($self->{'LOOKUP'}))
    {
            
        # make flag word agree with mark filter setting:
        for my $l (@{$self->{'LOOKUP'}})

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

}


=head2 $t->update

Updates various parameters in the hhea table from the hmtx table, assuming
the C<hmtx> table is dirty.

=cut

sub update
{
    my ($self) = @_;
    my ($vmtx) = $self->{' PARENT'}{'vmtx'};
    my ($glyphs);
    my ($num);
    my ($i, $maw, $mlsb, $mrsb, $mext, $aw, $lsb, $ext);

    return undef unless ($self->SUPER::update);
    return undef unless (defined $vmtx && defined $self->{' PARENT'}{'loca'});
    $vmtx->read->update;



( run in 0.361 second using v1.01-cache-2.11-cpan-94b05bcf43c )