wip
[xfonts-traditional] / bdf-filter
1 #!/usr/bin/perl -w
2 use strict;
3
4 our $state='begin';
5 our ($w,$h,$xo,$yo,$y,$bitmap,$glyph);
6
7 while (<>) {
8 if ($state eq 'bitmap' && $y==$h) {
9 $state='idle';
10 }
11 if ($state eq 'bitmap') {
12 m/^([0-9a-fA-F]+)\s+$/ or die $y;
13 length($1) == (($w+7 >> 3) << 1) or die "$1 $w";
14 $glyph .= "$1;";
15 }
16 if ($state eq 'begin' && m/^FOUNDRY\s+\"Misc\"\s+/i) {
17 s/misc/Trad/i;
18 $state='idle';
19 }
20 if ($state eq 'idle' && m/^STARTCHAR\s/) {
21 $state='startchar';
22 $w=undef;
23 }
24 if ($state eq 'startchar') {
25 if (m/^BBX\s+(\+?\d+)\s+(\+?\d+)\s+([-+]?\d+)\s+([-+]?\d+)\s+$/) {
26 ($w,$h,$xo,$yo) = ($1,$2,$3,$4);
27 }
28 if (m/^BITMAP\s+$/) {
29 die unless defined $w;
30 $y=0;
31 $glyph='';
32 $state='bitmap';
33 }
34 }
35
36
37 if ($inchar) {
38 if (
39 $inchar
40
41 next unless $foundry;