1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-custodes.mf -- implement ancient custodes
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 2000--2009 Juergen Reuter <reuter@ipd.uka.de>
9 save black_notehead_width;
10 numeric black_notehead_width;
12 fet_begingroup ("custodes");
17 % The custos is assumed to be vertically centered around (0, 0).
18 % The left-most edge of the custos should touch the vertical line
19 % that goes though the point (0, 0).
21 % set_char_box() conventions:
23 % * breapth: Ignored (as far as I know). Should be set to 0.
25 % * width: Should cover the horizontal range of the custos that is to
26 % be printed in the staff. If the custos has an appendage that is
27 % supposed to reach beyond the right end of the staff, the width
28 % should be set such that the appendage is outside of the char box.
30 % * depth: Should match the bottom edge of the custos. Affects
31 % vertical collision handling.
33 % * height: Should match the top edge of the custos. Affects vertical
37 save between_staff_lines, on_staff_line, anywhere;
39 between_staff_lines := 0;
43 save dir_up, dir_down;
56 % parameterized hufnagel custos
57 def custos_hufnagel (expr verbose_name, internal_name,
58 direction, staffline_adjustment) =
60 fet_beginchar (verbose_name, internal_name);
61 save alpha, dalpha, ht, wd, stem_ht, pen_size;
66 dalpha = direction * alpha;
68 if staffline_adjustment = between_staff_lines:
69 stem_ht# = 1.00 staff_space#;
70 elseif staffline_adjustment = on_staff_line:
71 stem_ht# = 1.50 staff_space#;
72 else: % staffline_adjustment = anywhere
73 stem_ht# = 1.25 staff_space#;
76 pen_size# = 0.5 (wd# ++ ht#);
78 define_pixels (ht, wd, pen_size, stem_ht);
84 T := identity xscaled linethickness
87 pickup pencircle transformed T;
88 ellipse := fullcircle transformed T;
90 if direction = dir_up:
100 y3 - y2 = direction * stem_ht;
101 (y3 - y2) = (x3 - x2) * tand (90 - dalpha);
103 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
105 -- get_subpath (ellipse, z2 - z1, z3 - z2, z2)
107 -- get_subpoint (ellipse, z2 - z1, z2)
108 -- get_subpoint (ellipse, z3 - z2, z2)
110 -- get_subpath (ellipse, z3 - z2, z2 - z3, z3)
112 -- get_subpoint (ellipse, z2 - z3, z2)
113 -- get_subpoint (ellipse, z1 - z2, z2)
115 -- get_subpath (ellipse, z2 - z3, z1 - z2, z2)
119 % The stem is intentionally outside of the char box.
121 set_char_box (0, wd#, ht# / 2, stem_ht#);
123 set_char_box (0, wd#, stem_ht#, ht# / 2);
131 % custos hufnagel, stem up, between staff lines
132 custos_hufnagel ("Custos Hufnagel", "hufnagel.u0",
133 dir_up, between_staff_lines);
136 % custos hufnagel, stem up, on staff line
137 custos_hufnagel ("Custos Hufnagel", "hufnagel.u1",
138 dir_up, on_staff_line);
141 % custos hufnagel, stem up, anywhere
142 custos_hufnagel ("Custos Hufnagel", "hufnagel.u2",
146 % custos hufnagel, stem down, between staff lines
147 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d0",
148 dir_down, between_staff_lines);
151 % custos hufnagel, stem down, on staff line
152 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d1",
153 dir_down, on_staff_line);
156 % custos hufnagel, stem down, anywhere
157 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d2",
168 def custos_medicaea (expr verbose_name, internal_name,
169 direction, staffline_adjustment) =
170 fet_beginchar (verbose_name, internal_name);
171 save ht, wd, stem_ht;
176 if staffline_adjustment = between_staff_lines:
177 stem_ht# = 1.00 staff_space#;
178 elseif staffline_adjustment = on_staff_line:
179 stem_ht# = 1.50 staff_space#;
180 else: % staffline_adjustment = anywhere
181 stem_ht# = 1.25 staff_space#;
184 define_pixels (ht, wd, stem_ht);
190 T := identity xscaled 0.6 linethickness
192 pickup pencircle transformed T;
193 ellipse := fullcircle transformed T;
200 fill get_subpath (ellipse, left, right, z1)
201 -- get_subpath (ellipse, right, left, z2)
204 pickup pencircle scaled 0.6 linethickness;
211 draw_rounded_block (bot lft z3, top rt z4,
215 draw_rounded_block (bot lft z4, top rt z3,
221 set_char_box (0, wd#, ht# / 2, stem_ht#);
223 set_char_box (0, wd#, stem_ht#, ht# / 2);
231 % custos medicaea, stem up, between staff lines
232 custos_medicaea ("Custos Med.", "medicaea.u0",
233 dir_up, between_staff_lines);
236 % custos medicaea, stem up, on staff line
237 custos_medicaea ("Custos Med.", "medicaea.u1",
238 dir_up, on_staff_line);
241 % custos medicaea, stem up, anywhere
242 custos_medicaea ("Custos Med.", "medicaea.u2",
246 % custos medicaea, stem down, between staff lines
247 custos_medicaea ("Reverse Custos Med.", "medicaea.d0",
248 dir_down, between_staff_lines);
251 % custos medicaea, stem down, on staff line
252 custos_medicaea ("Reverse Custos Med.", "medicaea.d1",
253 dir_down, on_staff_line);
256 % custos medicaea, stem down, anywhere
257 custos_medicaea ("Reverse Custos Med.", "medicaea.d2",
264 % Editio Vaticana style
268 def custos_vaticana (expr verbose_name, internal_name,
269 direction, staffline_adjustment) =
270 fet_beginchar (verbose_name, internal_name);
271 save ht, wd, u_offs, l_offs, stem_size, stem_end;
272 save pen_ht, l_shift, curve_ht, bend_ht;
277 if staffline_adjustment = between_staff_lines:
279 elseif staffline_adjustment = on_staff_line:
281 else: % staffline_adjustment = anywhere
288 u_offs# = +direction * 0.5 * (bend_ht# + l_shift#);
289 l_offs# = -direction * 0.5 * (bend_ht# - l_shift#);
290 stem_end# = direction * stem_size# * staff_space#;
291 pen_ht# = curve_ht# - l_shift#;
293 define_pixels (u_offs, l_offs, stem_end, ht, wd, pen_ht);
295 pickup pencircle scaled 0.6 linethickness;
298 z2 = (0.7 wd, l_offs);
301 penpos1 (pen_ht, 90);
302 penpos2 (pen_ht, 90);
303 penpos3 (pen_ht, 90);
305 penstroke z1e{z2 - z1}
315 draw_rounded_block (bot lft z4, top rt z5,
320 draw_rounded_block (bot lft z5, top rt z4,
325 set_char_box (0, wd#,
326 -l_offs# + 0.5 pen_ht#, stem_end#);
328 set_char_box (0, wd#,
329 -stem_end#, +l_offs# + 0.5 pen_ht#);
338 % custos vaticana, stem up, between staff lines
339 custos_vaticana ("Custos Ed. Vat.", "vaticana.u0",
340 dir_up, between_staff_lines);
343 % custos vaticana, stem up, on staff line
344 custos_vaticana ("Custos Ed. Vat.", "vaticana.u1",
345 dir_up, on_staff_line);
348 % custos vaticana, stem up, anywhere
349 custos_vaticana ("Custos Ed. Vat.", "vaticana.u2",
353 % custos vaticana, stem down, between staff lines
354 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d0",
355 dir_down, between_staff_lines);
358 % custos vaticana, stem down, on_staff_line
359 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d1",
360 dir_down, on_staff_line);
363 % custos vaticana, stem down, anywhere
364 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d2",
375 def custos_mensural (expr verbose_name, internal_name,
376 direction, staffline_adjustment) =
377 fet_beginchar (verbose_name, internal_name);
378 save alpha, dalpha, ht, wd, stem_ht;
383 dalpha = direction * alpha;
385 if staffline_adjustment = between_staff_lines:
386 stem_ht# = 1.00 staff_space#;
387 elseif staffline_adjustment = on_staff_line:
388 stem_ht# = 1.50 staff_space#;
389 else: % staffline_adjustment = anywhere
390 stem_ht# = 1.25 staff_space#;
393 define_pixels (ht, wd, stem_ht);
399 T := identity xscaled linethickness
402 pickup pencircle transformed T;
403 ellipse := fullcircle transformed T;
406 bot y1 = bot y3 = bot y5 = -direction * 0.33 ht;
407 top y2 = top y4 = +direction * 0.33 ht;
409 top y1 = top y3 = top y5 = -direction * 0.33 ht;
410 bot y2 = bot y4 = +direction * 0.33 ht;
419 y6 - y5 = direction * stem_ht;
420 y6 - y5 = (x6 - x5) * tand (90 - dalpha);
423 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
424 -- get_subpoint (ellipse, z2 - z1, z2)
425 -- get_subpoint (ellipse, z3 - z2, z2)
426 -- get_subpath (ellipse, z3 - z2, z4 - z3, z3)
427 -- get_subpoint (ellipse, z4 - z3, z4)
428 -- get_subpoint (ellipse, z5 - z4, z4)
429 -- get_subpath (ellipse, z5 - z4, z6 - z5, z5)
430 -- get_subpath (ellipse, z6 - z5, z5 - z6, z6)
431 -- get_subpoint (ellipse, z5 - z6, z5)
432 -- get_subpoint (ellipse, z4 - z5, z5)
433 -- get_subpath (ellipse, z4 - z5, z3 - z4, z4)
434 -- get_subpoint (ellipse, z3 - z4, z3)
435 -- get_subpoint (ellipse, z2 - z3, z3)
436 -- get_subpath (ellipse, z2 - z3, z1 - z2, z2)
439 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
440 -- get_subpath (ellipse, z2 -z1, z3 - z2, z2)
441 -- get_subpoint (ellipse, z3 - z2, z3)
442 -- get_subpoint (ellipse, z4 - z3, z3)
443 -- get_subpath (ellipse, z4 -z3, z5 - z4, z4)
444 -- get_subpoint (ellipse, z5 - z4, z5)
445 -- get_subpoint (ellipse, z6 - z5, z5)
446 -- get_subpath (ellipse, z6 - z5, z5 - z6, z6)
447 -- get_subpath (ellipse, z5 - z6, z4 - z5, z5)
448 -- get_subpoint (ellipse, z4 - z5, z4)
449 -- get_subpoint (ellipse, z3 - z4, z4)
450 -- get_subpath (ellipse, z3 - z4, z2 - z3, z3)
451 -- get_subpoint (ellipse, z2 - z3, z2)
452 -- get_subpoint (ellipse, z1 - z2, z2)
456 % The stem is intentionally outside of the char box.
458 set_char_box (0, wd#,
459 +direction * 0.33 ht#, stem_ht#);
461 set_char_box (0, wd#,
462 stem_ht#, -direction * 0.33 ht#);
465 labels (1, 2, 3, 4, 5, 6);
470 % custos mensural, stem up, between staff lines
471 custos_mensural ("Custos Mensural", "mensural.u0",
472 dir_up, between_staff_lines);
475 % custos mensural, stem up, on staff line
476 custos_mensural ("Custos Mensural", "mensural.u1",
477 dir_up, on_staff_line);
480 % custos mensural, stem up, anywhere
481 custos_mensural ("Custos Mensural", "mensural.u2",
485 % custos mensural, stem down, between staff lines
486 custos_mensural ("Reverse Custos Mensural", "mensural.d0",
487 dir_down, between_staff_lines);
490 % custos mensural, stem down, on staff line
491 custos_mensural ("Reverse Custos Mensural", "mensural.d1",
492 dir_down, on_staff_line);
495 % custos mensural, stem down, anywhere
496 custos_mensural ("Reverse Custos Mensural", "mensural.d2",
500 fet_endgroup ("custodes");