view release on metacpan or search on metacpan
lib/Font/TTF/Cmap.pm view on Meta::CPAN
625626627628629630631632633634635636637638639640641642643644645Tidies 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
5051525354555657585960616263646566676869
$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
164165166167168169170171172173174175176177178179180181182183184
$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
757758759760761762763764765766767768769770771772773774775776
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
408409410411412413414415416417418419420421422423424425426427428
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
508509510511512513514515516517518519520521522523524525526527528}
=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
659660661662663664665666667668669670671672673674675676677678679
$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
153154155156157158159160161162163164165166167168169170171172173
$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
111112113114115116117118119120121122123124125126127128129130
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
137138139140141142143144145146147148149150151152153154155156157
$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
134135136137138139140141142143144145146147148149150151152153154=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
255256257258259260261262263264265266267268269270271272273274Updates 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
344345346347348349350351352353354355356357358359360361362363364is 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
795796797798799800801802803804805806807808809810811812813814815Sort 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
111112113114115116117118119120121122123124125126127128129130131}
=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;