Debian Codegraph @

texmf-dist/fonts/source/public/bartel-chess-fonts/pkrook.mf

raw
1 % This is
2 % pkrook.mf
3 %
4 % Copyright (C) 1989-92 by Elmar Bartel.
5 %
6 % This program is free software; you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation; either version 1, or (at your option)
9 % any later version.
10 %
11 % This program is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 % GNU General Public License for more details.
15 %
16 % You should have received a copy of the GNU General Public License
17 % along with this program; if not, write to the Free Software
18 % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 %
20
21
22 def MakeRookPath =
23
24 numeric wdbotta,wdbottb,wdstem,wdtop; % The widths
25 numeric htbotta,htbottb,htbottc,httopa,httopb;
26 numeric x[]; numeric y[];
27
28 wdbotta:= .90 BottomWidth;
29 wdbottb:= .80 BottomWidth;
30 wdstem := .55 BottomWidth;
31 wdtop := .80 BottomWidth;
32
33 htbotta:= .11BottomWidth;
34 htbottb:= .11BottomWidth;
35 htbottc:= .15BottomWidth;
36 httopa := .15BottomWidth;
37 httopb := .18BottomWidth;
38
39 rt x1 = rt x3 = .5(qs+wdbotta);
40 lft x2 = lft x4 = .5(qs-wdbotta);
41 bot y1 = bot y2 = BottomSpace;
42 top y3 = top y4 = BottomSpace+htbotta;
43
44 y5 = y6 = y4;
45 top y8 - bot y6 = top y7 - bot y5 = htbottb;
46 rt x5 = rt x7 = .5(qs+wdbottb);
47 lft x6 = lft x8 = .5(qs-wdbottb);
48
49 top y9 - bot y7 = top y10 - bot y8 = htbottc;
50 rt x9 = rt x11 = .5(qs+wdstem);
51 lft x10 = lft x12 = .5(qs-wdstem);
52 top y13 - bot y11 = top y14 - bot y12 = httopa;
53 top y15 - bot y13 = top y16 - bot y14 = httopb;
54 top y15 = top y16 = qs - TopSpace;
55 rt x13 = rt x15 = .5(qs+wdtop);
56 lft x14 = lft x16 = .5(qs-wdtop);
57
58 path LeftP,RightP,RookPath,SmP[];
59 LeftP= z16--z14--z12--z10--z8--z6--z4--z2;
60 RightP= z1--z3--z5--z7--z9--z11--z13--z15;
61
62 def RookTopPath(expr nn) =
63 numeric wdt; wdt = abs xpart(z15-z16)/(2nn+2);
64 numeric sdt; sdt = .5wdt;
65 pair pt,pb;
66 path TopP; TopP=z15;
67 pt = z15-(sdt,0);
68 bot pb = z15-(sdt,.5httopb);
69 for i=1 upto nn+1:
70 TopP:= TopP--pt--pb;
71 pb:= pb-(wdt,0);
72 pt:= pt-(wdt,0);
73 TopP:= TopP--pb--pt;
74 pb:= pb-(wdt,0);
75 pt:= pt-(wdt,0);
76 endfor;
77 TopP:= TopP--z16;
78 enddef;
79
80 RookTopPath(2);
81 RookPath=RightP & TopP & LeftP -- cycle;
82
83 SmP1= z5--z6;
84 SmP2= z7--z8;
85 SmP3= z9--z10;
86 SmP4= z11--z12;
87 SmP5= z13--z14;
88
89 if proofing > 0:
90 labels(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
91 def PixelGrid(expr PixPerInch, w) =
92 if proofing > 0:
93 begingroup
94 numeric d;
95 d = pixels_per_inch/PixPerInch;
96 makegrid(0,
97 for i=d step d until w: ,i endfor)
98 (0,for i=d step d until w: ,i endfor)
99 endgroup;
100 fi;
101 enddef;
102 PixelGrid(400,qs);
103 fi
104
105 enddef;
106 %------------------------------------------------------------
107 def DrawInner =
108 %pickup inner_pen;
109 pickup chess_pen;
110 forsuffixes $=1,2,3,4,5:
111 draw SmP$;
112 endfor;
113 enddef;
114 %------------------------------------------------------------
115 def UnDrawInner =
116 pickup chess_pen;
117 forsuffixes $=1,2,3,4,5:
118 undraw ShortenPath(SmP$,thin);
119 endfor;
120 enddef;
121 %------------------------------------------------------------
122
123 def MakeWhiteRook =
124 clearit;
125 draw RookPath;
126 DrawInner;
127 cullit;
128 WhiteMan:= currentpicture;
129 enddef;
130
131 def MakeBlackRook =
132 clearit;
133 filldraw RookPath;
134 UnDrawInner;
135 cullit;
136 BlackMan:= currentpicture;
137 enddef;
138
139 def MakeOuterShape =
140 clearit;
141 pickup frame_pen;
142 filldraw RookPath;
143 cullit;
144 OuterShape:= currentpicture;
145 enddef;
146
147 MakeRookPath;
148 MakeWhiteRook;
149 MakeBlackRook;
150 MakeNeutral(WhiteMan, BlackMan);
151 MakeOuterShape;
152
153 %-----------------------------------------------------------------------
154 beginchar(Rook+White+OnWhite, qs#, qs#, 0);
155 "White rook on white field";
156 currentpicture:= WhiteMan;
157 endchar;
158
159 beginchar(Rook+White+OnWhite+LeftTurned, qs#, qs#, 0);
160 "White rook on white field rotated to the left";
161 currentpicture:= TurnLeft(WhiteMan);
162 endchar;
163
164 beginchar(Rook+White+OnWhite+RightTurned, qs#, qs#, 0);
165 "White rook on white field rotated to the right";
166 currentpicture:= TurnRight(WhiteMan);
167 endchar;
168
169 beginchar(Rook+White+OnWhite+UpSideDown, qs#, qs#, 0);
170 "White rook on white field upside down";
171 currentpicture:= TurnUpSideDown(WhiteMan);
172 endchar;
173
174 beginchar(Rook+Black+OnWhite, qs#, qs#, 0);
175 "Black rook on white field";
176 currentpicture:= BlackMan;
177 endchar;
178
179 beginchar(Rook+Black+OnWhite+LeftTurned, qs#, qs#, 0);
180 "Black rook on white field rotated to the left";
181 currentpicture:= TurnLeft(BlackMan);
182 endchar;
183
184 beginchar(Rook+Black+OnWhite+RightTurned, qs#, qs#, 0);
185 "Black rook on white field rotated to the right";
186 currentpicture:= TurnRight(BlackMan);
187 endchar;
188
189 beginchar(Rook+Black+OnWhite+UpSideDown, qs#, qs#, 0);
190 "Black rook on white field upside down";
191 currentpicture:= TurnUpSideDown(BlackMan);
192 endchar;
193
194 beginchar(Rook+Neutral+OnWhite, qs#, qs#, 0);
195 "Neutral rook on white field";
196 currentpicture:= NeutralMan;
197 endchar;
198
199 beginchar(Rook+Neutral+OnWhite+LeftTurned, qs#, qs#, 0);
200 "Neutral rook on white field rotated to the left";
201 currentpicture:= TurnLeft(NeutralMan);
202 endchar;
203
204 beginchar(Rook+Neutral+OnWhite+RightTurned, qs#, qs#, 0);
205 "Neutral rook on white field rotated to the right";
206 currentpicture:= TurnRight(NeutralMan);
207 endchar;
208
209 beginchar(Rook+Neutral+OnWhite+UpSideDown, qs#, qs#, 0);
210 "Neutral rook on white field upside down";
211 currentpicture:= TurnUpSideDown(NeutralMan);
212 endchar;
213
214 beginchar(Rook+White+OnBlack, qs#, qs#, 0);
215 "White rook on black field";
216 MakeBlackField;
217 currentpicture:= currentpicture - OuterShape;
218 cullit;
219 currentpicture:= currentpicture + WhiteMan;
220 endchar;
221
222 beginchar(Rook+White+OnBlack+LeftTurned, qs#, qs#, 0);
223 "White rook on black field turned to the left";
224 MakeBlackField;
225 currentpicture:= currentpicture - TurnLeft(OuterShape);
226 cullit;
227 currentpicture:= currentpicture + TurnLeft(WhiteMan);
228 endchar;
229
230 beginchar(Rook+White+OnBlack+RightTurned, qs#, qs#, 0);
231 "White rook on black field turned to the right";
232 MakeBlackField;
233 currentpicture:= currentpicture - TurnRight(OuterShape);
234 cullit;
235 currentpicture:= currentpicture + TurnRight(WhiteMan);
236 endchar;
237
238 beginchar(Rook+White+OnBlack+UpSideDown, qs#, qs#, 0);
239 "White rook on black field upsidedown";
240 MakeBlackField;
241 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
242 cullit;
243 currentpicture:= currentpicture + TurnUpSideDown(WhiteMan);
244 endchar;
245
246 beginchar(Rook+Neutral+OnBlack, qs#, qs#, 0);
247 "Neutral rook on black field";
248 MakeBlackField;
249 currentpicture:= currentpicture - OuterShape;
250 cullit;
251 currentpicture:= currentpicture + NeutralMan;
252 endchar;
253
254 beginchar(Rook+Neutral+OnBlack+LeftTurned, qs#, qs#, 0);
255 "Neutral rook on black field turned to the left";
256 MakeBlackField;
257 currentpicture:= currentpicture - TurnLeft(OuterShape);
258 cullit;
259 currentpicture:= currentpicture + TurnLeft(NeutralMan);
260 endchar;
261
262 beginchar(Rook+Neutral+OnBlack+RightTurned, qs#, qs#, 0);
263 "Neutral rook on black field turned to the right";
264 MakeBlackField;
265 currentpicture:= currentpicture - TurnRight(OuterShape);
266 cullit;
267 currentpicture:= currentpicture + TurnRight(NeutralMan);
268 endchar;
269
270 beginchar(Rook+Neutral+OnBlack+UpSideDown, qs#, qs#, 0);
271 "Neutral rook on black field upsidedown";
272 MakeBlackField;
273 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
274 cullit;
275 currentpicture:= currentpicture + TurnUpSideDown(NeutralMan);
276 endchar;
277
278 beginchar(Rook+Black+OnBlack, qs#, qs#, 0);
279 "Black rook on black field";
280 MakeBlackField;
281 currentpicture:= currentpicture - OuterShape;
282 cullit;
283 currentpicture:= currentpicture + BlackMan;
284 endchar;
285
286 beginchar(Rook+Black+OnBlack+LeftTurned, qs#, qs#, 0);
287 "Black rook on black field turned to the left";
288 MakeBlackField;
289 currentpicture:= currentpicture - TurnLeft(OuterShape);
290 cullit;
291 currentpicture:= currentpicture + TurnLeft(BlackMan);
292 endchar;
293
294 beginchar(Rook+Black+OnBlack+RightTurned, qs#, qs#, 0);
295 "Black rook on black field turned to the right";
296 MakeBlackField;
297 currentpicture:= currentpicture - TurnRight(OuterShape);
298 cullit;
299 currentpicture:= currentpicture + TurnRight(BlackMan);
300 endchar;
301
302 beginchar(Rook+Black+OnBlack+UpSideDown, qs#, qs#, 0);
303 "Black rook on black field upsidedown";
304 MakeBlackField;
305 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
306 cullit;
307 currentpicture:= currentpicture + TurnUpSideDown(BlackMan);
308 endchar;