home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Paint / alpha1.dms / in.adf / Data.lha / init.ps < prev    next >
Encoding:
Text File  |  1994-06-08  |  6.5 KB  |  240 lines

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