Debian Codegraph @

texmf-dist/fonts/source/public/bartel-chess-fonts/elch-bishop.mf

raw
1 %======================================================================
2 % This is
3 % bishop.mf
4 %
5 % Copyright (C) 1989-93 by Elmar Bartel.
6 %
7 % This program is free software; you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation; either version 1, or (at your option)
10 % any later version.
11 %
12 % This program is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
16 %
17 % You should have received a copy of the GNU General Public License
18 % along with this program; if not, write to the Free Software
19 % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 %======================================================================
21 %
22 def slope(expr orig,middle,far,wd,angle) =
23 begingroup
24 save x, y, p;
25 path p.l,p.r;
26 pair inter;
27
28 z0r= orig;
29 z1r= middle;
30 z2= far;
31 penpos0(wd,90+angle);
32 penpos1(wd,90);
33 penpos2(wd,90+angle);
34 forsuffixes e=l,r:
35 p.e:= z2e{dir angle}.. z1e{right} .. {dir angle}z0e;
36 endfor;
37 inter = p.l intersectiontimes p.l reflectedabout (orig,orig+up);
38 reverse p.r --
39 subpath (0,xpart inter) of p.l ..
40 reverse subpath (0,xpart inter) of p.l
41 reflectedabout (orig,orig+up) --
42 p.r reflectedabout (orig,orig+up)
43 endgroup
44 enddef;
45
46 def MakeBishopPath =
47
48 numeric TopDiameter;
49 TopDiameter = .08qs;
50 DefineFootBows( .13qs, % Distance to BottomSpace
51 .39qs, % BowOneWidth
52 .17qs, % FootHeight
53 .31, % BowTwoLoc
54 .12, % WidthToHeight
55 .87, % BowTwoLen
56 .65); % BowThreeLen
57 x4l + x4r = qs;
58 x4r - x4l = .45qs;
59 x4 = x3;
60 y4l = y4r = y4 = y3 + .16qs; % Sides of the shape with
61 % vertical tangents
62
63 x5 = x4;
64 top (y5 + TopDiameter) = qs - TopSpace + .04qs;
65
66 pair TopDir.l, TopDir.r;
67 TopDir.l = dir 35;
68 TopDir.r = (xpart TopDir.l, -ypart TopDir.l);
69
70 numeric TopDiameter;
71 TopDiameter = .10qs;
72
73 path LeftShape,RightShape,BishopPath;
74 LeftShape = z1l .. z2l .. z3l & z3l .. {up}z4l .. {TopDir.l}z5;
75 RightShape= z5{TopDir.r} .. {down}z4r .. z3r & z3r .. z2r .. z1r;
76 BishopPath = LeftShape & RightShape & Bow0 & cycle;
77
78 path Peak;
79 Peak:= fullcircle scaled TopDiameter
80 shifted (z5+.5TopDiameter*up);
81
82 path CrossV,CrossH;
83
84 z7= .25[z3,z5];
85 z8= .62[z3,z5];
86 CrossV:= z7 .. z8;
87 CrossH= CrossV rotatedaround (.5[z7,z8],90);
88
89 path Slope;
90 path s;
91 numeric angle;
92
93 angle= 60;
94 x12 = SideSpace;
95 y12 = BottomSpace;
96 y11 = .5[y12,y10];
97 x11 = .65[x12,x10];
98 z10 = z0;
99 s= slope(z10,z11,z12,2.7thin,35);
100 Slope:= s .. point 0 of s & cycle;
101
102 enddef;
103
104 def MakeWhiteBishop =
105 pickup chess_pen;
106 clearit;
107 draw BishopPath;
108 forsuffixes $=2,3: draw Bow$; endfor
109 draw Peak;
110 draw CrossV;
111 draw CrossH;
112 %pickup inner_pen;
113 draw Slope;
114 WhiteMan:= currentpicture;
115 enddef;
116
117 def MakeBlackBishop =
118 pickup chess_pen scaled 1.1;
119 clearit;
120 filldraw BishopPath;
121 forsuffixes $=2,3: undraw ShortenPath(Bow$,1.2thin); endfor
122 %undraw ShortenPath(ParallelPath(LeftShape,-thin),thin);
123 %undraw ShortenPath(ParallelPath(RightShape,-thin),thin);
124 filldraw Peak;
125 undraw CrossV;
126 undraw CrossH;
127 pickup inner_pen;
128 filldraw Slope;
129 BlackMan:= currentpicture;
130 enddef;
131
132 def MakeOuterShape =
133 clearit;
134 pickup frame_pen;
135 filldraw BishopPath;
136 filldraw Peak;
137 filldraw Slope;
138 cullit;
139 OuterShape:= currentpicture;
140 enddef;
141
142 MakeBishopPath;
143 MakeWhiteBishop;
144 MakeBlackBishop;
145 MakeNeutral(WhiteMan,BlackMan);
146 MakeOuterShape;
147
148 %===========================================================
149 %% this one for testing
150 %beginchar(Bishop+White+OnBlack, qs#, qs#, 0);
151 % "White bishop on black field";
152 % MakeBlackField;
153 % currentpicture:= currentpicture - OuterShape;
154 % cullit;
155 % currentpicture:= currentpicture + WhiteMan;
156 % %currentpicture:= currentpicture + BlackMan;
157 %endchar;
158 %endinput
159 %===========================================================
160
161 beginchar(Bishop+White+OnWhite, qs#, qs#, 0);
162 "White bishop on white field";
163 currentpicture:= WhiteMan;
164 endchar;
165
166 beginchar(Bishop+White+OnWhite+LeftTurned, qs#, qs#, 0);
167 "White bishop on white field rotated to the left";
168 currentpicture:= TurnLeft(WhiteMan);
169 endchar;
170
171 beginchar(Bishop+White+OnWhite+RightTurned, qs#, qs#, 0);
172 "White bishop on white field rotated to the right";
173 currentpicture:= TurnRight(WhiteMan);
174 endchar;
175
176 beginchar(Bishop+White+OnWhite+UpSideDown, qs#, qs#, 0);
177 "White bishop on white field upside down";
178 currentpicture:= TurnUpSideDown(WhiteMan);
179 endchar;
180
181 beginchar(Bishop+Black+OnWhite, qs#, qs#, 0);
182 "Black bishop on white field";
183 currentpicture:= BlackMan;
184 endchar;
185
186 beginchar(Bishop+Black+OnWhite+LeftTurned, qs#, qs#, 0);
187 "Black bishop on white field rotated to the left";
188 currentpicture:= TurnLeft(BlackMan);
189 endchar;
190
191 beginchar(Bishop+Black+OnWhite+RightTurned, qs#, qs#, 0);
192 "Black bishop on white field rotated to the right";
193 currentpicture:= TurnRight(BlackMan);
194 endchar;
195
196 beginchar(Bishop+Black+OnWhite+UpSideDown, qs#, qs#, 0);
197 "Black bishop on white field upside down";
198 currentpicture:= TurnUpSideDown(BlackMan);
199 endchar;
200
201 beginchar(Bishop+Neutral+OnWhite, qs#, qs#, 0);
202 "Neutral bishop on white field";
203 currentpicture:= NeutralMan;
204 endchar;
205
206 beginchar(Bishop+Neutral+OnWhite+LeftTurned, qs#, qs#, 0);
207 "Neutral bishop on white field rotated to the left";
208 currentpicture:= TurnLeft(NeutralMan);
209 endchar;
210
211 beginchar(Bishop+Neutral+OnWhite+RightTurned, qs#, qs#, 0);
212 "Neutral bishop on white field rotated to the right";
213 currentpicture:= TurnRight(NeutralMan);
214 endchar;
215
216 beginchar(Bishop+Neutral+OnWhite+UpSideDown, qs#, qs#, 0);
217 "Neutral bishop on white field upside down";
218 currentpicture:= TurnUpSideDown(NeutralMan);
219 endchar;
220
221 beginchar(Bishop+White+OnBlack, qs#, qs#, 0);
222 "White bishop on black field";
223 MakeBlackField;
224 currentpicture:= currentpicture - OuterShape;
225 cullit;
226 currentpicture:= currentpicture + WhiteMan;
227 endchar;
228
229 beginchar(Bishop+White+OnBlack+LeftTurned, qs#, qs#, 0);
230 "White bishop on black field turned to the left";
231 MakeBlackField;
232 currentpicture:= currentpicture - TurnLeft(OuterShape);
233 cullit;
234 currentpicture:= currentpicture + TurnLeft(WhiteMan);
235 endchar;
236
237 beginchar(Bishop+White+OnBlack+RightTurned, qs#, qs#, 0);
238 "White bishop on black field turned to the right";
239 MakeBlackField;
240 currentpicture:= currentpicture - TurnRight(OuterShape);
241 cullit;
242 currentpicture:= currentpicture + TurnRight(WhiteMan);
243 endchar;
244
245 beginchar(Bishop+White+OnBlack+UpSideDown, qs#, qs#, 0);
246 "White bishop on black field upsidedown";
247 MakeBlackField;
248 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
249 cullit;
250 currentpicture:= currentpicture + TurnUpSideDown(WhiteMan);
251 endchar;
252
253 beginchar(Bishop+Neutral+OnBlack, qs#, qs#, 0);
254 "Neutral bishop on black field";
255 MakeBlackField;
256 currentpicture:= currentpicture - OuterShape;
257 cullit;
258 currentpicture:= currentpicture + NeutralMan;
259 endchar;
260
261 beginchar(Bishop+Neutral+OnBlack+LeftTurned, qs#, qs#, 0);
262 "Neutral bishop on black field turned to the left";
263 MakeBlackField;
264 currentpicture:= currentpicture - TurnLeft(OuterShape);
265 cullit;
266 currentpicture:= currentpicture + TurnLeft(NeutralMan);
267 endchar;
268
269 beginchar(Bishop+Neutral+OnBlack+RightTurned, qs#, qs#, 0);
270 "Neutral bishop on black field turned to the right";
271 MakeBlackField;
272 currentpicture:= currentpicture - TurnRight(OuterShape);
273 cullit;
274 currentpicture:= currentpicture + TurnRight(NeutralMan);
275 endchar;
276
277 beginchar(Bishop+Neutral+OnBlack+UpSideDown, qs#, qs#, 0);
278 "Neutral bishop on black field upsidedown";
279 MakeBlackField;
280 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
281 cullit;
282 currentpicture:= currentpicture + TurnUpSideDown(NeutralMan);
283 endchar;
284
285 beginchar(Bishop+Black+OnBlack, qs#, qs#, 0);
286 "Black bishop on black field";
287 MakeBlackField;
288 currentpicture:= currentpicture - OuterShape;
289 cullit;
290 currentpicture:= currentpicture + BlackMan;
291 endchar;
292
293 beginchar(Bishop+Black+OnBlack+LeftTurned, qs#, qs#, 0);
294 "Black bishop on black field turned to the left";
295 MakeBlackField;
296 currentpicture:= currentpicture - TurnLeft(OuterShape);
297 cullit;
298 currentpicture:= currentpicture + TurnLeft(BlackMan);
299 endchar;
300
301 beginchar(Bishop+Black+OnBlack+RightTurned, qs#, qs#, 0);
302 "Black bishop on black field turned to the right";
303 MakeBlackField;
304 currentpicture:= currentpicture - TurnRight(OuterShape);
305 cullit;
306 currentpicture:= currentpicture + TurnRight(BlackMan);
307 endchar;
308
309 beginchar(Bishop+Black+OnBlack+UpSideDown, qs#, qs#, 0);
310 "Black bishop on black field upsidedown";
311 MakeBlackField;
312 currentpicture:= currentpicture - TurnUpSideDown(OuterShape);
313 cullit;
314 currentpicture:= currentpicture + TurnUpSideDown(BlackMan);
315 endchar;
316
317 endinput
318