Debian Codegraph @

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

raw
1 % This is
2 % pkknight.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 def sympoint (expr p,d,a) =
21 % Come to point p in direction d + angel a, and leave symmetrical
22 % to d - a This gives us a peak in p pointing in direction d.
23 % sharpnes is specified by a. a= 0 no peak, a=90 real peak;
24
25 {dir (angle(d)+a)} p {dir(angle(d)+180-a)}
26 enddef;
27
28 def Ear(expr p,pd,q,qd,a,r,rd) =
29 p{pd} .. sympoint(q,qd,a) .. {rd}r
30 enddef;
31
32 def DefineKnightPath =
33 % we construct the path from right to left.
34 % Ie we begin with the nack and come then to the ears,
35 % the nose etc
36 z0 = (.35qs,BottomSpace); % The leftmost bottompoint
37 z1 = (qs-SideSpace,BottomSpace); % The right bottom edge
38 path Foot;
39 Foot = z0 -- z1;
40 % z2 will be later defined, it
41 % is the connection to the right
42 % ear
43 z4 = (.5qs,qs-TopSpace); % The peak of the right ear
44 z3 = z4 + (.07qs,-0.15qs); % The right lower point of the
45 % right ear
46 z5 = z3 - (.08qs,.01qs ); % The left lower point of the
47 % right ear
48
49 % Now comes the definition of the right ear
50 % There are two paths:
51 % RightEar: The complete path for the ear
52 % sRightEar: The subpath for the whole shape
53 path RightEar, sRightEar;
54 RightEar = Ear(z3,(1,5),z4,(0,1),10,z5,(1,-5));
55 sRightEar = subpath (.25,1.75) of RightEar;
56 z2 = point 0 of sRightEar; % The right
57 z6 = point 2 of sRightEar; % The left connection point of
58 % the right ear
59
60 % Now we can also define the nack
61 path Nack;
62 Nack = z1{up} .. tension 1 and 1 .. {left}z2;
63
64 z7 = z6 + (-.1qs,-0.07qs); % This is the point under the
65 % left ear
66
67 % Now the two pathes from the right to the left ear.
68 % EarUnderEar, goes from the right ear under the left ear
69 % EarToEar connects only the two ears
70
71 path EarUnderEar,EarToEar;
72 EarUnderEar= z6{left} .. {-5,-3}z7;
73 EarToEar = subpath (0,.5) of EarUnderEar;
74
75 z8 = point 1 of EarToEar; % The connection point and the
76 % start of the left ear
77
78 % to get easier definition of the following points
79 % we define a line bx from z7 (point under left ear) down to z13
80 % (leftmost point of shape) ie the begining of nose and mount
81
82 z13 = (SideSpace,0.35qs); % The leftmost point of the
83 % shape
84 pair bx,by;
85 bx = z13 - z7;
86 by = z13 rotatedabout (z7,-90);
87
88 z9 = z7 + .23bx + .24by; % the peak of the left ear
89 z10= z7 + .11bx + .10by; % the left point of the left ear
90
91 % Now the path for the leaft ear
92 path LeftEar;
93 LeftEar= Ear(z8,(-1,5),z9,(-1,1),8,z10,(2,-5));
94
95 z11 = z7 + .4bx + .09by;
96 z12 = z7 + .5bx + .05by;
97
98 path Bless;
99 Bless = z10{dir(angle(bx)-10)} .. z11 .. z12 .. {down} z13;
100
101 % the points from z14 to z17 are defined via a line nx
102 % from z13 to z18
103 pair nx,ny;
104
105 z19 = (.25qs,.25qs);
106 nx = z19 - z13;
107 ny = nx rotatedabout ((0,0),90);
108
109 z14 = z13 + .30nx - .13ny; % the point between mouth
110 % and nose
111 z15 = z13 + .63nx - .02ny; % the upper point of mouth
112 z16 = z13 + .72nx + .15ny; % the inner point of mouth
113 z17 = z13 + .77nx - .02ny; %
114 z18 = z13 + .87nx - .08ny; %
115 z25 = z13 + .22nx + .28ny; % the location of the nose
116
117 path MouthNose;
118 MouthNose = z13 .. z14{nx} .. z15 ... sympoint(z16,(z16-z17),0)
119 ... z17 .. z18 .. z19;
120
121 % the points from z20 to z23 are defined via a line nx
122 % from z19 to z23
123 pair ux,uy;
124
125 z23 = (.55qs,.61qs);
126 ux = z23 - z19;
127 uy = z23 rotatedabout (z19,90);
128
129 z20 = z19 + .15ux + .01uy;
130 z21 = z19 + .45ux - .05uy;
131 z22 = z19 + .88ux - .15uy;
132 path UnderMouth, sUnderMouth;
133 UnderMouth = z19 ..z20..z21..z22..{up}z23;
134 sUnderMouth = subpath (0,3) of UnderMouth;
135
136 z24 = z22 + .06qs*down;
137 path ToFoot;
138 ToFoot = z22{down} .. z24 .. {down}z0;
139
140
141 path KnightShape;
142 KnightShape = Foot & Nack & sRightEar & EarToEar
143 & LeftEar & Bless & MouthNose
144 & sUnderMouth & ToFoot & cycle;
145
146 enddef;
147
148 def DefineNosePath(expr p,s) =
149 begingroup
150 if proofing >0:
151 show p,s;
152 fi;
153 save z; pair z[];
154
155 z0 + (0,s) = p;
156 pair px,py;
157 py= p - z0;
158 px= py rotated -90;
159 z1= z0 + 0.10px + 0.50py;
160 z2= z0 + 0.70px + 1.00py;
161 z3= z0 + 0.70px + 1.60py;
162 z4= z0 + 0.10px + 2.10py;
163 z5= z0 - 0.20px + 1.90py;
164 z6= z0 - 0.60px + 0.50py;
165 z7= z0 - 0.60px + 0.10py;
166 z8= z0 - 0.50px + 0.00py;
167 forsuffixes i=0,1,2,3,4,5,6,7,8:
168 z[i]..
169 endfor cycle
170 endgroup
171 enddef;
172
173 def EyePath (expr p,s) =
174 begingroup
175 save z; pair z[];
176
177 z0 + (0,s) = p;
178 pair px,py;
179 py= p - z0;
180 px= py rotated -90;
181
182 z1= z0 + 1.00px + 1.00py;
183
184 z0{0,1} .. {1,0} z1 & z1 {0,-1} .. {-1,0}z0 & cycle
185 endgroup
186 enddef;
187
188 def MakeWhiteKnight =
189 clearit;
190 pickup chess_pen;
191 draw Foot;
192 draw RightEar;
193 draw EarUnderEar;
194 draw LeftEar & Bless & MouthNose & UnderMouth;
195 draw ToFoot;
196 draw EyePath(z7-(.04qs,.05qs),.03qs);
197 filldraw DefineNosePath(z25,.015qs);
198 pickup chess_pen xscaled 2 rotated -10;
199 draw ShortenEnd(Nack,thin);
200 WhiteMan:= currentpicture;
201 enddef;
202
203 def MakeBlackKnight =
204 clearit;
205 pickup chess_pen;
206
207 filldraw KnightShape;
208 cullit;
209 unfilldraw DefineNosePath(z25,.015qs);
210 undraw EyePath(z7-(.04qs,.05qs),.03qs);
211 pickup chess_pen scaled .7 rotated -70;
212 undraw ShortenPath(ParallelPath(Nack,1.3thin),thin);
213 pickup chess_pen scaled .5;
214 undraw subpath (3,3.5) of UnderMouth;
215 BlackMan:= currentpicture;
216 enddef;
217
218 def MakeKnightSpace =
219 clearit;
220 pickup frame_pen;
221 filldraw KnightShape;
222 cullit;
223 OuterShape:= currentpicture;
224 enddef;
225
226 DefineKnightPath;
227 %DefineNosePath(z25,.2qs);
228
229 MakeWhiteKnight;
230 MakeBlackKnight;
231 MakeNeutral(WhiteMan,BlackMan);
232 MakeKnightSpace;
233
234 %===========================================================
235
236 beginchar(Knight+White+OnWhite, qs#, qs#, 0);
237 "White knight on white field";
238 currentpicture:= WhiteMan;
239 labels(z0,z1l,z1,z1r,z2l,z2,z2r);
240 labels(z3l,z3,z3l,z4,z5,z6l,z6r);
241 labels(z7l,z7,z7r,z8);
242 endchar;
243 if proofing = 0:
244
245 beginchar(Knight+White+OnWhite+LeftTurned, qs#, qs#, 0);
246 "White knight turned to the left on white field";
247 currentpicture:= TurnLeft(WhiteMan);
248 endchar;
249
250 beginchar(Knight+White+OnWhite+RightTurned, qs#, qs#, 0);
251 "White knight turned to the right on white field";
252 currentpicture:= TurnRight(WhiteMan);
253 endchar;
254
255 beginchar(Knight+White+OnWhite+UpSideDown, qs#, qs#, 0);
256 "White knight turned upsidedown on white field";
257 currentpicture:= TurnUpSideDown(WhiteMan);
258 endchar;
259
260 %===========================================================
261
262 beginchar(Knight+White+OnBlack, qs#, qs#, 0);
263 "White knight on black field";
264 MakeBlackField;
265 cullit;
266 currentpicture:= currentpicture - OuterShape;
267 cullit;
268 currentpicture:= currentpicture + WhiteMan;
269 endchar;
270
271 beginchar(Knight+White+OnBlack+LeftTurned, qs#, qs#, 0);
272 "White knight turned to the left on black field";
273 MakeBlackField;
274 cullit;
275 currentpicture:= currentpicture - TurnLeft(OuterShape);
276 cullit;
277 currentpicture:= currentpicture + TurnLeft(WhiteMan);
278 endchar;
279
280 beginchar(Knight+White+OnBlack+RightTurned, qs#, qs#, 0);
281 "White knight turned to the right on black field";
282 MakeBlackField;
283 currentpicture:= currentpicture - TurnRight(OuterShape);
284 cullit;
285 currentpicture:= currentpicture + TurnRight(WhiteMan);
286 endchar;
287
288 beginchar(Knight+White+OnBlack+UpSideDown, qs#, qs#, 0);
289 "White knight turned upsidedown on black field";
290 MakeBlackField;
291 cullit;
292 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
293 cullit;
294 currentpicture:= currentpicture + TurnUpSideDown(WhiteMan);
295 endchar;
296
297 %===========================================================
298
299 beginchar(Knight+Neutral+OnWhite, qs#, qs#, 0);
300 "Neutral knight on white field";
301 currentpicture:= NeutralMan;
302 endchar;
303
304 beginchar(Knight+Neutral+OnWhite+LeftTurned, qs#, qs#, 0);
305 "Neutral knight turned to the left on white field";
306 currentpicture:= TurnLeft(NeutralMan);
307 endchar;
308
309 beginchar(Knight+Neutral+OnWhite+RightTurned, qs#, qs#, 0);
310 "Neutral knight turned to the right on white field";
311 currentpicture:= TurnRight(NeutralMan);
312 endchar;
313
314 beginchar(Knight+Neutral+OnWhite+UpSideDown, qs#, qs#, 0);
315 "Neutral knight turned upsidedown on white field";
316 currentpicture:= TurnUpSideDown(NeutralMan);
317 endchar;
318
319 %===========================================================
320
321 beginchar(Knight+Neutral+OnBlack, qs#, qs#, 0);
322 "Neutral knight on black field";
323 MakeBlackField;
324 cullit;
325 currentpicture:= currentpicture - OuterShape;
326 cullit;
327 currentpicture:= currentpicture + NeutralMan;
328 endchar;
329
330 beginchar(Knight+Neutral+OnBlack+LeftTurned, qs#, qs#, 0);
331 "Neutral knight turned to the left on black field";
332 MakeBlackField;
333 cullit;
334 currentpicture:= currentpicture - TurnLeft(OuterShape);
335 cullit;
336 currentpicture:= currentpicture + TurnLeft(NeutralMan);
337 endchar;
338
339 beginchar(Knight+Neutral+OnBlack+RightTurned, qs#, qs#, 0);
340 "Neutral knight turned to the right on black field";
341 MakeBlackField;
342 currentpicture:= currentpicture - TurnRight(OuterShape);
343 cullit;
344 currentpicture:= currentpicture + TurnRight(NeutralMan);
345 endchar;
346
347 beginchar(Knight+Neutral+OnBlack+UpSideDown, qs#, qs#, 0);
348 "Neutral knight turned upsidedown on black field";
349 MakeBlackField;
350 cullit;
351 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
352 cullit;
353 currentpicture:= currentpicture + TurnUpSideDown(NeutralMan);
354 endchar;
355
356 %===========================================================
357
358 beginchar(Knight+Black+OnWhite, qs#, qs#, 0);
359 "Black knight on white field";
360 currentpicture:= BlackMan;
361 endchar;
362
363 beginchar(Knight+Black+OnWhite+LeftTurned, qs#, qs#, 0);
364 "Black knight turned to the left on white field";
365 currentpicture:= TurnLeft(BlackMan);
366 endchar;
367
368 beginchar(Knight+Black+OnWhite+RightTurned, qs#, qs#, 0);
369 "Black knight turned to the right on white field";
370 currentpicture:= TurnRight(BlackMan);
371 endchar;
372
373 beginchar(Knight+Black+OnWhite+UpSideDown, qs#, qs#, 0);
374 "Black knight turned upsidedown on white field";
375 currentpicture:= TurnUpSideDown(BlackMan);
376 endchar;
377
378 %===========================================================
379
380 beginchar(Knight+Black+OnBlack, qs#, qs#, 0);
381 "Black knight on black field";
382 MakeBlackField;
383 cullit;
384 currentpicture:= currentpicture - OuterShape;
385 cullit;
386 currentpicture:= currentpicture + BlackMan;
387 endchar;
388
389 beginchar(Knight+Black+OnBlack+LeftTurned, qs#, qs#, 0);
390 "Black knight turned to the left on black field";
391 MakeBlackField;
392 cullit;
393 currentpicture:= currentpicture - TurnLeft(OuterShape);
394 cullit;
395 currentpicture:= currentpicture + TurnLeft(BlackMan);
396 endchar;
397
398 beginchar(Knight+Black+OnBlack+RightTurned, qs#, qs#, 0);
399 "Black knight turned to the right on black field";
400 MakeBlackField;
401 currentpicture:= currentpicture - TurnRight(OuterShape);
402 cullit;
403 currentpicture:= currentpicture + TurnRight(BlackMan);
404 endchar;
405
406 beginchar(Knight+Black+OnBlack+UpSideDown, qs#, qs#, 0);
407 "Black knight turned upsidedown on black field";
408 MakeBlackField;
409 cullit;
410 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
411 cullit;
412 currentpicture:= currentpicture + TurnUpSideDown(BlackMan);
413 endchar;
414 fi;
415
416 %