Debian Codegraph @

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

raw
1 % This is
2 % pkbishop.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 slope(expr orig,middle,far,wd,angle) =
21 begingroup
22 save x, y, p;
23 path p.l,p.r;
24 pair inter;
25
26 z0r= orig;
27 z1r= middle;
28 z2= far;
29 penpos0(wd,90+angle);
30 penpos1(wd,90);
31 penpos2(wd,90+angle);
32 forsuffixes e=l,r:
33 p.e:= z2e{dir angle}.. z1e{right} .. {dir angle}z0e;
34 endfor;
35 inter = p.l intersectiontimes p.l reflectedabout (orig,orig+up);
36 reverse p.r --
37 subpath (0,xpart inter) of p.l ..
38 reverse subpath (0,xpart inter) of p.l
39 reflectedabout (orig,orig+up) --
40 p.r reflectedabout (orig,orig+up)
41 endgroup
42 enddef;
43
44 def MakeBishopPath =
45
46 numeric TopDiameter;
47 TopDiameter = .08qs;
48 DefineFootBows( .10qs, % Distance to BottomSpace
49 .44qs, % BowOneWidth
50 .20qs, % FootHeight
51 .40, % BowTwoLoc
52 .13, % WidthToHeight
53 .88, % BowTwoLen
54 .80); % BowThreeLen
55 x4l + x4r = qs;
56 x4r - x4l = .60qs;
57 x4 = x3;
58 y4l = y4r = y4 = y3 + .15qs; % Sides of the shape with
59 % vertical tangents
60
61 x5 = x4;
62 top (y5 + TopDiameter) = qs - TopSpace;
63
64 pair TopDir.l, TopDir.r;
65 TopDir.l = dir 45;
66 TopDir.r = (xpart TopDir.l, -ypart TopDir.l);
67
68 numeric TopDiameter;
69 TopDiameter = .08qs;
70
71 path LeftShape,RightShape,BishopPath;
72 LeftShape = z1l .. z2l .. z3l .. {up}z4l .. {TopDir.l}z5;
73 RightShape= z5{TopDir.r} .. z4r{down} .. z3r .. z2r .. z1r;
74 BishopPath = LeftShape & RightShape & Bow0 & cycle;
75
76 path Peak;
77 Peak:= fullcircle scaled TopDiameter
78 shifted (z5+.5TopDiameter*up);
79
80 path CrossV,CrossH;
81
82 z7= .2[z3,z5];
83 z8= .7[z3,z5];
84 CrossV:= z7 .. z8;
85 CrossH= CrossV rotatedaround (.5[z7,z8],90);
86
87 path Slope;
88 numeric angle;
89
90 angle= 60;
91 x12 = SideSpace;
92 y12 = BottomSpace;
93 z11 = .5[z12,z10];
94 z10 = z0;
95 Slope= slope(z10,z11,z12,1.2thin,50) .. cycle;
96
97 enddef;
98
99 def MakeWhiteBishop =
100 pickup chess_pen;
101 clearit;
102 draw BishopPath;
103 forsuffixes $=1,2,3: draw Bow$; endfor
104 draw Peak;
105 draw CrossV;
106 draw CrossH;
107 pickup inner_pen;
108 draw Slope;
109 WhiteMan:= currentpicture;
110 enddef;
111
112 def MakeBlackBishop =
113 pickup chess_pen;
114 clearit;
115 filldraw BishopPath;
116 forsuffixes $=1,2,3: undraw ShortenPath(Bow$,1.2thin); endfor
117 undraw ShortenPath(ParallelPath(LeftShape,-thin),thin);
118 undraw ShortenPath(ParallelPath(RightShape,-thin),thin);
119 filldraw Peak;
120 undraw CrossV;
121 undraw CrossH;
122 pickup inner_pen;
123 filldraw Slope;
124 BlackMan:= currentpicture;
125 enddef;
126
127 def MakeOuterShape =
128 clearit;
129 pickup frame_pen;
130 filldraw BishopPath;
131 filldraw Peak;
132 filldraw Slope;
133 cullit;
134 OuterShape:= currentpicture;
135 enddef;
136
137 MakeBishopPath;
138 MakeWhiteBishop;
139 MakeBlackBishop;
140 MakeNeutral(WhiteMan,BlackMan);
141 MakeOuterShape;
142
143 %-----------------------------------------------------------------------
144 beginchar(Bishop+White+OnWhite, qs#, qs#, 0);
145 "White bishop on white field";
146 currentpicture:= WhiteMan;
147 endchar;
148
149 beginchar(Bishop+White+OnWhite+LeftTurned, qs#, qs#, 0);
150 "White bishop on white field rotated to the left";
151 currentpicture:= TurnLeft(WhiteMan);
152 endchar;
153
154 beginchar(Bishop+White+OnWhite+RightTurned, qs#, qs#, 0);
155 "White bishop on white field rotated to the right";
156 currentpicture:= TurnRight(WhiteMan);
157 endchar;
158
159 beginchar(Bishop+White+OnWhite+UpSideDown, qs#, qs#, 0);
160 "White bishop on white field upside down";
161 currentpicture:= TurnUpSideDown(WhiteMan);
162 endchar;
163
164 beginchar(Bishop+Black+OnWhite, qs#, qs#, 0);
165 "Black bishop on white field";
166 currentpicture:= BlackMan;
167 endchar;
168
169 beginchar(Bishop+Black+OnWhite+LeftTurned, qs#, qs#, 0);
170 "Black bishop on white field rotated to the left";
171 currentpicture:= TurnLeft(BlackMan);
172 endchar;
173
174 beginchar(Bishop+Black+OnWhite+RightTurned, qs#, qs#, 0);
175 "Black bishop on white field rotated to the right";
176 currentpicture:= TurnRight(BlackMan);
177 endchar;
178
179 beginchar(Bishop+Black+OnWhite+UpSideDown, qs#, qs#, 0);
180 "Black bishop on white field upside down";
181 currentpicture:= TurnUpSideDown(BlackMan);
182 endchar;
183
184 beginchar(Bishop+Neutral+OnWhite, qs#, qs#, 0);
185 "Neutral bishop on white field";
186 currentpicture:= NeutralMan;
187 endchar;
188
189 beginchar(Bishop+Neutral+OnWhite+LeftTurned, qs#, qs#, 0);
190 "Neutral bishop on white field rotated to the left";
191 currentpicture:= TurnLeft(NeutralMan);
192 endchar;
193
194 beginchar(Bishop+Neutral+OnWhite+RightTurned, qs#, qs#, 0);
195 "Neutral bishop on white field rotated to the right";
196 currentpicture:= TurnRight(NeutralMan);
197 endchar;
198
199 beginchar(Bishop+Neutral+OnWhite+UpSideDown, qs#, qs#, 0);
200 "Neutral bishop on white field upside down";
201 currentpicture:= TurnUpSideDown(NeutralMan);
202 endchar;
203
204 beginchar(Bishop+White+OnBlack, qs#, qs#, 0);
205 "White bishop on black field";
206 MakeBlackField;
207 currentpicture:= currentpicture - OuterShape;
208 cullit;
209 currentpicture:= currentpicture + WhiteMan;
210 endchar;
211
212 beginchar(Bishop+White+OnBlack+LeftTurned, qs#, qs#, 0);
213 "White bishop on black field turned to the left";
214 MakeBlackField;
215 currentpicture:= currentpicture - TurnLeft(OuterShape);
216 cullit;
217 currentpicture:= currentpicture + TurnLeft(WhiteMan);
218 endchar;
219
220 beginchar(Bishop+White+OnBlack+RightTurned, qs#, qs#, 0);
221 "White bishop on black field turned to the right";
222 MakeBlackField;
223 currentpicture:= currentpicture - TurnRight(OuterShape);
224 cullit;
225 currentpicture:= currentpicture + TurnRight(WhiteMan);
226 endchar;
227
228 beginchar(Bishop+White+OnBlack+UpSideDown, qs#, qs#, 0);
229 "White bishop on black field upsidedown";
230 MakeBlackField;
231 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
232 cullit;
233 currentpicture:= currentpicture + TurnUpSideDown(WhiteMan);
234 endchar;
235
236 beginchar(Bishop+Neutral+OnBlack, qs#, qs#, 0);
237 "Neutral bishop on black field";
238 MakeBlackField;
239 currentpicture:= currentpicture - OuterShape;
240 cullit;
241 currentpicture:= currentpicture + NeutralMan;
242 endchar;
243
244 beginchar(Bishop+Neutral+OnBlack+LeftTurned, qs#, qs#, 0);
245 "Neutral bishop on black field turned to the left";
246 MakeBlackField;
247 currentpicture:= currentpicture - TurnLeft(OuterShape);
248 cullit;
249 currentpicture:= currentpicture + TurnLeft(NeutralMan);
250 endchar;
251
252 beginchar(Bishop+Neutral+OnBlack+RightTurned, qs#, qs#, 0);
253 "Neutral bishop on black field turned to the right";
254 MakeBlackField;
255 currentpicture:= currentpicture - TurnRight(OuterShape);
256 cullit;
257 currentpicture:= currentpicture + TurnRight(NeutralMan);
258 endchar;
259
260 beginchar(Bishop+Neutral+OnBlack+UpSideDown, qs#, qs#, 0);
261 "Neutral bishop on black field upsidedown";
262 MakeBlackField;
263 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
264 cullit;
265 currentpicture:= currentpicture + TurnUpSideDown(NeutralMan);
266 endchar;
267
268 beginchar(Bishop+Black+OnBlack, qs#, qs#, 0);
269 "Black bishop on black field";
270 MakeBlackField;
271 currentpicture:= currentpicture - OuterShape;
272 cullit;
273 currentpicture:= currentpicture + BlackMan;
274 endchar;
275
276 beginchar(Bishop+Black+OnBlack+LeftTurned, qs#, qs#, 0);
277 "Black bishop on black field turned to the left";
278 MakeBlackField;
279 currentpicture:= currentpicture - TurnLeft(OuterShape);
280 cullit;
281 currentpicture:= currentpicture + TurnLeft(BlackMan);
282 endchar;
283
284 beginchar(Bishop+Black+OnBlack+RightTurned, qs#, qs#, 0);
285 "Black bishop on black field turned to the right";
286 MakeBlackField;
287 currentpicture:= currentpicture - TurnRight(OuterShape);
288 cullit;
289 currentpicture:= currentpicture + TurnRight(BlackMan);
290 endchar;
291
292 beginchar(Bishop+Black+OnBlack+UpSideDown, qs#, qs#, 0);
293 "Black bishop on black field upsidedown";
294 MakeBlackField;
295 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
296 cullit;
297 currentpicture:= currentpicture + TurnUpSideDown(BlackMan);
298 endchar;