home *** CD-ROM | disk | FTP | other *** search
- %!
- % This is the prolog used by OzTeX 1.4 to convert a DVI file into PostScript.
-
- % Set dev to "LW" if LaserWriter, "LINO" if Linotronic, or "?" if unknown:
-
- /dev (?) def
- statusdict /product known
- { statusdict /product get dup
- (LaserWriter) anchorsearch { pop pop /dev (LW) def } { pop } ifelse
- (Linotype) anchorsearch { pop pop /dev (LINO) def } { pop } ifelse
- } if
-
- % OzTeX calls @setup with the following parameters:
- % resolution (integer), landscape (boolean), horizontal and vertical offsets
- % (integers that are used to position the TeX origin correctly) .
-
- /@setup { % set up OzTeX's coordinate system
-
- /voff exch def
- /hoff exch def
- /land exch def
- /res exch def
-
- dev (?) eq % unknown device?
- { land
- { % landscape
- 90 rotate % rotate axes 90deg anticlockwise
- 72 res div dup neg scale % units now device dots
- res dup translate % move to TeX origin
- voff neg hoff translate % adjust TeX origin if necessary
- }
- { % portrait
- 72 res div dup neg scale % units now device dots
- res -10.7 res mul translate % move to TeX origin
- hoff voff translate % adjust TeX origin if necessary
- } ifelse
- } if
-
- dev (LW) eq % LaserWriter?
- { land
- { % landscape
- % rotate/scale/translate can cause scaling problems, so use setmatrix:
- version cvr 38.0 le
- { [ 0 -1 1 0 235 hoff add 3100 voff add ] setmatrix } % LaserWriter
- { version cvr 47.0 lt
- { [ 0 -1 1 0 235 hoff add 3130 voff add ] setmatrix } % LaserWriter Plus
- { [ 0 -1 1 0 235 hoff add 3160 voff add ] setmatrix } % LaserWriter II NTX
- % add y to move TeX origin down by y pixels
- % add x to move TeX origin LEFT by x pixels
- ifelse } ifelse
- }
- { % portrait
- % scale/translate can cause scaling problems, so use setmatrix:
- version cvr 38.0 le
- { [ 1 0 0 1 235 hoff add 190 voff add ] setmatrix } % LaserWriter
- { version cvr 47.0 lt
- { [ 1 0 0 1 235 hoff add 215 voff add ] setmatrix } % LaserWriter Plus
- { [ 1 0 0 1 235 hoff add 265 voff add ] setmatrix } % LaserWriter II NTX
- % add x to move TeX origin right by x pixels
- % add y to move TeX origin down by y pixels
- ifelse } ifelse
- } ifelse
- } if
-
- dev (LINO) eq % Linotronic?
- { land
- { % landscape
- 90 rotate % rotate axes 90deg anticlockwise
- 72 res div dup neg scale % units now device dots
- res dup translate % move to TeX origin
- voff neg hoff translate % adjust TeX origin if necessary
- }
- { % portrait
- newpath clippath pathbbox % push LLx LLy URx URy (URy = ht in pts)
- /paperht exch 72 div def % paper height in inches
- pop pop pop % remove URx LLy LLx
- 72 res div dup neg scale % units now device dots
- res paperht res mul neg res add
- translate % move to TeX origin
- hoff voff translate % adjust TeX origin if necessary
- } ifelse
- } if
-
- /mtrx 6 array def
- mtrx currentmatrix pop % save our new transformation matrix
-
- } def % end of @setup
-
- % @saveVM and @restoreVM are only used if we are conserving VM
- % by downloading font bitmaps more often:
-
- /@saveVM {/prefontVM save def} def
- /@restoreVM {prefontVM restore} def
-
- /@newfont % create new font dict
- { /maxchcode exch def
- /fontid exch def
- fontid 7 dict def
- fontid load begin
- /FontType 3 def
- /FontMatrix [1 0 0 -1 0 0] def % -1 because y scale is negative
- /FontBBox [0 0 1 1] def
- /BitMaps maxchcode 1 add array def
- /BuildChar {CharBuilder} def
- /Encoding maxchcode 1 add array def
- 0 1 maxchcode {Encoding exch /.notdef put} for
- end
- fontid fontid load definefont pop
- } def
-
- % The char data, a bitmap descriptor, is an array with 6 elements:
-
- /ch-image {ch-data 0 get} def % the hex string image
- /ch-width {ch-data 1 get} def % the number of pixels across
- /ch-height {ch-data 2 get} def % the number of pixels tall
- /ch-xoff {ch-data 3 get} def % number of pixels to left of origin
- /ch-yoff {ch-data 4 get} def % number of pixels below origin
- /ch-advw {ch-data 5 get} def % advance width
-
- % The following character builder looks up the char data in the BitMaps array
- % and paints the character:
-
- /CharBuilder % image one char
- { /ch-code exch def % save the char code
- /font-dict exch def % and the font dict
- /ch-data font-dict /BitMaps get
- ch-code get def
- ch-advw 0
- ch-xoff neg ch-height ch-yoff sub 1 sub neg % -xo , -(ht-yo-1)
- ch-width ch-xoff sub 1 sub ch-yoff % (wd-xo-1) , yo
- setcachedevice
- ch-width ch-height true
- [1 0 0 -1 ch-xoff ch-yoff] % bitmap sent top to bottom
- {ch-image}
- imagemask
- } def
-
- /sf {setfont} def % set current font
-
- /dc % define new character
- { /ch-code exch def
- /ch-data exch def
-
- % The following code should be enabled if you have an old LaserWriter.
- % It attempts to overcome a bug that causes the printer to crash
- % and print a test page rather then report a VMerror.
- %
- % vmstatus % returns: savelevel vmused vmmax
- % 10000 sub gt % is vmused > (vmmax-10000)?
- % { pop VMERROR } % causes error message (avoiding crash)
- % { pop } % pop savelevel
- % ifelse
-
- currentfont /BitMaps get ch-code ch-data put
- currentfont /Encoding get ch-code
- dup ( ) cvs cvn put % generate unique name
- } bind def
-
- /@bop0 {pop} def % begin DVI page n
-
- /@bop1 % begin setting DVI page n
- { pop % throw away page number
- initgraphics % start with a clean slate
- mtrx setmatrix % switch to our TeX coordinate system
- /prepageVM save def % save state of VM at start of page
- } def
-
- /@eop % end DVI page n
- { pop % throw away page number
- prepageVM restore % restore VM to state at start of page
- showpage
- } def
-
- /@end { } def % end of file
-
- % h and s are used to typeset downloaded bitmap fonts:
-
- /h {exch 0 rmoveto show} bind def % move right by dh and show (...)
-
- /s {3 1 roll moveto show} bind def % move to h,v and show (...)
-
- % H and S are used to typeset resident PostScript fonts.
- % We can't use relative horizontal positioning because the advance widths in
- % a PostScript font are not integers and rounding errors would accumulate:
-
- /H {exch v moveto show} bind def % move to h,v and show (...)
-
- /S % ditto, and save v position
- { 3 1 roll
- 1 add % v+1 to match baseline of bitmap fonts
- dup /v exch def
- moveto show
- } bind def
-
- % Some fine-tuning of the code used to draw a rule is necessary:
-
- dev (LW) eq % LaserWriter?
- version cvr 38.0 le and % and version <= 38.0?
- {
- /r % set a wd by ht rule at h,v
- { newpath
- 1 add moveto % move to h,v+1 (don't ask me why)
- /ht exch 1 sub def % reduce height by 1
- /wd exch 1 sub def % ditto for width
- wd 0 rlineto
- 0 ht neg rlineto
- wd neg 0 rlineto
- fill
- } bind def
- }
- {
- /r % set a wd by ht rule at h,v
- { newpath
- moveto % move to h,v
- /ht exch 1 sub def % reduce height by 1
- /wd exch 1 sub def % ditto for width
- wd 0 rlineto
- 0 ht neg rlineto
- wd neg 0 rlineto
- fill
- } bind def
- } ifelse
-
- % Following procedures are invoked as the result of \special{file}.
- % We change all scaling and graphics back to defaults, but shift the origin
- % to the current position on the page:
-
- /@bsp
- { /vmag exch def % vertical scaling
- /hmag exch def % horizontal scaling
- moveto % move to h,v
- gsave
- /prespecialVM save def % save showpage, TeX procedures etc.
- currentpoint transform
- initgraphics itransform translate
- hmag vmag scale
- land { 90 rotate } if % rotate axes if landscape
- /showpage { } def % user does not have to remove showpage
- } bind def
-
- /@esp
- { prespecialVM restore % restore saved showpage value etc.
- grestore
- } bind def
-
- % Following procedures are invoked as the result of \special{epsf: file}.
- % Note that @bepsf and @eepsf are currently identical to @bsp and @esp
- % but it is a good idea to allow for future changes:
-
- /@bepsf
- { /vmag exch def % vertical scaling
- /hmag exch def % horizontal scaling
- moveto % move to h,v
- gsave
- /prespecialVM save def % save showpage, TeX procedures etc.
- currentpoint transform
- initgraphics itransform translate
- hmag vmag scale
- land { 90 rotate } if % rotate axes if landscape
- /showpage { } def % user does not have to remove showpage
- } bind def
-
- /@eepsf
- { prespecialVM restore % restore saved showpage value etc.
- grestore
- } bind def
-
- % Here is the code to handle bitmaps generated by PICT/PNTG \specials:
-
- /@bitmap
- { /vmag exch def % vertical scaling
- /hmag exch def % horizontal scaling
- /vres exch def % vertical resolution of bitmap
- /hres exch def % horizontal resolution of bitmap
- /ht exch def % height
- /wd exch def % width
- /hexstring ht string def
- gsave
- 1 add translate % set origin to h,v+1
- res hres div wd mul hmag mul
- res vres div ht mul vmag mul neg scale
- wd ht true
- [ wd 0 0 ht neg 0 ht ]
- { currentfile hexstring readhexstring pop }
- imagemask
- grestore
- } def
-
- % Here are the definitions needed to handle resident PostScript fonts:
-
- /sp % scaled pts to device dots
- { 16#10000 div % scaled pts to pts
- res mul 72.27 div % pts to device dots
- } bind def
-
- /PSfont % uses dot size and TFM name
- { dup /Times-Slanted eq
- {pop /Times-Roman findfont [1 0 .268 -1 0 0] makefont exch scalefont setfont}
- {findfont [1 0 0 -1 0 0] makefont exch scalefont setfont}
- ifelse
- } bind def
-
- % End of OzTeX's prolog.
-