#!/usr/bin/perl -w use strict; our $state='begin'; our ($w,$h,$xo,$yo,$y,$bitmap,$glyph); while (<>) { if ($state eq 'bitmap' && $y==$h) { $state='idle'; } if ($state eq 'bitmap') { m/^([0-9a-fA-F]+)\s+$/ or die $y; length($1) == (($w+7 >> 3) << 1) or die "$1 $w"; $glyph .= "$1;"; } if ($state eq 'begin' && m/^FOUNDRY\s+\"Misc\"\s+/i) { s/misc/Trad/i; $state='idle'; } if ($state eq 'idle' && m/^STARTCHAR\s/) { $state='startchar'; $w=undef; } if ($state eq 'startchar') { if (m/^BBX\s+(\+?\d+)\s+(\+?\d+)\s+([-+]?\d+)\s+([-+]?\d+)\s+$/) { ($w,$h,$xo,$yo) = ($1,$2,$3,$4); } if (m/^BITMAP\s+$/) { die unless defined $w; $y=0; $glyph=''; $state='bitmap'; } } if ($inchar) { if ( $inchar next unless $foundry;