--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use POSIX;
+
+our @fbbox;
+our @cbbox;
+
+our $numbytes;
+our $zeroes;
+our $botpad;
+
+$|=1;
+
+while (<>) {
+ if (m/^FONTBOUNDINGBOX\s+([-0-9]+)\s+([-0-9]+)\s+([-0-9]+)\s+([-0-9]+)$/) {
+ die if @fbbox;
+ @fbbox = ($1,$2,$3,$4); # xsz ysz xoff yoff
+ # FONTBOUNDINGBOX 10 20 0 -4
+ } elsif (m/^BBX\s+([-0-9]+)\s+([-0-9]+)\s+([-0-9]+)\s+([-0-9]+)$/) {
+ die unless @fbbox;
+ @cbbox = ($1,$2,$3,$4);
+ print "BBX @fbbox\n";
+ next;
+ } elsif (m/^BITMAP\b/) {
+ die unless @cbbox;
+ $numbytes = ceil($fbbox[0] / 8);
+ $zeroes = ('00' x $numbytes)."\n";
+ $botpad = $cbbox[3] - $fbbox[3];
+ my $toppad = $fbbox[1] - $cbbox[1] - $botpad;
+ print;
+ print $zeroes x $toppad;
+ next;
+ } elsif (m/^ENDCHAR\b/) {
+ die unless defined $zeroes;
+ print $zeroes x $botpad;
+ $zeroes = undef;
+ } elsif (defined $zeroes) {
+ chomp;
+ m/[^0-9A-F]/ and die "$& ?";
+# print "# $_\n";
+ s/./ unpack "B4", pack "H*", $& /ge;
+# print "# $_\n";
+ $_ = ("0" x ($cbbox[2] - $fbbox[2])) . $_;
+# print "# $_\n";
+ s/0+$//;
+# print "# $_\n";
+ $_ .= "0" x ($numbytes*8 - length);
+# print "# $_\n";
+ s/.{4}/ unpack "H", pack "B4", $& /ge;
+ $_ .= "\n";
+ }
+ print;
+}
* An internal error message in printrule is improved slightly.
* Add debhelper-build-stamp to .gitignore.
* Permit new foundry names to contain "."s.
+ * Add bdf normaliser (to cope with fontforge output directly, since
+ bdftopcf | pcf2bdf sometimes fails).
-- Ian Jackson <ijackson@chiark.greenend.org.uk> Sun, 24 Apr 2016 22:07:21 +0100
./ffconvert.pe "$f/$pcf"
# 1. fontforge writes a silly filename
# 2. our crappy machinery copes only
- # with BDFs from pcf2bdf, not from
- # fontforge
- bdftopcf <"$f/$pcf".BDF*.bdf |pcf2bdf >$out
+ # with BDFs all of whose chars have
+ # the bbox of the font
+ ./bdfnorm <"$f/$pcf".BDF*.bdf >$out
else
echo >&2 "cannot make $out!"
exit 1