home *** CD-ROM | disk | FTP | other *** search
- %! Post V1.1 initialisation file
- % (C) Adrian Aylward 1989, 1990
- %
- % You may freely copy, use, and modify this file
- %
- % This file should be run before most programs
-
- % Ignore CTRL/D
-
- <04> cvn {} def
-
- % A dummy status dictionary
-
- /statusdict 10 dict dup begin
- /waittimeout 0 def
- /checkpassword { 0 eq } bind def
- end def
-
- % A dummy server dictionary
-
- /serverdict 5 dict dup begin
- /exitserver { pop } bind def
- end def
-
- % A scratch string
-
- /=string 256 string def
-
- % Run a program with save and restore
-
- /runsave
- { /saveobject save def
- run
- saveobject restore
- } bind def
-
- % Run a program displaying its name
-
- /runprog
- { dup print (\n) print
- runsave
- } bind def
-
- % New cache parameters ops
-
- /setcacheparams
- { counttomark 1 ge { dup setcachelimit } if
- cleartomark
- } bind def
-
- /currentcacheparams
- { mark cachestatus 6 { exch pop} repeat dup
- } bind def
-
- % Select a font. (Allow for redefinition of findfont after binding)
-
- /selectfont
- { exch /findfont load exec exch
- dup type /arraytype eq
- { makefont }
- { scalefont }
- ifelse
- setfont
- } bind def
-
- % Load a font file. Build the file name string from the font name, prefix
- % and suffix strings. We pop the dictionary stack first, so that the
- % contents of any additional entries on it can't interfere with the font
- % definition - e.g. if it uses the bind operator. Then we try to open the
- % file. If it opens OK we execute it; if the open fails we return without
- % error, presumabaly we don't have the font. Before returning we restore the
- % dictionary stack.
-
- /loadfont
- { 1 index =string copy % Prefix:
- length % length
- 3 index =string 2 index 100 getinterval cvs % Prefix:name
- length add % length
- 1 index =string 2 index 100 getinterval copy % Prefix:name.suffix
- length add % length
- =string exch 0 exch getinterval % Truncate to length
- mark countdictstack 2 sub
- { currentdict end } repeat % Pop dict stack
- counttomark 1 add index % Get the file name
- { (r) file } stopped % Try to open the file
- { pop pop } % Can't open it, ignore
- { cvx exec } % Opened OK, execute it
- ifelse
- counttomark { begin } repeat pop % Restore dictionary stack
- pop pop pop pop % Pop file name and arguments
- } bind def
-
- % Find a font. If it is not there we try in order:
- %
- % Load CGFonts:PS/name.psfont
- % Load PSFonts:name
- % Substitute DefaultFont
- %
- % If none of these succeeds, the result will an invalidfont error.
-
- /findfont
- {
- % Comment out the next 3 lines if you don't have the Gold Disk CG fonts
- % dup FontDirectory exch known not % Not in FontDirectory?
- % { dup (CGFonts:PS/) (.psfont) loadfont % Try to load from CGFonts:PS
- % } if
- % Comment out the next 3 lines if you don't have a PSFonts: directory
- dup FontDirectory exch known not % Not in FontDirectory?
- { dup (PSFonts:) () loadfont % Try to load from PSFonts:
- } if
- % Substitute DefaultFont
- dup FontDirectory exch known not % Not in FontDirectory?
- { FontDirectory /DefaultFont known % DefaultFont defined?
- { pop /DefaultFont } if % Substitute DefaultFont
- } if
- systemdict /findfont get exec % If errors, will fail
- } bind def
-
- % Define a dummy font
-
- /DummyFont 10 dict dup begin
- /FontName /DummyFont def
- /FontMatrix [0.001 0 0 0.0001 0 0] def
- /FontType 3 def
- /FontBBox [0 0 0 0] def
- /Encoding StandardEncoding def
- /BuildChar { pop pop 0 0 0 0 0 0 setcachedevice } def
- /Painttype 0 def
- end definefont pop
-
- % Establish the dummy font as the default, as some fonts need it to
- % define themselves.
-
- FontDirectory /DefaultFont /DummyFont findfont put
-
- % If you don't have Courier, comment this line out, or replace it with any
- % font you prefer.
-
- FontDirectory /DefaultFont /Courier findfont put
-
-