home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 504b.lha / Post_v1.6 / init.ps next >
Text File  |  1991-05-02  |  6KB  |  202 lines

  1. %! Post V1.6 initialisation file
  2. % (C) Adrian Aylward 1989, 1991
  3. %
  4. % You may freely copy, use, and modify this file
  5. %
  6. % This file should be run before most programs
  7.  
  8. % Version string, real number for programs that check it
  9.  
  10. /version (48.0) def
  11.  
  12. % Ignore CTRL/D
  13.  
  14. <04> cvn {} def
  15.  
  16. % A dummy status dictionary
  17.  
  18. /statusdict 10 dict dup begin
  19. /waittimeout 0 def
  20. /checkpassword { 0 eq } bind def
  21. /product (Post V1.6) def
  22. end def
  23.  
  24. % A dummy server dictionary
  25.  
  26. /serverdict 5 dict dup begin
  27. /exitserver { pop } bind def
  28. end def
  29.  
  30. % A scratch string
  31.  
  32. /=string 256 string def
  33.  
  34. % ISO Latin 1 encoding vector (omitting accents 90 - 9f)
  35.  
  36. systemdict
  37. /ISOLatin1Encoding [
  38. StandardEncoding 0 160 getinterval
  39. /space/exclamdown/cent/sterling
  40. /currency/yen/brokenbar/section
  41. /dieresis/copyright/ordfeminine/guillemotleft
  42. /logicalnot/hyphen/registered/macron
  43. /degree/plusminus/twosuperior/threesuperior
  44. /acute/mu/paragraph/periodcentered
  45. /cedilla/onesuperior/ordmasculine/guillemotright
  46. /onequarter/onehalf/threequarters/questiondown
  47. /Agrave/Aacute/Acircumflex/Atilde
  48. /Adieresis/Aring/AE/Ccedilla
  49. /Egrave/Eacute/Ecircumflex/Edieresis
  50. /Igrave/Iacute/Icircumflex/Idiereses
  51. /Eth/Ntilde/Ograve/Oacute
  52. /Ocircumflex/Otilde/Odieresis/multiply
  53. /Oslash/Ugrave/Uacute/Ucircumflex
  54. /Udieresis/Yacute/Thorn/germandbls
  55. /agrave/aacute/acircumflex/atilde
  56. /adieresis/aring/ae/ccedilla
  57. /egrave/eacute/ecircumflex/edieresis
  58. /igrave/iacute/icircumflex/idiereses
  59. /eth/ntilde/ograve/oacute
  60. /ocircumflex/otilde/odieresis/divide
  61. /oslash/ugrave/uacute/ucircumflex
  62. /udieresis/yacute/thorn/ydieresis
  63. ] put
  64.  
  65. % Run a program with save and restore
  66.  
  67. /runsave
  68. { /saveobject save def
  69.   run
  70.   saveobject restore
  71. } bind def
  72.  
  73. % Run a program displaying its name
  74.  
  75. /runprog
  76. { dup print (\n) print
  77.   runsave
  78. } bind def
  79.  
  80. % New cache parameters ops
  81.  
  82. systemdict
  83. /setcacheparams
  84. { counttomark 1 ge { dup setcachelimit } if
  85.   cleartomark
  86. } bind put
  87.  
  88. systemdict
  89. /currentcacheparams
  90. { mark cachestatus 6 { exch pop} repeat dup
  91. } bind put
  92.  
  93. % Load a font file.  Build the file name string from the font name, prefix
  94. % and suffix strings.  We pop the dictionary stack first, so that the
  95. % contents of any additional entries on it can't interfere with the font
  96. % definition - e.g. if it uses the bind operator.  Then we try to open the
  97. % file.  If it opens OK we execute it; if the open fails we return without
  98. % error: presumabaly we don't have the font.  Before returning we restore the
  99. % dictionary stack.
  100.  
  101. systemdict
  102. /loadfont
  103. { 1 index =string copy                         % Prefix:
  104.   length                                       % length
  105.   3 index =string 2 index 100 getinterval cvs  % Prefix:name
  106.   length add                                   % length
  107.   1 index =string 2 index 100 getinterval copy % Prefix:name.suffix
  108.   length add                                   % length
  109.   =string exch 0 exch getinterval              % Truncate to length
  110.   mark countdictstack 2 sub
  111.       { currentdict end } repeat               % Pop dict stack
  112.   counttomark 1 add index                      % Get the file name
  113.   { fontfile } stopped                         % Try to open the file
  114.   { pop }                                      % Can't open it, ignore
  115.   { cvx exec }                                 % Opened OK, execute it
  116.   ifelse
  117.   counttomark { begin } repeat pop             % Restore dictionary stack
  118.   pop pop pop pop                              % Pop file name and arguments
  119. } bind put
  120.  
  121. % Find a font.  If it is not there we try in order:
  122. %
  123. %    Load       PSFonts:name
  124. %    Load       CGFonts:PS/name.psfont
  125. %    Load       PSFonts:OtherFonts/name
  126. %    Substitute DefaultFont
  127. %
  128. % If none of these succeeds, the result will an invalidfont error.
  129.  
  130. systemdict /.findfont systemdict /findfont get def
  131.  
  132. systemdict
  133. /findfont
  134. {
  135. % Comment out the next 3 lines if you don't have a PSFonts: directory
  136.   dup FontDirectory exch known not             % Not in FontDirectory?
  137.   { dup (PSFonts:) () loadfont                 % Try to load from PSFonts:
  138.   } if
  139. % Comment out the next 3 lines if you don't have the Gold Disk CG fonts
  140. % dup FontDirectory exch known not             % Not in FontDirectory?
  141. % { dup (CGFonts:PS/) (.psfont) loadfont       % Try CGFonts:PS
  142. % } if
  143. % Comment out the next 3 lines if you don't have a PSFonts:OtherFonts
  144.   dup FontDirectory exch known not             % Not in FontDirectory?
  145.   { dup (PSFonts:OtherFonts/) () loadfont      % Try PSFonts:OtherFonts
  146.   } if
  147. % Substitute DefaultFont
  148.   dup FontDirectory exch known not             % Not in FontDirectory?
  149.   { dup userdict /DefaultFontName get ne       % Not the DefaultFont
  150.     { pop userdict /DefaultFontName get        % Substitue DefaultFont
  151.       dup systemdict /findfont get exec pop    % Recurse so it gets loaded
  152.     }
  153.     if
  154.   }
  155.   if
  156.   dup FontDirectory exch known not             % Not in FontDirectory?
  157.   { pop /DummyFont } if                        % Fall back on DummyFont
  158.   .findfont                                    % If errors, will fail now
  159. } bind put
  160.  
  161. % Select a font
  162.  
  163. systemdict
  164. /selectfont
  165. { exch findfont exch
  166.   dup type /arraytype eq
  167.   { makefont }
  168.   { scalefont }
  169.   ifelse
  170.   setfont
  171. } bind put
  172.  
  173. % Define a dummy font - prints out big dots ...
  174.  
  175. /DummyFont 10 dict dup begin
  176. /FontName /DummyFont def
  177. /FontMatrix [0.001 0 0 0.001 0 0] def
  178. /FontType 3 def
  179. /FontBBox [0 -300 500 700] def
  180. /Encoding StandardEncoding def
  181. /BuildChar
  182. { pop pop
  183.   500 0 50 0 450 400 setcachedevice
  184.   250 200 200 0 360 arc fill
  185. } bind def
  186. /Painttype 0 def
  187. end definefont pop
  188.  
  189. % Establish the dummy font as the default, as some fonts need it to
  190. % define themselves.
  191.  
  192. /DefaultFontName /DummyFont def
  193.  
  194. % Uncomment the following line to use FunkyFont as the default font
  195.  
  196. %/DefaultFontName /FunkyFont def
  197.  
  198. % Uncomment the following line to use Courier as the default font
  199.  
  200. /DefaultFontName /Courier def
  201.  
  202.