5 font
=`basename $1 .tfm`
7 if [ $# -ne 1 -o "$tfm" = "$font" ]; then
8 echo "Usage: tfmtoafm TFM-FILE"
10 echo "example: tfmtoafm cmr10.tfm"
14 size
=`echo $font | sed "s/[^0-9]*//"`
16 fontfile
=`kpsewhich $font.tfm`
19 rm -f $t1 $t2 $font $afm
21 for i
in `seq 1 127`; do printf "%d Character-%d\n" $i $i >> $t1; done
22 tfmtodit
$fontfile $t1 $font
24 scaling
=`awk -v OFMT='%.5f' '/designsize/ {print $2/'$size/1000} $font`
25 tail -127 $font | cut
-f 1-2 > $t1
26 cat $t1 | cut
-d, -f 1-2 > $t2
28 #nl -ba $t2 | awk -F '[ \t,]+' '{print "C "$2";\t"$3";\tB 0.00 0.00 "$4/'"$scaling"'" "$5/'"$scaling"'";"}' > $t1
29 nl -ba $t2 |
awk -F '[ \t,]+' '{print "C "$2" ; WX 0 ; N "$3" ; B 0.00 0.00 "$4/'"$scaling"'" "$5/'"$scaling"'" ;"}' > $t1
31 count
=`cat $t1 | wc -l`
36 StartCharMetrics $count
38 # urg 0 is difficult but we need it
39 head -1 $t1 |
sed -e "s/C 1 ;/C 0 ;/" -e "s/-1 ;/-0 ;/" >> $afm