chiark / gitweb /
Improve quotes in Misc Fixed 10x20 - WIP
[xfonts-traditional.git] / mkrules
diff --git a/mkrules b/mkrules
index b55b3976f65bf4b2ce88839c8edcda284cee920e..3c5f93515487c4bce12ac719b61ce6b355a8313c 100755 (executable)
--- a/mkrules
+++ b/mkrules
@@ -25,6 +25,7 @@ chars () {
 }
 
 seenrules=/
+seenfoundries=/
 
 while read keyword rest; do
        case "$keyword" in
@@ -32,8 +33,23 @@ while read keyword rest; do
        pcf)
                pcf=$rest
                for f in good bad; do
+                       in=$f/$pcf.pcf.gz
                        out=$f/$pcf.bdf
-                       zcat $f/$pcf.pcf.gz | pcf2bdf >$out
+                       if [ -e $in ]; then
+                               zcat $in | pcf2bdf >$out
+                       elif [ -e "$out.direct" ]; then
+                               cp "$out.direct" "$out"
+                       elif [ -e "$f/$pcf.sfd" ]; then
+                               ./ffconvert.pe "$f/$pcf"
+                               # 1. fontforge writes a silly filename
+                               # 2. our crappy machinery copes only
+                               #  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
+                       fi
                        eval "$f=\$out"
                done
                ;;
@@ -47,14 +63,26 @@ while read keyword rest; do
                        m/^\d+\,(\d+)\b/ or die;
                        print "key=$_; height=$1\n" or die $!;
                        exit;
-               ' <$good`
+               ' <$bad`
                oldfoundry=`perl -ne '
                        next unless s/^FOUNDRY\s+\"?//;
                        s/\"?\s+$//;
                        print or die $!;
                        exit;
                ' <$good`
-               printf "%s %s" "$oldfoundry" "$newfoundry" >>rules/foundries.new
+               case "$seenfoundries" in
+               */"$oldfoundry,$newfoundry"/*)
+                       ;;
+               */"$oldfoundry,"*)
+                       echo >&2 "inconsistent foundry mapping"
+                       exit 1
+                       ;;
+               *)
+                       seenfoundries=$seenfoundries$oldfoundry,$newfoundry/
+                       printf >>rules/foundries.new \
+                               "%s %s\n" "$oldfoundry" "$newfoundry"
+                       ;;
+               esac
                case "$seenrules" in
                */"$newfoundry,$key"/*)
                        exec 3>>rules/$newfoundry,$key.rules