home *** CD-ROM | disk | FTP | other *** search
/ OneVision 3.03 / OneVision3.03.iso / Apps / TTFontConvert.app / fpc < prev    next >
Text File  |  1996-11-13  |  2KB  |  64 lines

  1. #!/bin/sh
  2. (
  3. echo
  4. echo --------------------------------------------------------------------------------
  5. echo truetype font convert -- copyright onevision -- 13.11.1996
  6. error=0
  7. cmd=`echo $0 | awk '{k=$1; while(length(k)>0&&substr(k,length(k),1)!="/") k=substr(k,1,length(k)-1); printf k}'`
  8. cmd1=$cmd`echo parsett`
  9. cmd2=$cmd`echo genafm`
  10.  
  11. if [ $1 ]; then
  12.     fdir=$1
  13. else
  14.     fdir=$HOME/Library/Fonts
  15. fi
  16.  
  17. if [ -d $fdir ]; then
  18.     cd $fdir
  19. else
  20.     echo Error: Directory $fdir does not exist
  21.     exit 1
  22. fi
  23.  
  24. echo Font $2/$3
  25. $cmd1 " " $2/$3 > /tmp/$3.convtt
  26. if [ ! $? -eq 0 ]; then
  27.     echo Error during converting $2/$3  
  28.     exit 1;
  29. fi
  30. name=`head /tmp/$3.convtt | awk '/^\/FontName/ { printf substr ($2, 2, length($2)-1) }'`
  31. if [ -d /tmp/$name`echo .font` ]; then
  32.     rm -r /tmp/$name`echo .font`
  33.     if [ $? -eq 0 ]; then
  34.         echo Error during deleting font /tmp/$name`echo .font`
  35.         exit 1;
  36.     fi
  37. fi 
  38. mkdir /tmp/$name`echo .font`
  39. echo AFM $name`echo .font/$name`.afm
  40. mv /tmp/$3.convtt /tmp/$name`echo .font/$name`
  41. if [ -d $1/$name`echo .font` ]; then
  42.     rm -r $1/$name`echo .font`
  43. fi
  44. $cmd2 -o /tmp/$name`echo .font/$name`.afm /tmp/$name`echo .font/$name`
  45. if [ $? -eq 0 ]; then
  46.     cp -r /tmp/$name`echo .font` $1
  47.     if [ $? -eq 0 ]; then
  48.         rm -r /tmp/$name`echo .font`
  49.     else
  50.         echo Error moving font to directory $1
  51.         error=1
  52.     fi
  53. else
  54.     echo Error during deleting old font $1/$name`echo .font`
  55. fi
  56. if [ $error -eq 1 ]; then
  57.     echo --------------------------------------------------------------------------------
  58.     echo Attention: There were errors in converting the font. Please check!
  59. else
  60.     echo Font '-->' $2/$3 '<--' converted!
  61. fi
  62. exit $error
  63. ) 2>&1    
  64.