1 % Feta (not the Font-En-Tja) music font -- draw accordion symbols
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 1998--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 % LilyPond 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 3 of the License, or
9 % (at your option) any later version.
11 % LilyPond 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.
16 % You should have received a copy of the GNU General Public License
17 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 fet_begingroup ("accordion");
22 % These dimensions are the same for all register symbols.
23 % The different symbols should calculate their other dimensions from them.
26 accreg_dot_size# := .5 staff_space#;
27 accreg_linethickness# := 1.3 stafflinethickness#;
28 accreg_lh# := 1.0 staff_space#;
30 define_pixels (accreg_dot_size, accreg_linethickness, accreg_lh);
33 fet_beginchar ("accDiscant", "accDiscant")
40 set_char_box (r# + accreg_linethickness# / 2,
41 r# + accreg_linethickness# / 2,
42 0, 2 r# + 0.7 accreg_linethickness#);
45 lt = vround (0.7 accreg_linethickness);
48 b := w := (3 lh + hround accreg_linethickness) / 2;
50 penpos1 (hround accreg_linethickness, 0);
52 penpos3 (hround accreg_linethickness, 180);
60 penlabels (1, 2, 3, 4);
62 % mf doesn't handle pixel dropouts in outline objects, so we use
63 % `draw' if not called by mpost
76 pickup pencircle xscaled accreg_linethickness yscaled lt;
88 pickup penrazor scaled lt rotated 90;
90 top z5 = pat intersectionpoint ((0, lh + lt) -- (w, lh + lt));
92 bot z7 = pat intersectionpoint ((0, 2 lh) -- (w, 2 lh));
104 fet_beginchar ("accDot", "accDot")
105 set_char_box (accreg_dot_size# / 2, accreg_dot_size# / 2,
106 accreg_dot_size# / 2, accreg_dot_size# / 2);
108 pickup pencircle scaled accreg_dot_size;
110 rt x0 = hround (accreg_dot_size / 2);
111 top y0 = vround (accreg_dot_size / 2);
117 fet_beginchar ("accFreebase", "accFreebase")
123 set_char_box (r# + accreg_linethickness# / 2,
124 r# + accreg_linethickness# / 2,
125 0, 2 r# + 0.7 accreg_linethickness#);
128 lt = vround (0.7 accreg_linethickness);
131 b := w := (2 lh + hround accreg_linethickness) / 2;
133 penpos1 (hround accreg_linethickness, 0);
135 penpos3 (accreg_linethickness, 180);
143 penlabels (1, 2, 3, 4);
145 % mf doesn't handle pixel dropouts in outline objects, so we use
146 % `draw' if not called by mpost
159 pickup pencircle xscaled accreg_linethickness yscaled lt;
167 pickup penrazor scaled lt rotated 90;
174 fet_beginchar ("accStdbase", "accStdbase")
181 set_char_box (r# + accreg_linethickness# / 2,
182 r# + accreg_linethickness# / 2,
183 0, 2 r# + 0.7 accreg_linethickness#);
186 lt = vround (0.7 accreg_linethickness);
189 b := w := (4 lh + hround accreg_linethickness) / 2;
191 penpos1 (hround accreg_linethickness, 0);
193 penpos3 (hround accreg_linethickness, 180);
201 penlabels (1, 2, 3, 4);
203 % mf doesn't handle pixel dropouts in outline objects, so we use
204 % `draw' if not called by mpost
217 pickup pencircle xscaled accreg_linethickness yscaled lt;
229 pickup penrazor scaled lt rotated 90;
231 top z5 = pat intersectionpoint ((0, lh + lt) -- (w, lh + lt));
233 bot z7 = pat intersectionpoint ((0, 3 lh) -- (w, 3 lh));
247 fet_beginchar ("accBayanbase", "accBayanbase")
250 lh = vround accreg_lh;
251 lt = vround accreg_linethickness;
253 set_char_box (accreg_lh# + accreg_linethickness# / 2,
254 accreg_lh# + accreg_linethickness# / 2,
255 0, 3 accreg_lh# + accreg_linethickness#);
259 draw_rounded_block ((-w, 0), (-w + lt, h), lt);
260 draw_rounded_block ((w - lt, 0), (w, h), lt);
262 pickup penrazor scaled lt rotated 90;
264 bot z1 = (-w + lt / 2, 0);
265 bot z2 = (-w + lt / 2, lh);
266 bot z3 = (-w + lt / 2, 2 lh);
267 bot z4 = (-w + lt / 2, 3 lh);
269 bot z5 = (w - lt / 2, 0);
270 bot z6 = (w - lt / 2, lh);
271 bot z7 = (w - lt / 2, 2 lh);
272 bot z8 = (w - lt / 2, 3 lh);
285 def def_B (expr w, h) =
286 pickup pencircle scaled 0.15 linethickness;
288 penpos10 (thin, -90);
289 penpos11 (thin, -90);
294 penpos15 (thick, 180);
295 penpos16 (thin, -90);
296 penpos17 (thin, -90);
302 z12 = (w, .5 mb * h);
303 z13 = (cTwo * w, mb * h);
304 z14 = (2 thick, mb * h);
305 z15 = (.94 w, h - .5 mt * h);
306 z16 = z13 + (0, mt * h);
308 z18 = (1.5 thick, 0);
309 z19 = (1.5 thick, h);
313 def def_S (expr w, h) =
314 pickup pencircle scaled 0.03 linethickness;
319 penpos4 (.5 thick, 90);
328 z3 = (w - .5 thick, .5 mb * h);
329 z4 = (w / 2, mb * h);
330 z5 = (.5 thick, h - .5 mt * h);
341 t := xpart (bue intersectiontimes (z8l -- z7l));
343 bueoverst := z6{right}
349 save hs, mb, mt, thin, thick, height, width, cOne, cTwo;
352 width = .8 (4 staff_space);
353 height = 2.4 staff_space;
354 % URG. smaller sizes should be wider and fatter
355 % thin = 0.05 staff_space;
356 % thick = 0.2 staff_space;
360 fatten := designsize * hx + bx * 1.2;
361 thick := 0.2 staff_space * fatten;
363 % urg: mustn't ever go thinner than blot!
364 thin# := blot_diameter#;
365 define_pixels (thin);
367 hs = 0.4 staff_space;
375 fet_beginchar ("accOldEE", "accOldEE")
376 save r, pp, ir, lh, lt, stroke_width;
381 lr = .4 staff_space - linethickness;
383 stroke_width = .05 staff_space + .5 linethickness;
385 set_char_box (r# + accreg_linethickness# / 2,
386 r# + accreg_linethickness# / 2,
387 0, 2 r# + 0.7 accreg_linethickness#);
393 penpos1 (blot_diameter, 0);
394 penpos2 (stroke_width + blot_diameter, 0);
395 penpos3 (stroke_width + blot_diameter, 0);
397 pickup pencircle scaled (lr + blot_diameter);
399 for pp := 0 step 45 until 135:
400 drawdot z2 rotated pp;
401 drawdot z3 rotated pp;
408 pickup pencircle scaled lr;
412 currentpicture := currentpicture shifted (0, h / 2);
415 lt = vround (0.7 accreg_linethickness);
418 b := w := (lh + hround accreg_linethickness) / 2;
420 penpos10 (hround accreg_linethickness, 0);
422 penpos12 (hround accreg_linethickness, 180);
430 % penlabels (1, 2, 10, 11, 12, 13);
432 % mf doesn't handle pixel dropouts in outline objects, so we use
433 % `draw' if not called by mpost
446 pickup pencircle xscaled accreg_linethickness yscaled lt;
456 fet_endgroup ("accordion");