home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
printers
/
utilities
/
post_446
/
post14.lzh
/
init.ps
next >
Wrap
Text File
|
1991-01-22
|
5KB
|
164 lines
%! Post V1.4 initialisation file
% (C) Adrian Aylward 1989, 1991
%
% 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
/product (Post V1.4) 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
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
% If you don't have Courier, comment this line out, or replace it with any
% font you prefer.
/DefaultFontName /Courier def