1#!/bin/bash 2 3# A quite grotty script for converting proper TFM files to the 4# idiosyncratic format that SML-Tex expects its font metrics to be 5# in. The script requires parseTFMPL.red to be in the working directory. 6 7# Example usage: ./convertTFM.sh cmex10.tfm EX10 8# ./convertTFM.sh cmmi8.tfm MI8 375 9# The third argument (optional) is the skewchar (in decimal). 10 11# The output of tftopl is essentially a single sexpr 12# except missing opening and closing parens, so I put them in. 13echo "(" >temppl 14tftopl -charcode-format=octal "$1" >>temppl 15echo ")" >>temppl 16 17# We want to invoke an RLISP function parse_tfm_file from parseTFMPL.red, 18# and since I don't know how to do command-line arguments in RLISP, 19# I just append the call here to parseTFMPL.red and point Reduce at that file. 20cp parseTFMPL.red tempred 21echo "" >>tempred 22echo -n "parse_tfm_file(\"temppl\", \"$2\", " >>tempred 23if [[ -z $3 ]] 24then 25 echo "nil);" >>tempred 26else 27 echo "$3);" >>tempred 28fi 29echo "end;" >>tempred 30 31reduce -w tempred 32rm tempred temppl