#!/bin/sh -e # to test POSIX-correctness, change hash-bang to /bin/bash and uncomment # the following line: # set -o posix # Very simple configuration script for t1lib. Checks a couple of # directories that might contain fonts, and if they exist, adds # anything ending in .pfa or pfb to the font database. A few things # borrowed from paperconfig, (C) 1996, Yves Arrouye # # note that this creates the "minimal" font database accepted by t1lib, # and doesn't look in every possible place for fonts. It is mostly # provided so that xglyph will work out of the box... # Written by David Huggins-Daines usage() { if [ "$1" = -h ] then exec 1>&2 echo -n U else echo -n u fi echo "sage: `basename $0` [ -v, --version ] [ -h, --help ] [ --force ]" echo " [ fontdirs... ]" if [ "$1" = -h ] then cat <" exit 0 ;; -h|--help) usage -h ;; --force) force=1 ;; *) # hairy way to remove a trailing backslash (should use perl) pat=`expr $1 : "\(.*\)\/\$" || echo $1` # hairier way to find a string anywhere in another string # should really use perl. if ! grep $pat </dev/null 2>&1 $fontdirs EOF then fontdirs="$fontdirs $1" fi ;; esac shift done # We presume that if the database exists, then so does the # configuration file. Hopefully this won't break anything. if [ $force -eq 1 ] || [ ! -e $dbase ]; then fontpath="" afmpath="" mkdir -p $confdir || true echo -n "Searching for Type 1 fonts and AFM files..." for i in $fontdirs do if [ -d $i ] && ls $i/*.pf[ab] > /dev/null 2>&1; then if [ -n "$fontpath" ]; then fontpath="$fontpath:$i" else fontpath="$i" fi if ls $i/*.afm > /dev/null 2>&1; then if [ -n "$afmpath" ]; then afmpath="$afmpath:$i" else afmpath="$i" fi fi # get a listing of all the fonts in each dir find $i -maxdepth 1 -name *.pf[ab] -printf '%f\n' >> $temp fi done if [ -z "$fontpath" ]; then cat < $dbase cat $temp >> $dbase rm -f $temp echo "done." fi # now set the paths in the config file cat <$conffile t1lib.config - global configuration file for t1lib. It was created automatically on `date` by the t1libconfig script. Run /usr/sbin/t1libconfig --force to rebuild it. ENCODING=. AFM=$afmpath TYPE1=$fontpath FONTDATABASE=$dbase EOF else echo "Configuration and font database files already exist." echo "Run /usr/sbin/t1libconfig --force to rebuild them." fi exit 0