home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- (
- echo
- echo --------------------------------------------------------------------------------
- echo truetype font convert -- copyright onevision -- 13.11.1996
- error=0
- cmd=`echo $0 | awk '{k=$1; while(length(k)>0&&substr(k,length(k),1)!="/") k=substr(k,1,length(k)-1); printf k}'`
- cmd1=$cmd`echo parsett`
- cmd2=$cmd`echo genafm`
-
- if [ $1 ]; then
- fdir=$1
- else
- fdir=$HOME/Library/Fonts
- fi
-
- if [ -d $fdir ]; then
- cd $fdir
- else
- echo Error: Directory $fdir does not exist
- exit 1
- fi
-
- echo Font $2/$3
- $cmd1 " " $2/$3 > /tmp/$3.convtt
- if [ ! $? -eq 0 ]; then
- echo Error during converting $2/$3
- exit 1;
- fi
- name=`head /tmp/$3.convtt | awk '/^\/FontName/ { printf substr ($2, 2, length($2)-1) }'`
- if [ -d /tmp/$name`echo .font` ]; then
- rm -r /tmp/$name`echo .font`
- if [ $? -eq 0 ]; then
- echo Error during deleting font /tmp/$name`echo .font`
- exit 1;
- fi
- fi
- mkdir /tmp/$name`echo .font`
- echo AFM $name`echo .font/$name`.afm
- mv /tmp/$3.convtt /tmp/$name`echo .font/$name`
- if [ -d $1/$name`echo .font` ]; then
- rm -r $1/$name`echo .font`
- fi
- $cmd2 -o /tmp/$name`echo .font/$name`.afm /tmp/$name`echo .font/$name`
- if [ $? -eq 0 ]; then
- cp -r /tmp/$name`echo .font` $1
- if [ $? -eq 0 ]; then
- rm -r /tmp/$name`echo .font`
- else
- echo Error moving font to directory $1
- error=1
- fi
- else
- echo Error during deleting old font $1/$name`echo .font`
- fi
- if [ $error -eq 1 ]; then
- echo --------------------------------------------------------------------------------
- echo Attention: There were errors in converting the font. Please check!
- else
- echo Font '-->' $2/$3 '<--' converted!
- fi
- exit $error
- ) 2>&1
-