home *** CD-ROM | disk | FTP | other *** search
/ VRML Tools for 3D Cyberspace / VRML_Tools_For_3D_Cyberspace.iso / t_space2 / init.psp < prev    next >
Text File  |  1996-07-01  |  6KB  |  210 lines

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