summaryrefslogtreecommitdiff
path: root/font/tools/mergebdf
blob: 86c75f536a117ec3d2c7333e22d7963c908e9d28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl -w

if ($#ARGV < 0) {
    die "Usage: mergebdf font1.bdf ... > newfont.bdf\n";
}

foreach $font (@ARGV) {
    open(F, "<$font") || die;
    for (;;) {
        while (defined($_ = <F>) && !/^STARTCHAR /) {
            if (!$donehead) { print; }
        }
        if (!defined($_)) { last; }
        $donehead = 1;
        $c = $_;
        undef $e;
        while (($_ = <F>) !~ /^ENDCHAR/) {
            if (/^ENCODING (\d+)$/) { $e = $1; }
            $c .= $_;
        }
        $c .= $_;
        if (!$char{$e}) {
            $char{$e} = 1;
            print $c;
        }
    }
    close(F);
}
print "ENDFONT\n";