]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-accordion.mf
This patch addresses the following problems in the feta sources
[lilypond.git] / mf / feta-accordion.mf
1 % -*- Fundamental -*-
2
3 fet_begingroup ("accordion");
4
5
6 %
7 % These dimensions are the same for all register symbols.
8 % The different symbols should calculate their other dimensions from them.
9 %
10
11 accreg_dot_size# := .5 staff_space#;
12 accreg_linethickness# := 1.3 stafflinethickness#;
13 accreg_lh# := 1.0 staff_space#;
14
15 define_pixels (accreg_dot_size, accreg_linethickness, accreg_lh);
16
17
18 fet_beginchar ("accDiscant", "accDiscant")
19         save r, p, lh, lt;
20         path p;
21
22         r# = 3/2 accreg_lh#;
23         define_pixels (r);
24
25         set_char_box (r# + accreg_linethickness# / 2,
26                       r# + accreg_linethickness# / 2,
27                       0, 2 r# + 0.7 accreg_linethickness#);
28
29         lh = vround (2/3 r);
30         lt = vround (0.7 accreg_linethickness);
31
32         h := 3 lh + lt;
33         b := w := (3 lh + hround accreg_linethickness) / 2;
34
35         penpos1 (hround accreg_linethickness, 0);
36         penpos2 (lt, 90);
37         penpos3 (hround accreg_linethickness, 180);
38         penpos4 (lt, 270);
39
40         z1r = (w, h / 2);
41         z2r = (0, h);
42         z3r = (-b, h / 2);
43         z4r = (0, 0);
44
45         penlabels (1, 2, 3, 4);
46
47         % mf doesn't handle pixel dropouts in outline objects, so we use
48         % `draw' if not called by mpost
49         if known miterlimit:
50                 penstroke z1e
51                           .. z2e
52                           .. z3e
53                           .. z4e
54                           .. cycle;
55         else:
56                 pickup pencircle xscaled accreg_linethickness yscaled lt;
57                 draw z1
58                      .. z2
59                      .. z3
60                      .. z4
61                      .. cycle;
62         fi;
63
64         p := z4{right}
65              .. z1{up}
66              .. {left}z2;
67
68         pickup penrazor scaled lt rotated 90;
69
70         top z5 = p intersectionpoint ((0, lh + lt) -- (w, lh + lt));
71         z6 = z5 xscaled -1;
72         bot z7 = p intersectionpoint ((0, 2 lh) -- (w, 2 lh));
73         z8 = z7 xscaled -1;
74
75         labels (5, 6, 7, 8);
76
77         draw z5
78              -- z6;
79         draw z7
80              -- z8;
81 fet_endchar;
82
83
84 fet_beginchar ("accDot", "accDot")
85         set_char_box (accreg_dot_size# / 2, accreg_dot_size# / 2,
86                       accreg_dot_size# / 2, accreg_dot_size# / 2);
87
88         pickup pencircle scaled accreg_dot_size;
89
90         rt x0 = hround (accreg_dot_size / 2);
91         top y0 = vround (accreg_dot_size / 2);
92
93         drawdot z0;
94 fet_endchar;
95
96
97 fet_beginchar ("accFreebase", "accFreebase")
98         save r, p, lh, lt;
99         path p;
100
101         r# = accreg_lh#;
102         define_pixels (r);
103
104         set_char_box (r# + accreg_linethickness# / 2,
105                       r# + accreg_linethickness# / 2,
106                       0, 2 r# + 0.7 accreg_linethickness#);
107
108         lh = vround r;
109         lt = vround (0.7 accreg_linethickness);
110
111         h := 2 lh + lt;
112         b := w := (2 lh + hround accreg_linethickness) / 2;
113
114         penpos1 (hround accreg_linethickness, 0);
115         penpos2 (lt, 90);
116         penpos3 (accreg_linethickness, 180);
117         penpos4 (lt, 270);
118
119         z1r = (w, h / 2);
120         z2r = (0, h);
121         z3r = (-b, h / 2);
122         z4r = (0, 0);
123
124         penlabels (1, 2, 3, 4);
125
126         % mf doesn't handle pixel dropouts in outline objects, so we use
127         % `draw' if not called by mpost
128         if known miterlimit:
129                 penstroke z1e
130                           .. z2e
131                           .. z3e
132                           .. z4e
133                           .. cycle;
134         else:
135                 pickup pencircle xscaled accreg_linethickness yscaled lt;
136                 draw z1
137                      .. z2
138                      .. z3
139                      .. z4
140                      .. cycle;
141         fi;
142
143         pickup penrazor scaled lt rotated 90;
144
145         draw z1
146              -- z3;
147 fet_endchar;
148
149
150 fet_beginchar ("accStdbase", "accStdbase")
151         save r, p, lh, lt;
152         path p;
153
154         r# = 2 accreg_lh#;
155         define_pixels (r);
156
157         set_char_box (r# + accreg_linethickness# / 2,
158                       r# + accreg_linethickness# / 2,
159                       0, 2 r# + 0.7 accreg_linethickness#);
160
161         lh = vround (1/2 r);
162         lt = vround (0.7 accreg_linethickness);
163
164         h := 4 lh + lt;
165         b := w := (4 lh + hround accreg_linethickness) / 2;
166
167         penpos1 (hround accreg_linethickness, 0);
168         penpos2 (lt, 90);
169         penpos3 (hround accreg_linethickness, 180);
170         penpos4 (lt, 270);
171
172         z1r = (w, h / 2);
173         z2r = (0, h);
174         z3r = (-b, h / 2);
175         z4r = (0, 0);
176
177         penlabels (1, 2, 3, 4);
178
179         % mf doesn't handle pixel dropouts in outline objects, so we use
180         % `draw' if not called by mpost
181         if known miterlimit:
182                 penstroke z1e
183                           .. z2e
184                           .. z3e
185                           .. z4e
186                           .. cycle;
187         else:
188                 pickup pencircle xscaled accreg_linethickness yscaled lt;
189                 draw z1
190                      .. z2
191                      .. z3
192                      .. z4
193                      .. cycle;
194         fi;
195
196         p := z4{right}
197              .. z1{up}
198              .. {left}z2;
199
200         pickup penrazor scaled lt rotated 90;
201
202         top z5 = p intersectionpoint ((0, lh + lt) -- (w, lh + lt));
203         z6 = z5 xscaled -1;
204         bot z7 = p intersectionpoint ((0, 3 lh) -- (w, 3 lh));
205         z8 = z7 xscaled -1;
206
207         labels (5, 6, 7, 8);
208
209         draw z1
210              -- z3;
211         draw z5
212              -- z6;
213         draw z7
214              -- z8;
215 fet_endchar;
216
217
218 fet_beginchar ("accBayanbase", "accBayanbase")
219         save lh, lt;
220
221         lh = vround accreg_lh;
222         lt = vround accreg_linethickness;
223
224         set_char_box (accreg_lh# + accreg_linethickness# / 2,
225                       accreg_lh# + accreg_linethickness# / 2,
226                       0, 3 accreg_lh# + accreg_linethickness#);
227
228         h := 3 lh + lt;
229
230         draw_rounded_block ((-w, 0), (-w + lt, h), lt);
231         draw_rounded_block ((w - lt, 0), (w, h), lt);
232
233         pickup penrazor scaled lt rotated 90;
234
235         bot z1 = (-w + lt / 2, 0);
236         bot z2 = (-w + lt / 2, lh);
237         bot z3 = (-w + lt / 2, 2 lh);
238         bot z4 = (-w + lt / 2, 3 lh);
239
240         bot z5 = (w - lt / 2, 0);
241         bot z6 = (w - lt / 2, lh);
242         bot z7 = (w - lt / 2, 2 lh);
243         bot z8 = (w - lt / 2, 3 lh);
244
245         draw z1
246              -- z5;
247         draw z2
248              -- z6;
249         draw z3
250              -- z7;
251         draw z4
252              -- z8;
253 fet_endchar;
254
255
256 def def_B (expr w, h) =
257         pickup pencircle scaled 0.15 linethickness;
258
259         penpos10 (thin, -90);
260         penpos11 (thin, -90);
261         penpos12 (thick, 0);
262         penpos13 (thin, 90);
263         penpos14 (thin, 90);
264
265         penpos15 (thick, 180);
266         penpos16 (thin, -90);
267         penpos17 (thin, -90);
268         penpos18 (thick, 0);
269         penpos19 (thick, 0);
270
271         z10 = (0, 0);
272         z11 = (cOne * w, 0);
273         z12 = (w, .5 mb * h);
274         z13 = (cTwo * w, mb * h);
275         z14 = (2 thick, mb * h);
276         z15 = (.94 w, h - .5 mt * h);
277         z16 = z13 + (0, mt * h);
278         z17 = (0, h);
279         z18 = (1.5 thick, 0);
280         z19 = (1.5 thick, h);
281 enddef;
282
283
284 def def_S (expr w, h) =
285         pickup pencircle scaled 0.03 linethickness;
286
287         penpos1 (thin, 180);
288         penpos2 (thin, -90);
289         penpos3 (thick, 0);
290         penpos4 (.5 thick, 90);
291         penpos5 (thick, 0);
292         penpos6 (thin, -90);
293         penpos7 (thin, 180);
294         penpos8 (thin, 180);
295         penpos9 (thin, 0);
296
297         z1 = (0, hs);
298         z2 = (w / 2, 0);
299         z3 = (w - .5 thick, .5 mb * h);
300         z4 = (w / 2, mb * h);
301         z5 = (.5 thick, h - .5 mt * h);
302         z6 = (w / 2, h);
303         z7 = (w, h - hs);
304         z8 = (0, y2r);
305         z9 = (w, y6l);
306
307         path bue, bueoverst;
308
309         bue := z2{left}
310                .. z1{up};
311
312         t := xpart (bue intersectiontimes (z8l -- z7l));
313
314         bueoverst := z6{right}
315                      .. z7{down};
316 enddef;
317
318
319 def def_some_vars =
320         save hs, mb, mt, thin, thick, height, width, cOne, cTwo;
321         save bx, hx;
322
323         width = .8 (4 staff_space);
324         height = 2.4 staff_space;
325         % URG.  smaller sizes should be wider and fatter
326         % thin = 0.05 staff_space;
327         % thick = 0.2 staff_space;
328
329         4 hx + bx = 1.15;
330         10 hx + bx = 1;
331         fatten := designsize * hx + bx * 1.2;
332         thick := 0.2 staff_space * fatten;
333
334         % urg: mustn't ever go thinner than blot!
335         thin# := blot_diameter#;
336         define_pixels (thin);
337
338         hs = 0.4 staff_space;
339         mb = .53;
340         mt = .47;
341         cOne = 0.65;
342         cTwo = 0.60;
343 enddef;
344
345
346 fet_beginchar ("accOldEE", "accOldEE")
347         save r, pp, ir, lh, lt, stroke_width;
348
349         r# = staff_space#;
350         define_pixels (r);
351
352         lr = .4 staff_space - linethickness;
353         ir = .6 staff_space;
354         stroke_width = .05 staff_space + .5 linethickness;
355
356         set_char_box (r# + accreg_linethickness# / 2,
357                       r# + accreg_linethickness# / 2,
358                       0, 2 r# + 0.7 accreg_linethickness#);
359
360         z1 = (0, 0);
361         z2 = (0, ir);
362
363         penpos1 (blot_diameter, 0);
364         penpos2 (stroke_width + blot_diameter, 0);
365
366         pickup pencircle scaled (lr + blot_diameter);
367
368         for pp := 0 step 45 until 360:
369                 drawdot (0, 0) shifted (ir * (dir pp));
370
371                 penstroke (z1e
372                            -- z2e) rotated pp;
373         endfor;
374
375         pickup pencircle scaled lr;
376
377         drawdot (0, 0);
378
379         currentpicture := currentpicture shifted (0, h / 2);
380
381         lh = vround (2 r);
382         lt = vround (0.7 accreg_linethickness);
383
384         h := lh + lt;
385         b := w := (lh + hround accreg_linethickness) / 2;
386
387         penpos3 (hround accreg_linethickness, 0);
388         penpos4 (lt, 90);
389         penpos5 (hround accreg_linethickness, 180);
390         penpos6 (lt, 270);
391
392         z3r = (w, h / 2);
393         z4r = (0, h);
394         z5r = (-b, h / 2);
395         z6r = (0, 0);
396
397         % penlabels (1, 2, 3, 4, 5, 6);
398
399         % mf doesn't handle pixel dropouts in outline objects, so we use
400         % `draw' if not called by mpost
401         if known miterlimit:
402                 penstroke z3e
403                           .. z4e
404                           .. z5e
405                           .. z6e
406                           .. cycle;
407         else:
408                 pickup pencircle xscaled accreg_linethickness yscaled lt;
409                 draw z3
410                      .. z4
411                      .. z5
412                      .. z6
413                      .. cycle;
414         fi;
415
416 fet_endchar;
417
418
419 fet_endgroup ("accordion");