aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/postscript/tr2post/ps_include.h
blob: cef490508d6801957cede80090f51605a46da5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
static char *PS_head[] = {
	"%ps_include: begin\n",
	"save\n",
	"/ed {exch def} def\n",
	"{} /showpage ed\n",
	"{} /copypage ed\n",
	"{} /erasepage ed\n",
	"{} /letter ed\n",
	"currentdict /findfont known systemdict /findfont known and {\n",
	"	/findfont systemdict /findfont get def\n",
	"} if\n",
	"36 dict dup /PS-include-dict-dw ed begin\n",
	"/context ed\n",
	"count array astore /o-stack ed\n",
	"%ps_include: variables begin\n",
	0
};

static char *PS_setup[] = {
	"%ps_include: variables end\n",
	"{llx lly urx ury} /bbox ed\n",
	"{newpath 2 index exch 2 index exch dup 6 index exch\n",
	" moveto 3 {lineto} repeat closepath} /boxpath ed\n",
	"{dup mul exch dup mul add sqrt} /len ed\n",
	"{2 copy gt {exch} if pop} /min ed\n",
	"{2 copy lt {exch} if pop} /max ed\n",
	"{transform round exch round exch A itransform} /nice ed\n",
	"{6 array} /n ed\n",
	"n defaultmatrix n currentmatrix n invertmatrix n concatmatrix /A ed\n",
	"urx llx sub 0 A dtransform len /Sx ed\n",
	"0 ury lly sub A dtransform len /Sy ed\n",
	"llx urx add 2 div lly ury add 2 div A transform /Cy ed /Cx ed\n",
	"rot dup sin abs /S ed cos abs /C ed\n",
	"Sx S mul Sy C mul add /H ed\n",
	"Sx C mul Sy S mul add /W ed\n",
	"sy H div /Scaley ed\n",
	"sx W div /Scalex ed\n",
	"s 0 eq {Scalex Scaley min dup /Scalex ed /Scaley ed} if\n",
	"sx Scalex W mul sub 0 max ax 0.5 sub mul cx add /cx ed\n",
	"sy Scaley H mul sub 0 max ay 0.5 sub mul cy add /cy ed\n",
	"urx llx sub 0 A dtransform exch atan rot exch sub /rot ed\n",
	"n currentmatrix initgraphics setmatrix\n",
	"cx cy translate\n",
	"Scalex Scaley scale\n",
	"rot rotate\n",
	"Cx neg Cy neg translate\n",
	"A concat\n",
	"bbox boxpath clip newpath\n",
	"w 0 ne {gsave bbox boxpath 1 setgray fill grestore} if\n",
	"end\n",
	"gsave\n",
	"%ps_include: inclusion begin\n",
	0
};

static char *PS_tail[] = {
	"%ps_include: inclusion end\n",
	"grestore\n",
	"PS-include-dict-dw begin\n",
	"o 0 ne {gsave A defaultmatrix /A ed llx lly nice urx ury nice\n",
	"	initgraphics 0.1 setlinewidth boxpath stroke grestore} if\n",
	"clear o-stack aload pop\n",
	"context end restore\n",
	"%ps_include: end\n",
	0
};