Font-TTF-Scripts
view release on metacpan or search on metacpan
scripts/ttf2woff view on Meta::CPAN
# Someone else may want to add this functionality later
# but it will involve decompressing tables to confirm the checksums
die "input font is already a woff font\n" if $iswoff;
if ($opts{'c'})
{
# Force checksum recalcuation by copying font
# If font has non-empty DSIG, delete it first:
my $dsig = $if->{'DSIG'};
delete $if->{'DSIG'} if ($dsig && !$dsig->isempty);
#Copy the rest of the font to string file:
my ($tfh) = IO::String->new($string);
my (@tlist) = sort {$if->{$a}{' OFFSET'} <=> $if->{$b}{' OFFSET'}}
grep(length($_) == 4, keys %{$if});
$if->out($tfh, @tlist);
# release original font to free up memory:
$if->{'DSIG'} = $dsig if $dsig;
$if->release;
# Now open copied font:
$tfh = IO::String->new($string);
$if = Font::TTF::Font->open($tfh);
}
my $cWarnings = 0;
$ofh = IO::File->new("> $ARGV[1]") || die "Can't open $ARGV[1] for writing";
( run in 1.857 second using v1.01-cache-2.11-cpan-71847e10f99 )