-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha4h.ps
225 lines (225 loc) · 5.35 KB
/
a4h.ps
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
%!
gsave
%
% start user definition
%
% < X unit length (point) >
%
/SYS_Char {72.00 10 div} def
%
% < Y unit length (point) >
%
/SYS_Line {72.00 6 div} def
%
% < X bias (Char) >
%
/SYS_Xbias {0 SYS_Char mul} def
%
% < Y bias (Line) >
%
/SYS_Ybias {0 SYS_Line mul} def
%
% < max printable width (Char) >
%
%/SYS_MaxWidth 110 def
/SYS_MaxWidth 116.92 def
%
% < max printable height (Line) >
%
%/SYS_MaxHeight 46 def
/SYS_MaxHeight 49.6 def
%
% end user definition
%
%----------------------------------------------------------------------
%
% start system definition
%
% CHAR c2p ... convert Char to point
%
/c2p {
/SYS_c2p_CHAR_X exch def
SYS_c2p_CHAR_X SYS_Char mul
SYS_Xbias add
} def
%
% LINE l2p ... convert Line to point
%
/l2p {
/SYS_l2p_LINE_Y exch def
SYS_MaxHeight SYS_Line mul
SYS_Ybias sub
SYS_l2p_LINE_Y SYS_Line mul
sub
} def
%
% DASH setLineStyle (DASH is 0 or 1 or ... )
%
/setLineStyle {
/SYS_setLineStyle_DASH exch def
0 SYS_setLineStyle_DASH eq {[] 0 setdash}
{[SYS_setLineStyle_DASH] 0 setdash} ifelse
} def
%
% GRAY setGrayScale (GRAY is 0 to 1)
%
/setGrayScale {
setgray
} def
%
% X0 Y0 X1 Y1 WIDTH drawLine
%
/drawLine {
/SYS_drawLine_WIDTH exch def
/SYS_drawLine_Y1 exch def
/SYS_drawLine_X1 exch def
/SYS_drawLine_Y0 exch def
/SYS_drawLine_X0 exch def
newpath
SYS_drawLine_WIDTH setlinewidth
SYS_drawLine_X0 c2p SYS_drawLine_Y0 l2p moveto
SYS_drawLine_X1 c2p SYS_drawLine_Y1 l2p lineto
stroke
} def
%
% X0 Y0 X1 Y1 WIDTH XDELTA YDELTA REPEAT drawRepeatLine
%
/drawRepeatLine {
/SYS_drawRepeatLine_REPEAT exch def
/SYS_drawRepeatLine_YDELTA exch def
/SYS_drawRepeatLine_XDELTA exch def
/SYS_drawRepeatLine_WIDTH exch def
/SYS_drawRepeatLine_Y1 exch def
/SYS_drawRepeatLine_X1 exch def
/SYS_drawRepeatLine_Y0 exch def
/SYS_drawRepeatLine_X0 exch def
SYS_drawRepeatLine_REPEAT {
SYS_drawRepeatLine_X0 SYS_drawRepeatLine_Y0
SYS_drawRepeatLine_X1 SYS_drawRepeatLine_Y1
SYS_drawRepeatLine_WIDTH drawLine
SYS_drawRepeatLine_X0 SYS_drawRepeatLine_XDELTA add
/SYS_drawRepeatLine_X0 exch def
SYS_drawRepeatLine_Y0 SYS_drawRepeatLine_YDELTA add
/SYS_drawRepeatLine_Y0 exch def
SYS_drawRepeatLine_X1 SYS_drawRepeatLine_XDELTA add
/SYS_drawRepeatLine_X1 exch def
SYS_drawRepeatLine_Y1 SYS_drawRepeatLine_YDELTA add
/SYS_drawRepeatLine_Y1 exch def
} repeat
} def
%
% X0 Y0 X1 Y1 WIDTH drawBox
%
/drawBox {
/SYS_drawBox_WIDTH exch def
/SYS_drawBox_Y1 exch def
/SYS_drawBox_X1 exch def
/SYS_drawBox_Y0 exch def
/SYS_drawBox_X0 exch def
SYS_drawBox_X0 SYS_drawBox_Y0 SYS_drawBox_X0 SYS_drawBox_Y1
SYS_drawBox_WIDTH drawLine
SYS_drawBox_X0 SYS_drawBox_Y1 SYS_drawBox_X1 SYS_drawBox_Y1
SYS_drawBox_WIDTH drawLine
SYS_drawBox_X1 SYS_drawBox_Y1 SYS_drawBox_X1 SYS_drawBox_Y0
SYS_drawBox_WIDTH drawLine
SYS_drawBox_X1 SYS_drawBox_Y0 SYS_drawBox_X0 SYS_drawBox_Y0
SYS_drawBox_WIDTH drawLine
} def
%
% X0 Y0 X1 Y1 fillBox
%
/fillBox {
/SYS_fillBox_Y1 exch def
/SYS_fillBox_X1 exch def
/SYS_fillBox_Y0 exch def
/SYS_fillBox_X0 exch def
newpath
SYS_fillBox_X0 c2p SYS_fillBox_Y0 l2p moveto
SYS_fillBox_X0 c2p SYS_fillBox_Y1 l2p lineto
SYS_fillBox_X1 c2p SYS_fillBox_Y1 l2p lineto
SYS_fillBox_X1 c2p SYS_fillBox_Y0 l2p lineto
closepath
fill
} def
%
% POINT FONT setChar
%
/FONT_NORMAL 0 def
/FONT_ITALIC 1 def
/FONT_BOLD 2 def
/FONT_BOLDITALIC 3 def
%
/setChar {
/SYS_setChar_FONT exch def
/SYS_setChar_POINT exch def
SYS_setChar_FONT FONT_NORMAL eq {/Courier findfont} if
SYS_setChar_FONT FONT_ITALIC eq {/Courier_Italic findfont} if
SYS_setChar_FONT FONT_BOLD eq {/Courier_Bold findfont} if
SYS_setChar_FONT FONT_BOLDITALIC eq {/Courier_BoldItalic findfont} if
SYS_setChar_POINT scalefont
setfont
} def
%
% POINT KFONT setKanjiChar
%
/KFONT_RYUMIN 0 def
/KFONT_RYUMIN_V 1 def
/KFONT_GOTHIC 2 def
/KFONT_GOTHIC_V 3 def
%
/setKanjiChar {
/SYS_setKanjiChar_KFONT exch def
/SYS_setKanjiChar_POINT exch def
SYS_setKanjiChar_KFONT KFONT_RYUMIN eq {/Ryumin-Light-UniJIS-UTF8-H findfont} if
SYS_setKanjiChar_KFONT KFONT_RYUMIN_V eq {/Ryumin-Light-UniJIS-UTF8-V findfont} if
SYS_setKanjiChar_KFONT KFONT_GOTHIC eq {/GothicBBB-Medium-UniJIS-UTF8-H findfont} if
SYS_setKanjiChar_KFONT KFONT_GOTHIC_V eq {/GothicBBB-Medium-UniJIS-UTF8-V findfont} if
SYS_setKanjiChar_POINT scalefont
setfont
} def
%
% X Y (TEXT) drawText
% X Y <KANJI_TEXT> drawText
%
/SYS_drawText_Xgap 0 def
/SYS_drawText_Ygap 0 def
%
/drawText {
/SYS_drawText_TEXT exch def
/SYS_drawText_Y exch def
/SYS_drawText_X exch def
SYS_drawText_X c2p SYS_drawText_Y 1 add l2p moveto
SYS_drawText_Xgap SYS_drawText_Ygap SYS_drawText_TEXT ashow
} def
%
% GAP setXgap
%
/setXgap {
/SYS_drawText_Xgap exch def
} def
%
% GAP setYgap
%
/setYgap {
/SYS_drawText_Ygap exch def
} def
%
% rotate 90 degree
%
/SYS_A4_V_Dot {297 25.4 div 72 mul} def
/SYS_A4_H_Dot {210 25.4 div 72 mul} def
%
/oldshowpage /showpage load def
-90 rotate
SYS_A4_V_Dot neg 0 translate
/showpage
{
oldshowpage
0 0 moveto
-90 rotate
SYS_A4_V_Dot neg 0 translate
} def
%
% end system definition
%
%----------------------------------------------------------------------