#!/bin/sh FONTLIST=~/share/ghostscript/lib/fontlist FONTBASEDIR=~/share/fonts PSRESDIR=~/share/ghostscript/Resource; export PSRESDIR rm -rf $PSRESDIR/Font $PSRESDIR/AFM mkdir -p $PSRESDIR/Font $PSRESDIR/AFM oifs="$IFS"; IFS=" " for tail in $(cat $FONTLIST); 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 if [ -f "${file%.afm}.pfb" ]; then pfbtops "${file%.afm}.pfb" >$PSRESDIR/Font/$fontname else cp "${file%.afm}.pfa" $PSRESDIR/Font/$fontname fi' ';' done .