#!/bin/sh # This script writes a .tex file which does the necessary work # of converting Adobe Font Metric files for a `normal' font family, # runs fontinst on it, converts the resulting files, # and installs them in distribution directories. # # (c) Sebastian Rahtz February 6th 1994 # March 15th 1994 # May 5th 1994 # May 8th 1994 # ---------------- fontinst first real release ------- # June 7th 1994 (switched to \latinfamily) # November 10th 1994 cleaned up expert font handling # February 1995 cleaned again # March 1995, version for new naming scheme and 8r # October 1995 (David Hull ) -narrow #---------------------------------------------------------------- # The user has to supply the Berry family name, and (optionally) # any special code to run when the family is loaded. # The output is: # - three .fd files (one for T1, one for OT1, and one for 8r) # - .tfm and .vf files # - a file .map (could be appended to psfonts.map (for dvips)) # - a file config. (for use with dvips, referencing psfonts.) # - a file .sty package file for trivial use of font family # Intermediate files are deleted. # # Options: # -download means that the lines written to psfonts. have "] [-narrow ] family [fd code]" exit 1 fi # # where to put the results # #TEXINPUTS=$S/encoding/tools: OUTDIR=. RM=rm MV=mv # # defaults # MAP=../tools/fontname.map EXPERT= EXTRA= MINIONMM= LUCIDA= DOWNLOAD= NARROW= STYLE="x" TYPE="rm" while true; do case $1 in -download) shift ; DOWNLOAD=y ;; -tt) shift ; TYPE="tt" ; EXTRA='\hyphenchar\font=-1' ;; -sans) shift ; TYPE="sf" ;; -out) shift ; OUTDIR=$1 ; shift ;; -narrow) shift ; NARROW=$1 ; shift ;; -expert) shift ; EXPERT="x" ;; -minionmm) shift ; MINIONMM="x" ;; -nosty) shift ; STYLE= ;; -lucida) shift ; LUCIDA="y" ;; -*) echo $0: illegal option - $1 1>&2; shift;; *) break;; esac done # # work out the family name and an 8 character abbreviation # # this results in # $F 3 character family name # $VAR remainder # $FF family name # $FFF abbreviated family name # FX=$1 F=`expr $1 : '^\(...\).*$'` VAR=`expr $1 : '^...\(.*\)$'` FF=`grep FontName ${F}*${VAR}*8a*.afm | sed 's/.*FontName //' | sed 's/ //' | sort | uniq | head -1` D='$3' L='$2' if test "${MINIONMM}"x != "x" then FFF=minionmm else FFF=`awk '$1 == "'$FF'" {print $2}' ${MAP}` fi if test "${FFF}"x = "x" then echo cannot find short form for ${FF} in ${MAP} exit 1 fi OUT=${OUTDIR}/${FFF} FFFF=`echo $FF | sed 's/-[A-Z].*//'` echo work on $F${EXPERT} [$VAR] / $FF / $FFF /$FFFF "-->" $OUT echo '\nonstopmode' > $$${FFF}.tex echo '\input fontinst.sty' >> $$${FFF}.tex if test "${NARROW}"x != "x"; then echo '\fakenarrow{'$NARROW'}' >> $$${FFF}.tex fi echo '\latinfamily{'$F${EXPERT}${VAR}'}{'$EXTRA$2'}' >>$$${FFF}.tex echo '\bye' >> $$${FFF}.tex #-------------------------------------------------------- # now run TeX with the fontinst macros. could take a while. # -------------------------------------------------------- tex $$${FFF} echo convert the ascii .pl and .vpl files to binary #-------------------------------------------------------- for i in ${F}*.pl do Z=`basename $i .pl` pltotf $Z.pl $Z.tfm done for i in ${F}*.vpl do Z=`basename $i .vpl` vptovf $Z.vpl $Z.vf $Z.tfm done #-------------------------------------------------------- echo make up psfonts map entries # --------------------------------------------------- if test -f ${FX}.map then ${RM} ${FX}.map fi for i in ${F}*8r*.pl do echo mapping $i Y=`basename $i .pl` Z=`echo $Y | sed 's/8r/8a/'` echo "Check for a ${Z}.afm?" if test -f ${Z}.afm then X=`grep FontName ${Z}.afm | sed 's/FontName \([A-z0-9\-]*\).*/\1/'` if test "$DOWNLOAD"x != x then echo ${Y} $X "\"TeXBase1Encoding ReEncodeFont\" <8r.enc <"${Z}.pfb >> ${FX}.map else echo ${Y} $X "\"TeXBase1Encoding ReEncodeFont\" <8r.enc" >> ${FX}.map fi fi done if test "${EXPERT}"x != "x" then for i in ${F}*8x*.pl do Z=`basename $i .pl` echo "Check for a $Z.afm?" if test -f ${Z}.afm then X=`grep FontName ${Z}.afm | sed 's/FontName \([A-z0-9\-]*\).*/\1/'` if test "$DOWNLOAD"x != x then echo ${Z} $X "<"$Z.pfb >> ${FX}.map else echo ${Z} $X >> ${FX}.map fi fi done fi # # # locate the faked files FAKES=`grep "^Faking " $$${FFF}.log | awk '{print $2":"$4":"$6}' | sort | uniq` FAKE= for i in $FAKES; do FAKE="${FAKE} $i"; done FAKES=$FAKE for i in $FAKES do echo doing $i FAKE=`expr $i : '[^:]*:\([^:]*\):[^:]*$'` REAL=$FAKE NAR= OBL= while i=`expr " $FAKES " : '.* \([^%:]*:'$REAL':[^%:]*\) '` do echo " = $i" STYLE=`expr $i : '^\([^:]*\):[^:]*:[^:]*$'` REAL=`expr $i : '^[^:]*:[^:]*:\([^:]*\)$'` case $STYLE in narrow) NAR=narrow;; oblique) OBL=oblique;; esac done UP=`expr $REAL : '\(.*\)8..*$'` ENC=`expr $REAL : '.*\(8.\).*$'` SUF=`expr $REAL : '.*8.\(.*\)$'` echo Fake ${NAR} ${OBL} ${FAKE} from ${UP} ${SUF} "+" ${ENC} EXTRA= NEED8R= if test "${NAR}x" != x; then EXTRA="${EXTRA}.${NARROW} ExtendFont " fi if test "${OBL}x" != x; then EXTRA="${EXTRA}.167 SlantFont " fi if test "${ENC}" != "8x"; then ENC=`echo ${ENC} | sed 's/8r/8a/'` EXTRA="${EXTRA}TeXBase1Encoding ReEncodeFont " NEED8R=t fi if test "${EXTRA}x" != x; then EXTRA="\" ${EXTRA}\" " fi; if test "${NEED8R}x" != x; then EXTRA=${EXTRA}'<8r.enc ' fi X=`grep FontName ${UP}${ENC}${SUF}.afm | sed 's/FontName \([A-z0-9\-]*\).*/\1/'` if test "$DOWNLOAD"x != x; then EXTRA="${EXTRA}<${UP}${ENC}${SUF}.pfb " fi echo ${FAKE} $X $EXTRA >> ${FX}.map done # # dvips config file # echo "p +${FX}.map" > config.${F} # # LaTeX2e package # echo '\def\fileversion{1}' > ${EXPERT}${FFF}.sty echo '\def\filedate{'`date +%y/%m/%d`'}' >> ${EXPERT}${FFF}.sty echo '\ProvidesPackage{'${EXPERT}${FFF}'}[\filedate\space\fileversion' >> ${EXPERT}${FFF}.sty echo ' \space PSNFSS LaTeX2e package loading '${FF}']' >> ${EXPERT}${FFF}.sty echo '\renewcommand{\'${TYPE}'default}{'$F${EXPERT}'}' >> ${EXPERT}${FFF}.sty echo '\endinput' >> ${EXPERT}${FFF}.sty # # special case for Lucida scaling # if test "$LUCIDA"x != "x" then for i in *$1.fd do sed 's/DeclareFontShape/DeclareLucidaFontShape/' $i | \ sed 's/^\\DeclareFontFam/\\@ifundefined{DeclareLucidaFontShape}{\%|\\def\\DeclareLucidaFontShape#1#2#3#4#5#6{\%|\\DeclareFontShape{#1}{#2}{#3}{#4}{<->#5}{#6}}}{}|\\DeclareFontFam/' | \ sed '/sub /s/Lucida//' | \ sed 's/^ <-> //' | tr '|' '\012' > /tmp/fd$$ ${MV} /tmp/fd$$ $i done fi # # and delete the temporary files # ${RM} $$${FFF}.* ${RM} $F*.mtx ${RM} $F*.pl ${RM} $F*.vpl # # install the files in subdirectories # if test ! -d ${OUT} then mkdir ${OUT} mkdir ${OUT}/afm mkdir ${OUT}/vf mkdir ${OUT}/tfm mkdir ${OUT}/tex mkdir ${OUT}/dvips fi # # we have generated some intermediate 8a .pl files, which # got turned into tfm files. zap them. # ${RM} *8a*.tfm for i in tfm vf do ${MV} *.$i ${OUT}/$i done # # install the fd and sty files # ${MV} *.fd ${OUT}/tex if test "$STYLE"x != "x" then ${MV} *.sty ${OUT}/tex else ${RM} *.sty fi # # afm files # echo copy AFM files: ${F}*${VAR}8a*.afm cp ${F}*${VAR}8a*.afm ${OUT}/afm if test "${EXPERT}"x != "x" then cp ${F}*${VAR}8x.afm ${OUT}/afm fi # # config and map files # cat config.${F} >> ${OUT}/dvips/config.${F} ${RM} config.${F} cat ${FX}.map >> ${OUT}/dvips/${FX}.map ${RM} ${FX}.map # # now we have to fix the silly OML and OMS files. bleeargh. # echo make OMS and OML fd files for ${FX} # cat > $OUT/tex/OMS${FX}.fd < ssub * cmsy/m/n}{} \DeclareFontShape{OMS}{${FX}}{m}{it} {<-> ssub * cmsy/m/n}{} \DeclareFontShape{OMS}{${FX}}{m}{sl} {<-> ssub * cmsy/m/n}{} \DeclareFontShape{OMS}{${FX}}{m}{sc} {<-> ssub * cmsy/m/n}{} \DeclareFontShape{OMS}{${FX}}{b}{n} {<-> ssub * cmsy/b/n}{} \DeclareFontShape{OMS}{${FX}}{b}{it} {<-> ssub * cmsy/b/n}{} \DeclareFontShape{OMS}{${FX}}{b}{sl} {<-> ssub * cmsy/b/n}{} \DeclareFontShape{OMS}{${FX}}{b}{sc} {<-> ssub * cmsy/b/n}{} \endinput ENDOFCAT cat > $OUT/tex/OML${FX}.fd < ssub * cmm/m/it}{} \DeclareFontShape{OML}{${FX}}{m}{it} {<-> ssub * cmm/m/it}{} \DeclareFontShape{OML}{${FX}}{m}{sl} {<-> ssub * cmm/m/it}{} \DeclareFontShape{OML}{${FX}}{m}{sc} {<-> ssub * cmm/m/it}{} \DeclareFontShape{OML}{${FX}}{b}{n} {<-> ssub * cmm/b/it}{} \DeclareFontShape{OML}{${FX}}{b}{it} {<-> ssub * cmm/b/it}{} \DeclareFontShape{OML}{${FX}}{b}{sl} {<-> ssub * cmm/b/it}{} \DeclareFontShape{OML}{${FX}}{b}{sc} {<-> ssub * cmm/b/it}{} \endinput ENDOFCAT cat > ${OUT}/README <