* added or adjusted instructions of U+0186, U+018E, U+0190 in Sans Mono
[dejavu.git] / dejavu-fonts / ttpostproc.pl
blob769c22baea8d99f864fd88e95c7c438b3568f6ce
1 #!/usr/bin/perl -w
2 # $Id$
4 # TTF postprocessing
5 # usage:
6 # chmod +x ttpostproc.pl
7 # ./ttpostproc.pl generated/*.ttf
9 use Font::TTF::Font;
11 sub postproc($) {
12 my ($file) = @_;
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";
19 # head.flags:
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;
27 # gasp table
28 # version = 0
29 # numRanges = 2
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";
38 $font->release();
41 @files = @ARGV;
42 foreach $f (@files) {
43 postproc($f);