Font-TTF

 view release on metacpan or  search on metacpan

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

625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
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

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    $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

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
            $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

757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
    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

408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
    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

508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
}
 
=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

659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
    $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

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
    $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

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    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

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
    $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

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
 
=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

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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

344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
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

795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
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

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
}
 
 
=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.334 second using v1.01-cache-2.11-cpan-94b05bcf43c )