home *** CD-ROM | disk | FTP | other *** search
- % (C) Adrian Aylward 1989, 1991
- %
- % You may freely copy, use, and modify this file
- %
- % This file should be run before most programs
-
- % Version string, real number for programs that check it
-
- /version (48.0) def
-
- % Ignore CTRL/D
-
- <04> cvn {} def
-
- % A dummy status dictionary
-
- /statusdict 10 dict dup begin
- /waittimeout 0 def
- /checkpassword { 0 eq } bind def
- /product (Post V1.6) 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
-
- % ISO Latin 1 encoding vector (omitting accents 90 - 9f)
-
- systemdict
- /StandardEncoding [
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/exclam/quotedbl/numbersign
- /dollar/percent/ampersand/quoteright
- /parenleft/parenright/asterisk/plus
- /comma/minus/period/slash
- /zero/one/two/three
- /four/five/six/seven
- /eight/nine/colon/semicolon
- /less/equal/greater/question
- /at/A/B/C
- /D/E/F/G
- /H/I/J/K
- /L/M/N/O
- /P/Q/R/S
- /T/U/V/W
- /X/Y/Z/bracketleft
- /backslash/bracketright/asciicircum/underscore
- /quoteleft/a/b/c
- /d/e/f/g
- /h/i/j/k
- /l/m/n/o
- /p/q/r/s
- /t/u/v/w
- /x/y/z/braceleft
- /bar/braceright/asciitilde/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /space/space/space/space
- /dotlessi/grave/acute/circumflex
- /tilde/macron/breve/dotaccent
- /dieresis/space/ring/cedilla
- /space/hungarumlaut/ogonek/caron
- /space/exclamdown/cent/sterling
- /currency/yen/brokenbar/section
- /dieresis/copyright/ordfeminine/guillemotleft
- /logicalnot/hyphen/registered/macron
- /degree/plusminus/twosuperior/threesuperior
- /acute/mu/paragraph/periodcentered
- /cedilla/onesuperior/ordmasculine/guillemotright
- /onequarter/onehalf/threequarters/questiondown
- /Agrave/Aacute/Acircumflex/Atilde
- /Adieresis/Aring/AE/Ccedilla
- /Egrave/Eacute/Ecircumflex/Edieresis
- /Igrave/Iacute/Icircumflex/Idiereses
- /Eth/Ntilde/Ograve/Oacute
- /Ocircumflex/Otilde/Odieresis/multiply
- /Oslash/Ugrave/Uacute/Ucircumflex
- /Udieresis/Yacute/Thorn/germandbls
- /agrave/aacute/acircumflex/atilde
- /adieresis/aring/ae/ccedilla
- /egrave/eacute/ecircumflex/edieresis
- /igrave/iacute/icircumflex/idiereses
- /eth/ntilde/ograve/oacute
- /ocircumflex/otilde/odieresis/divide
- /oslash/ugrave/uacute/ucircumflex
- /udieresis/yacute/thorn/ydieresis
- ] put
-
- % 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
-
- systemdict
- /setcacheparams
- { counttomark 1 ge { dup setcachelimit } if
- cleartomark
- } bind put
-
- systemdict
- /currentcacheparams
- { mark cachestatus 6 { exch pop} repeat dup
- } bind put
-
- % 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.
-
- systemdict
- /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
- { fontfile } stopped % Try to open the file
- { 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 put
-
- % Find a font. If it is not there we try in order:
- %
- % Load PSFonts:name
- % Load CGFonts:PS/name.psfont
- % Load PSFonts:OtherFonts/name
- % Substitute DefaultFont
- %
- % If none of these succeeds, the result will an invalidfont error.
-
- systemdict /.findfont systemdict /findfont get def
-
- systemdict
- /findfont
- {
- % 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
- % 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 CGFonts:PS
- % } if
- % Comment out the next 3 lines if you don't have a PSFonts:OtherFonts
- dup FontDirectory exch known not % Not in FontDirectory?
- { dup (PSFonts:OtherFonts/) () loadfont % Try PSFonts:OtherFonts
- } if
- % Substitute DefaultFont
- dup FontDirectory exch known not % Not in FontDirectory?
- { dup userdict /DefaultFontName get ne % Not the DefaultFont
- { pop userdict /DefaultFontName get % Substitue DefaultFont
- dup systemdict /findfont get exec pop % Recurse so it gets loaded
- }
- if
- }
- if
- dup FontDirectory exch known not % Not in FontDirectory?
- { pop /DummyFont } if % Fall back on DummyFont
- .findfont % If errors, will fail now
- } bind put
-
- % Select a font
-
- systemdict
- /selectfont
- { exch findfont exch
- dup type /arraytype eq
- { makefont }
- { scalefont }
- ifelse
- setfont
- } bind put
-
- % Define a dummy font - prints out big dots ...
-
- /DummyFont 10 dict dup begin
- /FontName /DummyFont def
- /FontMatrix [0.001 0 0 0.001 0 0] def
- /FontType 3 def
- /FontBBox [0 -300 500 700] def
- /Encoding StandardEncoding def
- /BuildChar
- { pop pop
- 500 0 50 0 450 400 setcachedevice
- 250 200 200 0 360 arc fill
- } bind def
- /Painttype 0 def
- end definefont pop
-
- % Establish the dummy font as the default, as some fonts need it to
- % define themselves.
-
- /DefaultFontName /DummyFont def
-
- % Uncomment the following line to use FunkyFont as the default font
-
- %/DefaultFontName /FunkyFont def
-
- % Uncomment the following line to use Courier as the default font
-
- /DefaultFontName /Courier def
-
-