X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=mkrules;h=3c5f93515487c4bce12ac719b61ce6b355a8313c;hb=35412fce345bbb491202173df7c0b8f0925fe67d;hp=ea3afebc09496658f57592fb5170006354ac081f;hpb=1d7fff817dd878f0faf198692742c4bf2ab70074;p=xfonts-traditional.git diff --git a/mkrules b/mkrules index ea3afeb..3c5f935 100755 --- a/mkrules +++ b/mkrules @@ -24,14 +24,32 @@ chars () { done } +seenrules=/ +seenfoundries=/ + while read keyword rest; do case "$keyword" in '#'|'') continue ;; 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 ;; @@ -45,21 +63,41 @@ 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 - exec 3>rules/$newfoundry,$key.rules - echo >&3 '# -*- perl -*-' - echo >&3 '# autogenerated by mkrules' - echo >&3 'sub {' + 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 + ;; + *) + exec 3>rules/$newfoundry,$key.rules + echo >&3 '# -*- perl -*-' + echo >&3 '# autogenerated by mkrules' + echo >&3 'sub {' + seenrules=$seenrules$newfoundry,$key/ + ;; + esac + echo >&3 " # $pcf" ;; endrules) - echo >&3 '}' exec 3&3 " $rest" + ;; *) echo >&2 "??? $keyword" exit 1 @@ -77,4 +118,12 @@ while read keyword rest; do esac done +while :; do + case "$seenrules" in /) break ;; esac + seenrules=${seenrules#/} + rulefile=${seenrules%%/*} + seenrules=/${seenrules#*/} + echo "}" >>rules/$rulefile.rules +done + mv rules/foundries.new rules/foundries