#!/usr/local/bin/bash # # 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 # November 1995 (Piet Tutelaers, rcpt@urc.tue.nl) # - generate new meaningfull checksums # - group (hacked) fontinst files in separate directory (./finst) # - make script restartable, steps: # 1) run fontinst (result: ${EXPERT}${FAMILY}.rdy) # 2) install DVIPS files (result: ${OUT}/dvips) # 3) install TFM and VF files (result: ${OUT}/vf) # 4) install TFM files (result: ${OUT}/tfm) # 5) install TEX files (result: ${OUT}/tex) # 6) install README file (result: ${OUT}/README) # removing a single target will result in the recreation of only # those files makeing up that step. Removing the first target will # generate everything from scratch. # - add a clean-fam script # November 23 1995. PT's changes agreed by SPQR, released for CTAN # December 11 1995. Whoops. Problems with checksums, reissued. added -zap # January 26th 1996. STILL problems, hopefully last issue #---------------------------------------------------------------- # 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 "&2; shift;; *) break;; esac done # Provide a usage message to refresh human memories. if test \( $# -lt 3 \) then echo "Usage: make-fam [-zap] [-download] [-sans] [-tt] [-out ] fam family foundry\ [ fd code]" exit 1 fi # # work out the family name and an 8 character abbreviation # # this results in # $F 3 character family name # $VAR remainder # $FOUNDRY font foundry # $FAMILY abbreviated family name # $FULLFAMILY full family name # FX=$1 F=`expr ${FX} : '^\(...\).*$'` VAR=`expr ${FX} : '^...\(.*\)$'` FAMILY=$2 FOUNDRY=$3 FDCODE=$4 if test "$OUTDIR"x = "x" then OUT=../$FOUNDRY/$FAMILY else OUT=${OUTDIR}/${FAMILY} fi # # Copy all necessary AFM files from ../afm directory # if test -d ../afm/$FOUNDRY/$FX then ${CP} ../afm/$FOUNDRY/$FX/*.afm . if test "`ls ${F}*.afm`" = "" then echo "Don't see any proper AFM files for $1" exit 1 fi else echo "No source of AFM files in ../afm/$FOUNDRY/$FX" exit 1 fi # Get PostScript fontname FF=`grep FontName ${F}*${VAR}*8a*.afm | sed 's/.*FontName //' | \ sed 's/^M//' | sort | uniq | tail -1` FULLFAMILY=`grep FamilyName ${F}*${VAR}*8a*.afm | head -1 | awk '{print $2,$3,$4}'` # # Because fontinst does take quite some time we write a file # when we are completely finished. # if test ! -r ${EXPERT}${FAMILY}.rdy then # Remove possible results left from previous round echo Cleaning up ${RM} -f ${FX}.map ${RM} -f ${EXPERT}${FAMILY}.sty rm -rf ${OUT} rm -f config.${FX} rm -f *${FX}*.fd echo work on $F${EXPERT} [$VAR] / $FAMILY /$FULLFAMILY "-->" $OUT echo "${BS}nonstopmode" > ${FAMILY}.tex echo "${BS}input fontinst.sty" >> ${FAMILY}.tex if test "${NARROW}"x != "x"; then echo "${BS}fakenarrow{$NARROW}" >> ${FAMILY}.tex fi echo "${BS}latinfamily{$F${EXPERT}${VAR}}{$EXTRA$FDCODE}" >> ${FAMILY}.tex echo "${BS}openout15=${EXPERT}${FAMILY}.rdy ${BS}write15{Finished.}" >> ${FAMILY}.tex echo "${BS}bye." >> ${FAMILY}.tex #-------------------------------------------------------- # now run TeX with the fontinst macros. could take a while. # -------------------------------------------------------- tex ${FAMILY} fi # # Abort if we have don't have ${EXPERT}${FAMILY}.rdy now # if test ! -r ${EXPERT}${FAMILY}.rdy then echo "fontinst: error (${EXPERT}${FAMILY}.rdy not found)" exit 1 fi # # Install config and map files # if test ! -d ${OUT}/dvips then ${RM} -f ${FX}.map if test ! -d ${OUT} then ${MKDIR} ${OUT} fi echo Installing DVIPS files in ${OUT}/dvips ${MKDIR} ${OUT}/dvips for i in ${F}*8r*.pl do Y=`basename $i .pl` Z=`echo $Y | sed 's/8r/8a/'` 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 else oblique=`grep "Faking oblique font ${Y}" ${FAMILY}.log` if test "$oblique" = "" then echo "No mapping for $i (${Z}.afm file missing?)" 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 " ${FAMILY}.log | \ awk '{print $2":"$4":"$6}' | sort | uniq` for i in $FAKES do echo Look at fake case $i STYLE=`expr "$i" : '\([^:]*\):[^:]*:[^:]*$'` FAKE=`expr "$i" : '[^:]*:\([^:]*\):[^:]*$'` REAL=`expr "$i" : '[^:]*:[^:]*:\([^:]*\)$'` UP=`expr $REAL : '\(.*\)8..*$'` ENC=`expr $REAL : '.*\(8.\).*$'` SUF=`expr $REAL : '.*8.\(.*\)$'` echo Fake ${STYLE} ${FAKE} from ${UP} ${SUF} "+" ${ENC} EXTRA= NEED8R= if test "${STYLE}" = "narrow"; then EXTRA="${EXTRA}.${NARROW} ExtendFont " fi if test "${STYLE}" = "oblique"; 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 echo "p +${FX}.map" > config.${FX} cat config.${FX} >> ${OUT}/dvips/config.${FX} cat ${FX}.map >> ${OUT}/dvips/${FX}.map fi #--------------------------- # Install .vf and .tfm files #--------------------------- if test \( ! -d ${OUT}/tfm \) -a \( ! -d ${OUT}/vf \) then echo Installing TFM files in ${OUT}/tfm ${MKDIR} ${OUT}/tfm echo Installing VF files in ${OUT}/vf ${MKDIR} ${OUT}/vf for i in ${F}*.vpl do Z=`basename $i .vpl` if test -r $Z.vf then ${CP} $Z.vf $OUT/vf/$Z.vf ${CP} $Z.tfm $OUT/tfm/$Z.tfm else firstline=`head -1 $i` if test "$firstline" != "(COMMENT new FONTCHECKSUMs added)" then addchecksum ${FX}.map $Z else echo vptovf $Z.vpl $Z.vf $Z.tfm vptovf $Z.vpl $Z.vf $Z.tfm fi ${CP} $Z.vf $OUT/vf/$Z.vf ${CP} $Z.tfm $OUT/tfm/$Z.tfm fi done # # and now the .pl files for which no VPL files exist # for i in ${F}*.pl do Z=`basename $i .pl` zap=`expr $i : ".*\(8a\).*pl"` if test "$zap" != "8a" then if test ! -r $OUT/tfm/$Z.tfm then echo pltotf $Z.pl $Z.tfm pltotf $Z.pl $Z.tfm ${CP} $Z.tfm ${OUT}/tfm/$Z.tfm fi fi done fi # #------------------- # Install .afm files #------------------- if test ! -d ${OUT}/afm then echo Installing AFM files in ${OUT}/afm ${MKDIR} ${OUT}/afm ${CP} $F*.afm ${OUT}/afm fi #------------------- # Install tex files #------------------- if test ! -d ${OUT}/tex then echo Installing TEX files in ${OUT}/tex ${MKDIR} ${OUT}/tex # # install the fd and sty files # ${CP} *${FX}*.fd ${OUT}/tex if test "$MAKESTYLE"x = "x" then # # Make LaTeX2e package # cat > ${OUT}/tex/${EXPERT}${FAMILY}.sty << HERE \def\fileversion{1} \def\filedate{`date +%Y/%m/%d`} \ProvidesPackage{${EXPERT}${FAMILY}}[\filedate\space\fileversion \space PSNFSS LaTeX2e package loading ${FULLFAMILY}] \renewcommand{${TYPE}default}{$F${VAR}${EXPERT}} \endinput HERE fi # # special case for Lucida scaling # if test "$LUCIDA"x != "x" then for i in *${FX}.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$$ ${OUT}/tex/$i done fi # # 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 fi if test ! -r ${OUT}/README then echo Installing README in ${OUT} cat > ${OUT}/README < ${OUT}/README <