%! %%BeginProcSet untilstuff.ps 2 1 /UntilState save def 180 dict begin /UNTILFINISH { end UntilState restore } def %% $ Include /lib/laserwriter/texstuff.ps %%BeginProcSet texstuff.ps 2 3.1.90 for Radical Eye dvips % This was modified by ? in 1989 to interface with dvips distributed with the NeXT system % 3/1/90 correct translation in TeX-do-square-scale: calvin % PS-in-TeX macros % Determine whether or not we are being called from TeX. Currently, this % relies on GPOSX being defined or not. % % Is-TeX % /GPOSX where /Is-TeX exch def Is-TeX {pop} if % Define Is-TeX and eat "dict" % Try to define the current TeX-MBB. If not Is-TeX then use the user-supplied % TeX-MBB or the whole page if TeX-MBB can not be found. % % TeX-MBB <[mbb in TeX space]> % Is-TeX {/TeX-MBB [GPOSX GPOSY currentpoint] def} {/TeX-MBB where {pop} {/TeX-MBB [20 20 576 756] def} ifelse} ifelse % % Define a couple of macros that do stuff if you are in TeX or not. % % In-Tex % Not-In-Tex % /In-TeX {Is-TeX exch if} def /Not-In-TeX {Is-TeX not exch if} def % % Set up square scaling given an MBB % % <[user-mbb]> TeX-do-square-scale % /TeX-do-square-scale { % get User mbb aload pop /U-top exch def /U-right exch def /U-bot exch def /U-left exch def % sort MBB U-top U-bot lt {U-top U-bot /U-top exch def /U-bot exch def} if U-right U-left lt {U-right U-left /U-right exch def /U-left exch def} if /U-height U-top U-bot sub def /U-width U-right U-left sub def % get TeX MBB TeX-MBB aload pop /T-top exch def /T-right exch def /T-bot exch def /T-left exch def % sort MBB T-top T-bot lt {T-top T-bot /T-top exch def /T-bot exch def} if T-right T-left lt {T-right T-left /T-right exch def /T-left exch def} if /T-height T-top T-bot sub def /T-width T-right T-left sub def % Compute scaling in X and Y /S-x T-width U-width div def /S-y T-height U-height div def % Make scales equal and center Tex-Mbb % extra height=(T-height - S-x * U-height) % Then divide by 2 and add to bottom (similar for extrawidth) } S-x S-y gt { /S-x S-y def T-width S-x U-width mul sub 2 div T-left add /T-left exch def } { /S-y S-x def T-top T-height S-x U-height mul sub 2 div sub /T-top exch def } ifelse % Compute translation T-left T-top translate S-x S-y neg scale % invert y axis % Compute translation U-left neg U-bot neg translate } def % % Set up non-square scaling given an MBB % % <[user-mbb]> TeX-do-scale % /TeX-do-scale { aload pop % get User mbb /U-top exch def /U-right exch def /U-bot exch def /U-left exch def /U-height U-top U-bot sub def /U-width U-right U-left sub def TeX-MBB aload pop % get TeX MBB /T-top exch def /T-right exch def /T-bot exch def /T-left exch def /T-height T-top T-bot sub def /T-width T-right T-left sub def % Compute scaling in X and Y /S-x T-width U-width div def /S-y T-height U-height div def % Compute translation T-left T-bot translate S-x S-y scale % Compute translation U-left neg U-bot neg translate } def % % Draw a box around an mbb-array % % <[mbb]> TeX-mbb-box % /TeX-mbb-box { aload pop /B-ury exch def /B-urx exch def /B-lly exch def /B-llx exch def newpath B-llx B-lly moveto B-llx B-ury lineto B-urx B-ury lineto B-urx B-lly lineto closepath stroke } def %%EndProcSet texstuff.ps % pt % Feed pt through the default matrix to get device coordinates, % and then reverse transform it through the current matrix to get user units /pt { dup matrix defaultmatrix dtransform idtransform pop abs } def % Macro to define fonts-takes "/ID Size /Font-Name" as params /DF { findfont exch pt dup 0.8 mul /STRH exch def scalefont def } def % Define a default text font... /DT { /DT0 20 /Times-Roman DF DT0 SF } def % Macros for positioning Text-take "(string) x y" as params /strbox { gsave newpath 0 0 moveto false charpath 40 setflat flattenpath pathbbox grestore } def %/strsizes { strbox 4 2 roll exch pop } def /strsizes { stringwidth pop STRH 0 } def % Usage: string _strsizes_ width height depth /TOP { pop -1 mul } def /VCENT { pop -.5 mul } def /LOW { pop pop 0 } def /BOT { exch pop -1 mul } def /LEFT { exch pop 0 exch } def /HCENT { exch -.5 mul exch } def /RIGHT { exch -1 mul exch } def /DEBUG { (Now showing:) print dup print (\n) print } def /TUL { moveto dup strsizes TOP LEFT rmoveto show } def /TUC { moveto dup strsizes TOP HCENT rmoveto show } def /TUR { moveto dup strsizes TOP RIGHT rmoveto show } def /TCL { moveto dup strsizes VCENT LEFT rmoveto show } def /TCC { moveto dup strsizes VCENT HCENT rmoveto show } def /TCR { moveto dup strsizes VCENT RIGHT rmoveto show } def /TLL { moveto dup strsizes LOW LEFT rmoveto show } def /TLC { moveto dup strsizes LOW HCENT rmoveto show } def /TLR { moveto dup strsizes LOW RIGHT rmoveto show } def /TBL { moveto dup strsizes BOT LEFT rmoveto show } def /TBC { moveto dup strsizes BOT HCENT rmoveto show } def /TBR { moveto dup strsizes BOT RIGHT rmoveto show } def % Shorthand for things /LD { load def } def /S /show LD /M /moveto LD /L /lineto LD /R /rlineto LD % % the following code worked on the LaserWriter, but not on other PS printers /DS { /DOTSIZE exch def } def 5 pt DS /DOT { DOTSIZE 0 360 arc } def % the following code works fine /DOT { moveto gsave 1 setlinecap 0 0 rlineto stroke grestore } def % % /D { 2 copy lineto stroke moveto } def /CT /rcurveto LD /CI { 0 360 arc } def /CP /closepath LD /NP /newpath LD /SF /setfont LD % defaults to use the old til-type stuff. (FillPath and StrokePath) /FP { finpath } def /SP { finpath } def % Shorthand for colors /FILL { /FP /fill LD /SP /FP LD } def /FILLOUT { /FP { gsave gsave fill grestore 0 setgray stroke grestore } def /SP /FP LD } def /FILLSTROKE { /FP /fill LD /SP /stroke LD } def /STROKE { /FP /stroke LD /SP /FP LD } def /SG /setgray LD /SLW /setlinewidth LD /SLJ /setlinejoin LD /SLC /setlinecap LD /SD /setdash LD % Stuff to include comments in files /CmtY 10 def % Starting Y position /Cmt { 20 CmtY moveto /Helvetica findfont 8 scalefont setfont show /CmtY CmtY 10 add store } def %%EndProcSet untilstuff.ps