#!/usr/bin/perl -w
+# BDF can represent glyphs as smaller bitmap rectangles with padding.
+# But our approach to font editing works best if the glyphs are the
+# full character cell. Although most fonts do not use this feature
+# (at least, as seen in pdf2bdf output), some do, and also output from
+# fontforge does. So this script pads each glyph to the font bounding
+# box.
+
use strict;
use POSIX;
chomp;
m/[^0-9A-F]/ and die "$& ?";
# print "# $_\n";
- s/./ unpack "B4", pack "H*", $& /ge;
+ $_ = unpack "B*", pack "H*", $_;
# print "# $_\n";
$_ = ("0" x ($cbbox[2] - $fbbox[2])) . $_;
# print "# $_\n";
# print "# $_\n";
$_ .= "0" x ($numbytes*8 - length);
# print "# $_\n";
- s/.{4}/ unpack "H", pack "B4", $& /ge;
+ $_ = unpack "H*", pack "B*", $_;
+ $_ = uc $_;
$_ .= "\n";
}
print;