2 % feta-accordion.mf -- draw accordion symbols
4 % source file of the GNU LilyPond music typesetter
6 % (c) 1998--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 fet_begingroup ("accordion");
11 % These dimensions are the same for all register symbols.
12 % The different symbols should calculate their other dimensions from them.
15 accreg_dot_size# := .5 staff_space#;
16 accreg_linethickness# := 1.3 stafflinethickness#;
17 accreg_lh# := 1.0 staff_space#;
19 define_pixels (accreg_dot_size, accreg_linethickness, accreg_lh);
22 fet_beginchar ("accDiscant", "accDiscant")
29 set_char_box (r# + accreg_linethickness# / 2,
30 r# + accreg_linethickness# / 2,
31 0, 2 r# + 0.7 accreg_linethickness#);
34 lt = vround (0.7 accreg_linethickness);
37 b := w := (3 lh + hround accreg_linethickness) / 2;
39 penpos1 (hround accreg_linethickness, 0);
41 penpos3 (hround accreg_linethickness, 180);
49 penlabels (1, 2, 3, 4);
51 % mf doesn't handle pixel dropouts in outline objects, so we use
52 % `draw' if not called by mpost
65 pickup pencircle xscaled accreg_linethickness yscaled lt;
77 pickup penrazor scaled lt rotated 90;
79 top z5 = pat intersectionpoint ((0, lh + lt) -- (w, lh + lt));
81 bot z7 = pat intersectionpoint ((0, 2 lh) -- (w, 2 lh));
93 fet_beginchar ("accDot", "accDot")
94 set_char_box (accreg_dot_size# / 2, accreg_dot_size# / 2,
95 accreg_dot_size# / 2, accreg_dot_size# / 2);
97 pickup pencircle scaled accreg_dot_size;
99 rt x0 = hround (accreg_dot_size / 2);
100 top y0 = vround (accreg_dot_size / 2);
106 fet_beginchar ("accFreebase", "accFreebase")
112 set_char_box (r# + accreg_linethickness# / 2,
113 r# + accreg_linethickness# / 2,
114 0, 2 r# + 0.7 accreg_linethickness#);
117 lt = vround (0.7 accreg_linethickness);
120 b := w := (2 lh + hround accreg_linethickness) / 2;
122 penpos1 (hround accreg_linethickness, 0);
124 penpos3 (accreg_linethickness, 180);
132 penlabels (1, 2, 3, 4);
134 % mf doesn't handle pixel dropouts in outline objects, so we use
135 % `draw' if not called by mpost
148 pickup pencircle xscaled accreg_linethickness yscaled lt;
156 pickup penrazor scaled lt rotated 90;
163 fet_beginchar ("accStdbase", "accStdbase")
170 set_char_box (r# + accreg_linethickness# / 2,
171 r# + accreg_linethickness# / 2,
172 0, 2 r# + 0.7 accreg_linethickness#);
175 lt = vround (0.7 accreg_linethickness);
178 b := w := (4 lh + hround accreg_linethickness) / 2;
180 penpos1 (hround accreg_linethickness, 0);
182 penpos3 (hround accreg_linethickness, 180);
190 penlabels (1, 2, 3, 4);
192 % mf doesn't handle pixel dropouts in outline objects, so we use
193 % `draw' if not called by mpost
206 pickup pencircle xscaled accreg_linethickness yscaled lt;
218 pickup penrazor scaled lt rotated 90;
220 top z5 = pat intersectionpoint ((0, lh + lt) -- (w, lh + lt));
222 bot z7 = pat intersectionpoint ((0, 3 lh) -- (w, 3 lh));
236 fet_beginchar ("accBayanbase", "accBayanbase")
239 lh = vround accreg_lh;
240 lt = vround accreg_linethickness;
242 set_char_box (accreg_lh# + accreg_linethickness# / 2,
243 accreg_lh# + accreg_linethickness# / 2,
244 0, 3 accreg_lh# + accreg_linethickness#);
248 draw_rounded_block ((-w, 0), (-w + lt, h), lt);
249 draw_rounded_block ((w - lt, 0), (w, h), lt);
251 pickup penrazor scaled lt rotated 90;
253 bot z1 = (-w + lt / 2, 0);
254 bot z2 = (-w + lt / 2, lh);
255 bot z3 = (-w + lt / 2, 2 lh);
256 bot z4 = (-w + lt / 2, 3 lh);
258 bot z5 = (w - lt / 2, 0);
259 bot z6 = (w - lt / 2, lh);
260 bot z7 = (w - lt / 2, 2 lh);
261 bot z8 = (w - lt / 2, 3 lh);
274 def def_B (expr w, h) =
275 pickup pencircle scaled 0.15 linethickness;
277 penpos10 (thin, -90);
278 penpos11 (thin, -90);
283 penpos15 (thick, 180);
284 penpos16 (thin, -90);
285 penpos17 (thin, -90);
291 z12 = (w, .5 mb * h);
292 z13 = (cTwo * w, mb * h);
293 z14 = (2 thick, mb * h);
294 z15 = (.94 w, h - .5 mt * h);
295 z16 = z13 + (0, mt * h);
297 z18 = (1.5 thick, 0);
298 z19 = (1.5 thick, h);
302 def def_S (expr w, h) =
303 pickup pencircle scaled 0.03 linethickness;
308 penpos4 (.5 thick, 90);
317 z3 = (w - .5 thick, .5 mb * h);
318 z4 = (w / 2, mb * h);
319 z5 = (.5 thick, h - .5 mt * h);
330 t := xpart (bue intersectiontimes (z8l -- z7l));
332 bueoverst := z6{right}
338 save hs, mb, mt, thin, thick, height, width, cOne, cTwo;
341 width = .8 (4 staff_space);
342 height = 2.4 staff_space;
343 % URG. smaller sizes should be wider and fatter
344 % thin = 0.05 staff_space;
345 % thick = 0.2 staff_space;
349 fatten := designsize * hx + bx * 1.2;
350 thick := 0.2 staff_space * fatten;
352 % urg: mustn't ever go thinner than blot!
353 thin# := blot_diameter#;
354 define_pixels (thin);
356 hs = 0.4 staff_space;
364 fet_beginchar ("accOldEE", "accOldEE")
365 save r, pp, ir, lh, lt, stroke_width;
370 lr = .4 staff_space - linethickness;
372 stroke_width = .05 staff_space + .5 linethickness;
374 set_char_box (r# + accreg_linethickness# / 2,
375 r# + accreg_linethickness# / 2,
376 0, 2 r# + 0.7 accreg_linethickness#);
382 penpos1 (blot_diameter, 0);
383 penpos2 (stroke_width + blot_diameter, 0);
384 penpos3 (stroke_width + blot_diameter, 0);
386 pickup pencircle scaled (lr + blot_diameter);
388 for pp := 0 step 45 until 135:
389 drawdot z2 rotated pp;
390 drawdot z3 rotated pp;
397 pickup pencircle scaled lr;
401 currentpicture := currentpicture shifted (0, h / 2);
404 lt = vround (0.7 accreg_linethickness);
407 b := w := (lh + hround accreg_linethickness) / 2;
409 penpos10 (hround accreg_linethickness, 0);
411 penpos12 (hround accreg_linethickness, 180);
419 % penlabels (1, 2, 10, 11, 12, 13);
421 % mf doesn't handle pixel dropouts in outline objects, so we use
422 % `draw' if not called by mpost
435 pickup pencircle xscaled accreg_linethickness yscaled lt;
445 fet_endgroup ("accordion");