home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / post.zip / init.ps < prev    next >
Text File  |  1990-03-04  |  2KB  |  75 lines

  1. %! Post V1.0 initialisation file
  2. % This file should be run before most programs
  3.  
  4. % Ignore CTRL/D
  5.  
  6. <04> cvn {} def
  7.  
  8. % A dummy status dictionary
  9.  
  10. /statusdict 10 dict dup begin
  11. /waittimeout 0 def
  12. end def
  13.  
  14. % A scratch string
  15.  
  16. /=string 256 string def
  17.  
  18. % Run a program with save and restore
  19.  
  20. /runsave
  21. { /saveobject save def
  22.   run
  23.   saveobject restore
  24. } bind def
  25.  
  26. % Run a program displaying its name
  27.  
  28. /runprog
  29. { dup print (\n) print
  30.   runsave
  31. } bind def
  32.  
  33. % Find a font.  If it is not there we attempt to download it from the
  34. % "PSFonts:" directory; if that fails we substitute DefaultFont if it has
  35. % been defined
  36.  
  37. /findfont
  38. { dup FontDirectory exch known not               % Not in FontDirectory?
  39.   { mark countdictstack 2 sub
  40.         { currentdict end } repeat               % Pop dict stack
  41.     counttomark 1 add index                      % Get the font name
  42.     { (PSFonts:) =string copy pop                % PSFonts:
  43.       =string 8 248 getinterval cvs length 8 add % PSFonts:name
  44.       =string exch 0 exch getinterval            % Truncate to length
  45.       run                                        % Load the font
  46.     } stopped { pop } if                         % Ignore errors for now
  47.     counttomark { begin } repeat pop             % Restore dictionary stack
  48.   } if
  49.   dup FontDirectory exch known not               % Still not there?
  50.   { FontDirectory /DefaultFont known             % DefaultFont defined?
  51.     { pop /DefaultFont } if                      % Substitute DefaultFont
  52.   } if
  53.   systemdict /findfont get exec                  % If errors, will fail
  54. } bind def
  55.  
  56. % Define a dummy font
  57.  
  58. /DummyFont 10 dict dup begin
  59. /FontName /DummyFont def
  60. /FontMatrix [0.001 0 0 0.0001 0 0] def
  61. /FontType 3 def
  62. /FontBBox [0 0 0 0] def
  63. /Encoding StandardEncoding def
  64. /BuildChar { pop pop 0 0 0 0 0 0 setcachedevice } def
  65. /Painttype 0 def
  66. end definefont pop
  67.  
  68.  
  69. % Define a default font
  70.  
  71. FontDirectory /DefaultFont /DummyFont findfont put
  72. %FontDirectory /DefaultFont /Courier findfont put
  73. %FontDirectory /DefaultFont /Times-Roman findfont put
  74.  
  75.