aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/postscript/psfiles
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/postscript/psfiles')
-rw-r--r--src/cmd/postscript/psfiles/Nroundpage.ps11
-rw-r--r--src/cmd/postscript/psfiles/README11
-rw-r--r--src/cmd/postscript/psfiles/aps.ps127
-rw-r--r--src/cmd/postscript/psfiles/banner.ps40
-rw-r--r--src/cmd/postscript/psfiles/baseline.ps156
-rw-r--r--src/cmd/postscript/psfiles/color.ps65
-rw-r--r--src/cmd/postscript/psfiles/fatcourier.ps26
-rw-r--r--src/cmd/postscript/psfiles/forms.ps213
-rw-r--r--src/cmd/postscript/psfiles/mkfile12
-rw-r--r--src/cmd/postscript/psfiles/ps.requests16
-rw-r--r--src/cmd/postscript/psfiles/roundpage.ps30
-rw-r--r--src/cmd/postscript/psfiles/shade.ps52
-rw-r--r--src/cmd/postscript/psfiles/unbind.ps28
13 files changed, 787 insertions, 0 deletions
diff --git a/src/cmd/postscript/psfiles/Nroundpage.ps b/src/cmd/postscript/psfiles/Nroundpage.ps
new file mode 100644
index 00000000..44a67a6d
--- /dev/null
+++ b/src/cmd/postscript/psfiles/Nroundpage.ps
@@ -0,0 +1,11 @@
+%
+% A version of roundpage.ps that assumes a symmetric clipping path. Thanks
+% to Matthijs Melchior for the suggestion.
+%
+
+/roundpagebbox {
+ pagebbox dup 0 get pagebbox 2 get add 2 exch put
+ pagebbox dup 1 get pagebbox 3 get add 3 exch put
+ pagebbox 0 0 put
+ pagebbox 1 0 put
+} bind def
diff --git a/src/cmd/postscript/psfiles/README b/src/cmd/postscript/psfiles/README
new file mode 100644
index 00000000..c1a70140
--- /dev/null
+++ b/src/cmd/postscript/psfiles/README
@@ -0,0 +1,11 @@
+PostScript files that go in $(POSTLIB). Several, like forms.ps, are
+used by most translators supplied in this package. Most PostScript
+files only used by a single translator (e.g. the prologue) have been
+been moved into the appropriate source directory. Files that end in
+.enc support alternate character sets (e.g. ISO Latin 1 alphabet).
+The implementation is left open, but typically redefines findfont.
+That approach works because findfont is a procedure rather than an
+operator, so it's not affected by bind. Also can't depend on having
+a systemdict definition for findfont. It's in userdict on Version
+48.0 VT600s.
+
diff --git a/src/cmd/postscript/psfiles/aps.ps b/src/cmd/postscript/psfiles/aps.ps
new file mode 100644
index 00000000..9ba0d309
--- /dev/null
+++ b/src/cmd/postscript/psfiles/aps.ps
@@ -0,0 +1,127 @@
+%
+% Tune things up so Linotronic output looks more like the APS-5. Pull this file
+% into dpost output using the -C option. To get the best looking output run dpost
+% with the -e2 option and use special font files that look like the APS tables but
+% have character codes (ie. the fourth column in the width tables) appropriate for
+% PostScript fonts. Widths in these tables must be for APS fonts!
+%
+% Start with fat versions of the stroked Courier and Courier-Oblique fonts - from
+% Johnathan Shopiro.
+%
+
+/newdict /Courier findfont length dict def
+/Courier findfont {
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+newdict /StrokeWidth 65 put
+/Courier newdict definefont pop
+
+/newdict /Courier-Oblique findfont length dict def
+/Courier-Oblique findfont {
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+newdict /StrokeWidth 65 put
+/Courier-Oblique newdict definefont pop
+
+%
+% Scaled down versions of the Helvetica font family.
+%
+
+/newdict /Helvetica findfont length dict def
+/Helvetica findfont {
+ 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Helvetica newdict definefont pop
+
+/newdict /Helvetica-Oblique findfont length dict def
+/Helvetica-Oblique findfont {
+ 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Helvetica-Oblique newdict definefont pop
+
+/newdict /Helvetica-Bold findfont length dict def
+/Helvetica-Bold findfont {
+ 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Helvetica-Bold newdict definefont pop
+
+/newdict /Helvetica-BoldOblique findfont length dict def
+/Helvetica-BoldOblique findfont {
+ 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Helvetica-BoldOblique newdict definefont pop
+
+%
+% Scaled up versions of the Times font family.
+%
+
+/newdict /Times-Roman findfont length dict def
+/Times-Roman findfont {
+ 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Times-Roman newdict definefont pop
+
+/newdict /Times-Italic findfont length dict def
+/Times-Italic findfont {
+ 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Times-Italic newdict definefont pop
+
+/newdict /Times-Bold findfont length dict def
+/Times-Bold findfont {
+ 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Times-Bold newdict definefont pop
+
+/newdict /Times-BoldItalic findfont length dict def
+/Times-BoldItalic findfont {
+ 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
+
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+/Times-BoldItalic newdict definefont pop
+
diff --git a/src/cmd/postscript/psfiles/banner.ps b/src/cmd/postscript/psfiles/banner.ps
new file mode 100644
index 00000000..d5637416
--- /dev/null
+++ b/src/cmd/postscript/psfiles/banner.ps
@@ -0,0 +1,40 @@
+%
+% Simple program to print a banner page
+%
+
+/banner {
+ /saveobj save def
+ erasepage initgraphics
+
+ /#copies 1 def
+ /inch {72 mul} bind def
+ /pagebbox [clippath pathbbox newpath] def
+
+ /font /Helvetica def
+ /size 20 def
+ /height pagebbox 3 get def
+ /width pagebbox 2 get .09 mul def
+
+ .92 setgray
+ pagebbox 0 get pagebbox 1 get moveto
+ width 0 rlineto 0 height rlineto width neg 0 rlineto closepath eofill
+ pagebbox 2 get pagebbox 1 get moveto
+ width neg 0 rlineto 0 height rlineto width 0 rlineto closepath eofill
+ 0 setgray
+
+ font findfont size scalefont setfont
+ /linesp size size .15 mul add neg def
+ /tab (Destination) stringwidth pop 1.5 mul def
+ /nextline {0 0 moveto show tab 0 moveto show 0 linesp translate} def
+
+ pagebbox 0 get 1.5 width mul add pagebbox 3 get 2.0 width mul sub translate
+ (Bin) nextline
+ (Name) nextline
+ (Owner) nextline
+ (File) nextline
+ (Account) nextline
+ (Destination) nextline
+ (Spooldate) nextline
+ showpage
+ saveobj restore
+} bind def
diff --git a/src/cmd/postscript/psfiles/baseline.ps b/src/cmd/postscript/psfiles/baseline.ps
new file mode 100644
index 00000000..470047c9
--- /dev/null
+++ b/src/cmd/postscript/psfiles/baseline.ps
@@ -0,0 +1,156 @@
+%
+% Stuff used to draw or set text along a baseline specified by parametric equations
+% for x and y.
+%
+
+/left -1 def
+/center 0 def
+/right 1 def
+
+/baselinedict 50 dict def
+
+/newbaseline {
+ baselinedict begin
+ /g' exch bind def
+ /f' exch bind def
+ /g exch bind def
+ /f exch bind def
+
+ counttomark 2 eq {/hoffset exch def} if
+ /res exch def
+
+ /t 0 def
+ /s 0 def
+ /voffset false def
+ cleartomark
+ end
+} bind def
+
+/drawfunnytext {
+ baselinedict begin
+ /t exch def
+ /mode exch def
+ /str exch def
+
+ mode left eq {
+ /leftstring emptystring def
+ /rightstring str def
+ } if
+
+ mode right eq {
+ /leftstring str reversestring def
+ /rightstring emptystring def
+ } if
+
+ mode center eq {
+ str splitstring
+ /rightstring exch def
+ /leftstring exch reversestring def
+ } if
+
+ gsave currentpoint translate leftstring left t baselineshow grestore
+ gsave currentpoint translate rightstring right t baselineshow grestore
+
+ /t 0 def
+ /s 0 def
+ /voffset false def
+ cleartomark
+ end
+} bind def
+
+/setfunnytext {
+ baselinedict begin
+ /vpos exch def
+ /hpos exch def
+ /str exch def
+
+ voffset vpos ne {
+ /voffset vpos def
+ /t 0 def
+ /s hoffset def
+ } if
+
+ gsave
+ hoffset voffset translate
+ 0 0 moveto
+ /ds hpos s sub def
+ /dt ds t f' dup mul t g' dup mul add sqrt res mul div def
+ /s s ds add def
+ /t t dt add def
+ str right t baselineshow
+ grestore
+ end
+} bind def
+
+baselinedict begin
+
+/f {} bind def
+/g {pop 0} bind def
+/f' {pop 1} bind def
+/g' {pop 0} bind def
+
+/s 0 def
+/t 0 def
+/res 72 def
+
+/onecharstring ( ) def
+/emptystring () def
+
+/baselineshow {
+ /t exch def
+ /mode exch def
+ /str exch def
+
+ gsave
+ t f res mul t g res mul translate
+ 0 0 moveto
+ t g' t f' atan rotate
+ {
+ mode right eq {pop} if
+ grestore gsave
+ onecharstring 0 3 -1 roll put onecharstring stringwidth pop
+ /ds exch mode mul def
+ /dt ds t f' dup mul t g' dup mul add sqrt res mul div def
+ /t t dt add def
+ /s s ds add def
+ t f res mul t g res mul translate
+ 0 0 moveto
+ t g' t f' atan rotate
+ mode left eq {pop} if
+ } str kshow
+ grestore
+} bind def
+
+/reversestring {
+ /str1 exch def
+
+ /str2 str1 length string def
+ /i 0 def
+ /n str1 length 1 sub def
+
+ {
+ str1 n get str2 exch i exch put
+ /i i 1 add def
+ /n n 1 sub def
+ n 0 lt {exit} if
+ } loop
+ str2
+} bind def
+
+/splitstring {
+ /str1 exch def
+
+ /len str1 stringwidth pop def
+ /s 0 def
+ /n 0 def
+ str1 length {
+ str1 n get onecharstring exch 0 exch put
+ /s onecharstring stringwidth pop s add def
+ s len 2 div ge {exit} if
+ /n n 1 add def
+ } repeat
+ str1 0 n 1 add getinterval
+ str1 n str1 length n sub getinterval
+} bind def
+
+end
diff --git a/src/cmd/postscript/psfiles/color.ps b/src/cmd/postscript/psfiles/color.ps
new file mode 100644
index 00000000..e304cc3a
--- /dev/null
+++ b/src/cmd/postscript/psfiles/color.ps
@@ -0,0 +1,65 @@
+%
+% Color and reverse video support for dpost. A call made to setcolor with two
+% arguments implies reverse video printing.
+%
+
+/rgb {setrgbcolor} bind def
+/hsb {sethsbcolor} bind def
+
+/colordict 50 dict dup begin
+ /red { 1 0 0 } def
+ /green { 0 1 0 } def
+ /blue { 0 0 1 } def
+ /cyan { 0 1 1 } def
+ /magenta { 1 0 1 } def
+ /yellow { 1 1 0 } def
+ /white { 1 1 1 } def
+ /black { 0 0 0 } def
+end def
+
+/setcolor {
+ counttomark 1 eq {
+ dup colordict exch known not {pop /black} if
+ colordict exch get exec setrgbcolor
+ } if
+ counttomark 2 eq {
+ /backcolor exch def
+ /textcolor exch def
+ colordict backcolor known not colordict textcolor known not or {
+ /backcolor colordict /black get def
+ /textcolor colordict /white get def
+ } if
+ /backcolor colordict backcolor get def
+ /textcolor colordict textcolor get def
+ /dY1 0 def
+ /dY2 0 def
+ textcolor exec setrgbcolor
+ } if
+} bind def
+
+/drawrvbox {
+ /x2 exch def
+ /x1 exch def
+
+ currentpoint dup
+ /y1 exch def
+ /y2 exch def pop
+
+ dY1 0 eq dY2 0 eq and {
+ currentfont /FontBBox get aload pop
+ currentfont /FontMatrix get dtransform /dY2 exch def pop
+ currentfont /FontMatrix get dtransform /dY1 exch def pop
+ } if
+
+ /y1 y1 dY1 add def
+ /y2 y2 dY2 add def
+
+ backcolor exec setrgbcolor
+ newpath
+ x1 y1 moveto
+ x2 y1 lineto
+ x2 y2 lineto
+ x1 y2 lineto
+ closepath fill
+ textcolor exec setrgbcolor
+} bind def
diff --git a/src/cmd/postscript/psfiles/fatcourier.ps b/src/cmd/postscript/psfiles/fatcourier.ps
new file mode 100644
index 00000000..11d71881
--- /dev/null
+++ b/src/cmd/postscript/psfiles/fatcourier.ps
@@ -0,0 +1,26 @@
+%
+% Fat versions of the stroked Courier and Courier-Oblique - from Johnathan Shopiro.
+% Can be selectively pulled in using the -C option that's available with all the
+% PostScript translators or permanently added to any of the prologues. Helps on
+% Linotronic typesetters, where Courier and Courier-Oblique are too light!
+%
+
+/newdict /Courier findfont length 1 add dict def
+/Courier findfont {
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+newdict /StrokeWidth 60 put
+/Courier newdict definefont pop
+
+/newdict /Courier-Oblique findfont length 1 add dict def
+/Courier-Oblique findfont {
+ 1 index /FID ne
+ {newdict 3 1 roll put}
+ {pop pop}
+ ifelse
+} forall
+newdict /StrokeWidth 60 put
+/Courier-Oblique newdict definefont pop
diff --git a/src/cmd/postscript/psfiles/forms.ps b/src/cmd/postscript/psfiles/forms.ps
new file mode 100644
index 00000000..a96fcdae
--- /dev/null
+++ b/src/cmd/postscript/psfiles/forms.ps
@@ -0,0 +1,213 @@
+%
+% Procedures that let you print any number of pages on each sheet of paper. It's
+% far from perfect and won't handle everything (eg. it's not recursive), but should
+% be good enough for now. Assumes the default page coordinate system has been set
+% up before setupforms is called. lastpage makes certain the last page is printed,
+% and should be called immediately after the %%Trailer comment.
+%
+% Three lines of code needed for page image clipping have been commented out for
+% now. It works, but can really slow things down on some versions of PostScript.
+% Uncomment them if you want to clip pages.
+%
+
+/setupforms {
+ /formsperpage exch def
+
+ /currentform 0 def
+ /slop 5 def
+ /min {2 copy gt {exch} if pop} def
+
+%
+% Save the current environment so the real showpage can be restored when we're all
+% done. Occasionally helps when a banner page is included with the job.
+%
+
+ /saveobj save def
+
+%
+% Number of rows and columns we'll need - may exchange them later.
+%
+
+ /columns formsperpage sqrt ceiling cvi def
+ /rows formsperpage columns div ceiling cvi def
+
+%
+% Slop leaves a little room around the edge so page images can be outlined and have
+% the borders show up. Distance is in default coordinates, so we need to figure out
+% how it maps into user coordinates.
+%
+
+ 6 array defaultmatrix
+ 6 array currentmatrix
+ 6 array invertmatrix
+ 6 array concatmatrix
+ /tempmatrix exch def
+
+ 0 slop tempmatrix dtransform dup mul exch dup mul add sqrt
+ /slop exch def
+
+%
+% Determine how big the image area is, using the clipping path bounding box minus
+% a little and leave the coordinates of the lower left corner of the clipping path
+% on the stack. Also temporarily set the size of each page (ie. formheight and
+% formwidth) from the clipping path - just in case old software uses this stuff.
+% Only works for coordinate systems that have been rotated by a multiple of 90
+% degrees.
+%
+
+ newpath clippath pathbbox
+ 2 index sub dup /formheight exch def slop 2 mul sub /pageheight exch def
+ 2 index sub dup /formwidth exch def slop 2 mul sub /pagewidth exch def
+
+%
+% New translators all store the size of each page in default coordinates in the
+% pagebbox array and it can be different than the size determined by the clipping
+% path. If we can find pagebbox use it to set the real dimensions of each page.
+% Leaves the coordinates of the lower left corner on the stack, (either from
+% pagebbox or clippath) so four numbers are there when we're done.
+%
+
+ userdict /gotpagebbox known userdict /pagebbox known and {
+ newpath
+ pagebbox 0 get pagebbox 1 get tempmatrix transform moveto
+ pagebbox 0 get pagebbox 3 get tempmatrix transform lineto
+ pagebbox 2 get pagebbox 3 get tempmatrix transform lineto
+ pagebbox 2 get pagebbox 1 get tempmatrix transform lineto
+ closepath pathbbox
+ 2 index sub /formheight exch def
+ 2 index sub /formwidth exch def
+ } {2 copy} ifelse
+
+%
+% Top two numbers are the displacement from the job's origin to the lower left
+% corner of each page image when we finish setting up the new coordinate system.
+%
+
+ /ycorner exch def
+ /xcorner exch def
+
+%
+% The two numbers left on the stack are the coordinates of the lower left corner
+% of the clipping path. Go there and then up a bit so page images can be outlined.
+%
+
+ translate
+ slop slop translate
+
+%
+% If the page is wider than high we may be able to do better if we exchange rows
+% and columns. Won't make a difference in the current orientation or if rows and
+% columns are the same.
+%
+
+ pagewidth pageheight gt {
+ rows columns /rows exch def /columns exch def
+ } if
+
+%
+% Find the orientation and scaling that makes things as large as possible. More
+% than what's really needed. First calculation essentially finds the minimum of
+% 1/rows and 1/columns.
+%
+
+ pagewidth formwidth columns mul div pageheight formheight rows mul div min
+ pageheight formwidth columns mul div pagewidth formheight rows mul div min
+
+ 2 copy lt {
+ rotation 1 eq {
+ landscape {
+ 0 pageheight translate
+ -90 rotate
+ }{
+ pagewidth 0 translate
+ 90 rotate
+ } ifelse
+ }{
+ landscape {
+ pagewidth 0 translate
+ 90 rotate
+ }{
+ 0 pageheight translate
+ -90 rotate
+ } ifelse
+ } ifelse
+ pagewidth pageheight /pagewidth exch def /pageheight exch def
+ exch
+ } if
+
+%
+% Second number from the top is the best choice. Scale so everything will fit on
+% the current page, go back to the original origin, and then get ready for the
+% first page - which goes in the upper left corner.
+%
+
+ pop dup dup scale
+ xcorner neg ycorner neg translate
+ 0 rows 1 sub formheight mul translate
+
+%
+% Try to center everything on the page - scaling we used is on top of the stack.
+%
+
+ dup pagewidth exch div formwidth columns mul sub 2 div
+ exch pageheight exch div formheight rows mul sub 2 div translate
+
+%
+% Redefine showpage.
+%
+
+ /!PreForms~showpage~ /showpage load def % save current showpage
+
+ /showpage {
+ saveobj restore
+% initclip
+ formsperpage 1 gt {
+ gsave .1 setlinewidth outlineform stroke grestore
+ } if
+ formwidth 0 translate
+ /currentform currentform 1 add def
+ currentform columns mod 0 eq {
+ columns formwidth mul neg formheight neg translate
+ } if
+ currentform formsperpage mod 0 eq {
+ gsave !PreForms~showpage~ grestore
+ currentform columns mod formwidth mul neg
+ formsperpage columns idiv formheight mul translate
+ /currentform 0 def
+ } if
+% outlineform clip newpath
+ /saveobj save def
+ } bind def
+
+ /outlineform {
+ newpath
+ xcorner ycorner moveto
+ formwidth 0 rlineto
+ 0 formheight rlineto
+ formwidth neg 0 rlineto
+ closepath
+ } bind def
+
+ /lastpage {
+ formsperpage 1 gt {
+ currentform 0 ne {
+ /saveobj save def
+ 0 1 formsperpage currentform sub formsperpage mod {
+ pop showpage
+ } for
+ saveobj restore
+ } if
+ saveobj restore
+ saveobj restore
+ } if
+ } def
+
+%
+% Clip the first page image and save the environment we just set up, including
+% the redefined showpage.
+%
+
+% outlineform clip
+ newpath
+ /saveobj save def
+} def
diff --git a/src/cmd/postscript/psfiles/mkfile b/src/cmd/postscript/psfiles/mkfile
new file mode 100644
index 00000000..ee75ec5a
--- /dev/null
+++ b/src/cmd/postscript/psfiles/mkfile
@@ -0,0 +1,12 @@
+</$objtype/mkfile
+
+<../config
+
+all:VQ:
+ ;
+
+install installall:V:
+ cp *.ps ps.* $POSTLIB
+
+clean nuke:VQ:
+ ;
diff --git a/src/cmd/postscript/psfiles/ps.requests b/src/cmd/postscript/psfiles/ps.requests
new file mode 100644
index 00000000..59e2a571
--- /dev/null
+++ b/src/cmd/postscript/psfiles/ps.requests
@@ -0,0 +1,16 @@
+%
+% Keywords begin with an @ in the first column. The value follows on the next
+% line and includes everything up to next keyword line, except for comments
+% which are lines that begin with % in the first column.
+%
+
+@manualfeed
+ statusdict begin
+ /manualfeedtimeout 300 def
+ /manualfeed true def
+ end
+
+@ledgertray
+ statusdict begin
+ ledgertray
+ end
diff --git a/src/cmd/postscript/psfiles/roundpage.ps b/src/cmd/postscript/psfiles/roundpage.ps
new file mode 100644
index 00000000..68d2d443
--- /dev/null
+++ b/src/cmd/postscript/psfiles/roundpage.ps
@@ -0,0 +1,30 @@
+%
+% Tries to round clipping path dimensions, as stored in array pagebbox, so they
+% match one of the known sizes in the papersizes array. Lower left coordinates
+% are always set to 0.
+%
+
+/roundpagebbox {
+ 7 dict begin
+ /papersizes [8.5 inch 11 inch 14 inch 17 inch] def
+
+ /mappapersize {
+ /val exch def
+ /slop .5 inch def
+ /diff slop def
+ /j 0 def
+ 0 1 papersizes length 1 sub {
+ /i exch def
+ papersizes i get val sub abs
+ dup diff le {/diff exch def /j i def} {pop} ifelse
+ } for
+ diff slop lt {papersizes j get} {val} ifelse
+ } def
+
+ pagebbox 0 0 put
+ pagebbox 1 0 put
+ pagebbox dup 2 get mappapersize 2 exch put
+ pagebbox dup 3 get mappapersize 3 exch put
+ end
+} bind def
+
diff --git a/src/cmd/postscript/psfiles/shade.ps b/src/cmd/postscript/psfiles/shade.ps
new file mode 100644
index 00000000..47e31679
--- /dev/null
+++ b/src/cmd/postscript/psfiles/shade.ps
@@ -0,0 +1,52 @@
+%
+% Shading support - primarily for ASCII file translators.
+%
+
+/grays [0.98 0.9 0.75 0.6] def
+
+/setshade {
+ /level exch def
+ level 0 le {
+ /textgray 0 def
+ /backgray 1 def
+ }{
+ /backgray level grays length gt
+ {/textgray 1 def 0}
+ {/textgray 0 def grays level 1 sub get}
+ ifelse def
+ } ifelse
+ textgray setgray
+ /dY1 0 def
+ /dY2 0 def
+} bind def
+
+/drawrvbox {
+ /x2 exch charwidth mul def
+ /x1 exch charwidth mul def
+
+ x1 x2 lt {
+ dup % expects y on top
+ /y1 exch linespace mul def
+ /y2 y1 def
+
+ dY1 0 eq dY2 0 eq and {
+ currentfont /FontBBox get aload pop
+ 160 sub
+ currentfont /FontMatrix get dtransform /dY2 exch def pop
+ 100 add
+ currentfont /FontMatrix get dtransform /dY1 exch def pop
+ } if
+
+ /y1 y1 dY1 add def
+ /y2 y2 dY2 add def
+
+ backgray setgray
+ newpath
+ x1 y1 moveto
+ x2 y1 lineto
+ x2 y2 lineto
+ x1 y2 lineto
+ closepath fill
+ } if
+ textgray setgray
+} bind def
diff --git a/src/cmd/postscript/psfiles/unbind.ps b/src/cmd/postscript/psfiles/unbind.ps
new file mode 100644
index 00000000..98e6283e
--- /dev/null
+++ b/src/cmd/postscript/psfiles/unbind.ps
@@ -0,0 +1,28 @@
+%
+% Unbind the operators in an executable array or packedarray. Leaves the
+% unbound array or the original object on the stack.
+%
+
+/unbind {
+ 0 index xcheck
+ 1 index type /arraytype eq
+ 2 index type /packedarraytype eq or and {
+ dup length array copy cvx
+ dup 0 exch {
+ dup type /operatortype eq {
+ ( ) cvs cvn cvx
+ } if
+
+ 0 index xcheck
+ 1 index type /arraytype eq
+ 2 index type /packedarraytype eq or and {
+ unbind
+ } if
+
+ 3 copy put pop
+ 1 add
+ } forall
+ pop
+ } if
+} def
+