#!/bin/sh DIRS="t1/adobe/Adobe_Jenson_Pro t1/adobe/Adobe_Garamond_Pro" FONTBASEDIR=~/share/fonts PSRESDIR=~/share/ghostscript/Resource; export PSRESDIR mkdir -p $PSRESDIR/Font $PSRESDIR/AFM oifs="$IFS"; IFS=" " for tail in $DIRS; do if [ "$IFS" != "$oifs" ]; then IFS="$oifs"; fi if [ -z "$tail" ]; then continue; fi case "$tail" in \#*) continue;; esac dir="$FONTBASEDIR/$tail" if [ ! -d "$dir" ]; then continue; fi find "$dir" -name '*.[Aa][Ff][Mm]' -exec sh -c ' file="{}" fontname=$(cat "$file" | \ nawk "/^FontName / {sub(/^[^ ]+ /, \"\"); printf \$0}") cp "$file" $PSRESDIR/AFM/$fontname' ';' find "$dir" -name '*.[Pp][Ff][Bb]' -exec sh -c ' file="{}" tail=$(basename $file) pfbtops "$file" >"$PSRESDIR/Font/${tail%.pfb}"' ';' done .