shithub: riscv

ref: 02d09919941c8f33f93f9e643a2aebb1fea14a91
dir: /sys/src/cmd/postscript/postprint/postprint.ps/

View raw version
%
% Version 3.3.2 prologue for text files.
%

/#copies 1 store
/aspectratio 1 def
/font /Courier def
/formsperpage 1 def
/landscape false def
/magnification 1 def
/margin 10 def
/orientation 0 def
/pointsize 10 def
/rotation 1 def
/xoffset .25 def
/yoffset .25 def

/roundpage true def
/useclippath true def
/pagebbox [0 0 612 792] def

/inch {72 mul} bind def
/min {2 copy gt {exch} if pop} bind def

/show {show} bind def		% so later references don't bind
/stringwidth {stringwidth} bind def

/setup {
	counttomark 2 idiv {def} repeat pop

	landscape {/orientation 90 orientation add def} if
	font findfont pointsize scalefont setfont
	/charwidth (M) stringwidth pop def
	/linespace pointsize pointsize .10 mul add neg def

	pagedimensions
	xcenter ycenter translate
	orientation rotation mul rotate
	width 2 div neg height 2 div translate
	xoffset inch yoffset inch neg translate
	margin 2 div dup neg translate
	magnification dup aspectratio mul scale
	height width div 1 min dup scale
	0 linespace translate
} def

/pagedimensions {
	useclippath userdict /gotpagebbox known not and {
		/pagebbox [clippath pathbbox newpath] def
		roundpage currentdict /roundpagebbox known and {roundpagebbox} if
	} if
	pagebbox aload pop
	4 -1 roll exch 4 1 roll 4 copy
	landscape {4 2 roll} if
	sub /width exch def
	sub /height exch def
	add 2 div /xcenter exch def
	add 2 div /ycenter exch def
	userdict /gotpagebbox true put
} def

/pagesetup {/page exch def 0 0 moveto 0} bind def

/L {
	counttomark 2 idiv {charwidth mul currentpoint exch pop moveto show} repeat
	linespace add dup 0 exch moveto
} bind def

/l {show linespace add dup 0 exch moveto} bind def

/LL {
	counttomark 2 idiv {charwidth mul currentpoint exch pop moveto show} repeat
} bind def

/done {/lastpage where {pop lastpage} if} def