6 # chmod +x ttpostproc.pl
7 # ./ttpostproc.pl generated/*.ttf
13 my $backup = $file.'~';
15 rename($file, $backup) || die "Unable to rename $f as $backup : $!\n";
17 $font = Font
::TTF
::Font
->open($backup) || die "Unable to open font $backup : $!\n";
20 # 1 => baseline for font at y=0
21 # 2 => left sidebearing point at x=0
22 # 4 => instructions may depend on point size
23 # 8 => force ppem to integer values for all internal scaler math
24 # 0x10 => instructions may alter advance width
25 $font->{'head'}->{'flags'} = 1 + 2 + 4 + 8 + 0x10;
30 # range[0].rangeMaxPPEM = 8
31 # range[0].rangeGaspBehavior = 2 (GASP_DOGRAY)
32 # range[1].rangeMaxPPEM = 65535 (max.)
33 # range[1].rangeGaspBehavior = 3 (GASP_DOGRAY|GASP_GRIDFIT)
34 $gasp_data = pack('nnnnnn', 0, 2, 8, 2, 0xffff, 3);
35 $font->{'gasp'} = Font
::TTF
::Table
->new(( 'dat' => $gasp_data ));
37 $font->out($file) || die "Unable to write to $file : $!\n";