home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / usr / bin / font_update_2.0 < prev    next >
Text File  |  1996-08-30  |  3KB  |  116 lines

  1. #!/bin/csh -f
  2. #
  3. # NAME:
  4. #
  5. #       font_update_2.0   updates PostScript fonts for 2.0 WindowServer
  6. #
  7. # SYNOPSIS:    
  8. #
  9. #    font_update_2.0 [dir1 dir2 ...]
  10. #
  11. #
  12. # DESCRIPTION:
  13. #
  14. #    font_update_2.0 is a C shell script used to reorganize NextStep
  15. #    font directories under NextStep release 2.0.  Fonts in NextStep
  16. #    exist in three subdirectories:
  17. #
  18. #    /NextLibrary/Fonts
  19. #    /LocalLibrary/Fonts
  20. #    ~/Library/Fonts
  21. #    
  22. #    Previously, each PostScript font had its component files split into
  23. #    three subdirectories (outline, bitmap, and afm).  Now, all of the
  24. #    information for a given font is stored in a single subdirectory
  25. #    call <fontname>.font.  For example, in the new scheme, an ls of
  26. #    /NextLibrary/Fonts will give:
  27. #
  28. #    Courier-Bold.font
  29. #    Courier-BoldOblique.font
  30. #    Courier-Oblique.font
  31. #    Courier.font
  32. #    Helvetica-Bold.font
  33. #    <etc>
  34. #
  35. #    This new structure allows fonts to be simply maintained using the
  36. #    Workspace.
  37. #
  38. #    This shell script builds this new structure for whatever fonts
  39. #    exist in <dir>/Fonts/outline directory.  If no argument is 
  40. #    passed, ~/Library is used.  It also leaves behind symbolic links
  41. #    for the old style allowing older appkits, and applications who rely
  42. #    on the old font organization to work.  The WindowServer itself supports
  43. #    both organizations.
  44. #
  45. #  EXAMPLES:
  46. #
  47. #    root should do the following during a 2.0 update.
  48. #
  49. #    >font_update_2.0 /NextLibrary /LocalLibrary
  50. #    
  51. #    users with fonts in ~/Library should do the following to update their
  52. #    personal fonts (most people don't have any).
  53. #
  54. #    >font_update_2.0 
  55. #    >
  56.  
  57. switch($#argv)
  58.  
  59.     case 0:
  60.         echo font_update: updating user fonts
  61.         echo user: $USER
  62.         echo home: $HOME
  63.         set fdirs = $HOME/Library
  64.         breaksw
  65.     default:
  66. #         do passed in args
  67.         set fdirs=($argv)
  68.         echo font_update: updating fonts in $fdirs
  69.         breaksw
  70. endsw
  71. set noglob
  72. set nonomatch
  73. foreach fontdir ($fdirs)
  74.     echo font_update: Updating Directory: $fontdir/Fonts
  75.     if -e $fontdir/Fonts/outline then
  76.         cd $fontdir/Fonts/outline
  77.         set pat = *
  78.         unset noglob ; set files = $pat ; set noglob;
  79.         if($pat == $files[1]) set files = ()
  80.         foreach font ($files)
  81.             echo font_update: Updating Font: $font
  82.             mkdirs ../$font.font
  83.             pushd ../$font.font > /dev/null
  84.             foreach file (    ../outline/$font ../afm/$font.afm )
  85.                 if (-e $file &&  ! -e $file:t) then
  86.                     mv -f $file $file:t
  87.                     ln -s ../$font.font/$file:t $file
  88.                 endif
  89.             end
  90.             set pat = ../afm/Screen-$font.*.afm
  91.             unset noglob ; set files = $pat ; set noglob;
  92.             if($pat == $files[1]) set files = ()
  93.             foreach file ($files)
  94.                 if (-e $file && ! -e $file:t) then
  95.                     mv -f $file $file:t
  96.                     ln -s ../$font.font/$file:t $file
  97.                 endif
  98.             end
  99.             set pat = ../bitmap/$font.[lb]epf
  100.             unset noglob ; set files = $pat ; set noglob;
  101.             if($pat == $files[1]) set files = ()
  102.             foreach file ($files)
  103.                 if (-e $file && ! -e $file:t) then
  104.                     mv -f $file $file:t
  105.                     ln -s ../$font.font/$file:t $file
  106.                 endif
  107.             end
  108.             popd > /dev/null
  109.         end
  110.     else
  111.         echo font_update: no fonts found in $fontdir
  112.     endif
  113. end
  114.  
  115.         
  116.