1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-custodes.mf -- implement ancient custodes
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 2000--2006 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);
83 pickup pencircle xscaled linethickness
87 ellipse := fullcircle xscaled linethickness
91 if direction = dir_up:
101 y3 - y2 = direction * stem_ht;
102 (y3 - y2) = (x3 - x2) * tand (90 - dalpha);
104 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
106 -- get_subpath (ellipse, z2 - z1, z3 - z2, z2)
108 -- get_subpoint (ellipse, z2 - z1, z2)
109 -- get_subpoint (ellipse, z3 - z2, z2)
111 -- get_subpath (ellipse, z3 - z2, z2 - z3, z3)
113 -- get_subpoint (ellipse, z2 - z3, z2)
114 -- get_subpoint (ellipse, z1 - z2, z2)
116 -- get_subpath (ellipse, z2 - z3, z1 - z2, z2)
120 % The stem is intentionally outside of the char box.
122 set_char_box (0, wd#, ht# / 2, stem_ht#);
124 set_char_box (0, wd#, stem_ht#, ht# / 2);
132 % custos hufnagel, stem up, between staff lines
133 custos_hufnagel ("Custos Hufnagel", "hufnagel.u0",
134 dir_up, between_staff_lines);
137 % custos hufnagel, stem up, on staff line
138 custos_hufnagel ("Custos Hufnagel", "hufnagel.u1",
139 dir_up, on_staff_line);
142 % custos hufnagel, stem up, anywhere
143 custos_hufnagel ("Custos Hufnagel", "hufnagel.u2",
147 % custos hufnagel, stem down, between staff lines
148 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d0",
149 dir_down, between_staff_lines);
152 % custos hufnagel, stem down, on staff line
153 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d1",
154 dir_down, on_staff_line);
157 % custos hufnagel, stem down, anywhere
158 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d2",
169 def custos_medicaea (expr verbose_name, internal_name,
170 direction, staffline_adjustment) =
171 fet_beginchar (verbose_name, internal_name);
172 save ht, wd, stem_ht;
177 if staffline_adjustment = between_staff_lines:
178 stem_ht# = 1.00 staff_space#;
179 elseif staffline_adjustment = on_staff_line:
180 stem_ht# = 1.50 staff_space#;
181 else: % staffline_adjustment = anywhere
182 stem_ht# = 1.25 staff_space#;
185 define_pixels (ht, wd, stem_ht);
190 pickup pencircle xscaled 0.6 linethickness
193 ellipse := fullcircle xscaled 0.6 linethickness
201 fill get_subpath (ellipse, left, right, z1)
202 -- get_subpath (ellipse, right, left, z2)
205 pickup pencircle scaled 0.6 linethickness;
212 draw_rounded_block (bot lft z3, top rt z4,
216 draw_rounded_block (bot lft z4, top rt z3,
222 set_char_box (0, wd#, ht# / 2, stem_ht#);
224 set_char_box (0, wd#, stem_ht#, ht# / 2);
232 % custos medicaea, stem up, between staff lines
233 custos_medicaea ("Custos Med.", "medicaea.u0",
234 dir_up, between_staff_lines);
237 % custos medicaea, stem up, on staff line
238 custos_medicaea ("Custos Med.", "medicaea.u1",
239 dir_up, on_staff_line);
242 % custos medicaea, stem up, anywhere
243 custos_medicaea ("Custos Med.", "medicaea.u2",
247 % custos medicaea, stem down, between staff lines
248 custos_medicaea ("Reverse Custos Med.", "medicaea.d0",
249 dir_down, between_staff_lines);
252 % custos medicaea, stem down, on staff line
253 custos_medicaea ("Reverse Custos Med.", "medicaea.d1",
254 dir_down, on_staff_line);
257 % custos medicaea, stem down, anywhere
258 custos_medicaea ("Reverse Custos Med.", "medicaea.d2",
265 % Editio Vaticana style
269 def custos_vaticana (expr verbose_name, internal_name,
270 direction, staffline_adjustment) =
271 fet_beginchar (verbose_name, internal_name);
272 save ht, wd, u_offs, l_offs, stem_size, stem_end;
273 save pen_ht, l_shift, curve_ht, bend_ht;
278 if staffline_adjustment = between_staff_lines:
280 elseif staffline_adjustment = on_staff_line:
282 else: % staffline_adjustment = anywhere
289 u_offs# = +direction * 0.5 * (bend_ht# + l_shift#);
290 l_offs# = -direction * 0.5 * (bend_ht# - l_shift#);
291 stem_end# = direction * stem_size# * staff_space#;
292 pen_ht# = curve_ht# - l_shift#;
294 define_pixels (u_offs, l_offs, stem_end, ht, wd, pen_ht);
296 pickup pencircle scaled 0.6 linethickness;
299 z2 = (0.7 wd, l_offs);
302 penpos1 (pen_ht, 90);
303 penpos2 (pen_ht, 90);
304 penpos3 (pen_ht, 90);
306 penstroke z1e{z2 - z1}
316 draw_rounded_block (bot lft z4, top rt z5,
321 draw_rounded_block (bot lft z5, top rt z4,
326 set_char_box (0, wd#,
327 -l_offs# + 0.5 pen_ht#, stem_end#);
329 set_char_box (0, wd#,
330 -stem_end#, +l_offs# + 0.5 pen_ht#);
339 % custos vaticana, stem up, between staff lines
340 custos_vaticana ("Custos Ed. Vat.", "vaticana.u0",
341 dir_up, between_staff_lines);
344 % custos vaticana, stem up, on staff line
345 custos_vaticana ("Custos Ed. Vat.", "vaticana.u1",
346 dir_up, on_staff_line);
349 % custos vaticana, stem up, anywhere
350 custos_vaticana ("Custos Ed. Vat.", "vaticana.u2",
354 % custos vaticana, stem down, between staff lines
355 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d0",
356 dir_down, between_staff_lines);
359 % custos vaticana, stem down, on_staff_line
360 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d1",
361 dir_down, on_staff_line);
364 % custos vaticana, stem down, anywhere
365 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d2",
376 def custos_mensural (expr verbose_name, internal_name,
377 direction, staffline_adjustment) =
378 fet_beginchar (verbose_name, internal_name);
379 save alpha, dalpha, ht, wd, stem_ht;
384 dalpha = direction * alpha;
386 if staffline_adjustment = between_staff_lines:
387 stem_ht# = 1.00 staff_space#;
388 elseif staffline_adjustment = on_staff_line:
389 stem_ht# = 1.50 staff_space#;
390 else: % staffline_adjustment = anywhere
391 stem_ht# = 1.25 staff_space#;
394 define_pixels (ht, wd, stem_ht);
399 pickup pencircle xscaled linethickness
403 ellipse := fullcircle xscaled linethickness
408 bot y1 = bot y3 = bot y5 = -direction * 0.33 ht;
409 top y2 = top y4 = +direction * 0.33 ht;
411 top y1 = top y3 = top y5 = -direction * 0.33 ht;
412 bot y2 = bot y4 = +direction * 0.33 ht;
421 y6 - y5 = direction * stem_ht;
422 y6 - y5 = (x6 - x5) * tand (90 - dalpha);
425 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
426 -- get_subpoint (ellipse, z2 - z1, z2)
427 -- get_subpoint (ellipse, z3 - z2, z2)
428 -- get_subpath (ellipse, z3 - z2, z4 - z3, z3)
429 -- get_subpoint (ellipse, z4 - z3, z4)
430 -- get_subpoint (ellipse, z5 - z4, z4)
431 -- get_subpath (ellipse, z5 - z4, z6 - z5, z5)
432 -- get_subpath (ellipse, z6 - z5, z5 - z6, z6)
433 -- get_subpoint (ellipse, z5 - z6, z5)
434 -- get_subpoint (ellipse, z4 - z5, z5)
435 -- get_subpath (ellipse, z4 - z5, z3 - z4, z4)
436 -- get_subpoint (ellipse, z3 - z4, z3)
437 -- get_subpoint (ellipse, z2 - z3, z3)
438 -- get_subpath (ellipse, z2 - z3, z1 - z2, z2)
441 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
442 -- get_subpath (ellipse, z2 -z1, z3 - z2, z2)
443 -- get_subpoint (ellipse, z3 - z2, z3)
444 -- get_subpoint (ellipse, z4 - z3, z3)
445 -- get_subpath (ellipse, z4 -z3, z5 - z4, z4)
446 -- get_subpoint (ellipse, z5 - z4, z5)
447 -- get_subpoint (ellipse, z6 - z5, z5)
448 -- get_subpath (ellipse, z6 - z5, z5 - z6, z6)
449 -- get_subpath (ellipse, z5 - z6, z4 - z5, z5)
450 -- get_subpoint (ellipse, z4 - z5, z4)
451 -- get_subpoint (ellipse, z3 - z4, z4)
452 -- get_subpath (ellipse, z3 - z4, z2 - z3, z3)
453 -- get_subpoint (ellipse, z2 - z3, z2)
454 -- get_subpoint (ellipse, z1 - z2, z2)
458 % The stem is intentionally outside of the char box.
460 set_char_box (0, wd#,
461 +direction * 0.33 ht#, stem_ht#);
463 set_char_box (0, wd#,
464 stem_ht#, -direction * 0.33 ht#);
467 labels (1, 2, 3, 4, 5, 6);
472 % custos mensural, stem up, between staff lines
473 custos_mensural ("Custos Mensural", "mensural.u0",
474 dir_up, between_staff_lines);
477 % custos mensural, stem up, on staff line
478 custos_mensural ("Custos Mensural", "mensural.u1",
479 dir_up, on_staff_line);
482 % custos mensural, stem up, anywhere
483 custos_mensural ("Custos Mensural", "mensural.u2",
487 % custos mensural, stem down, between staff lines
488 custos_mensural ("Reverse Custos Mensural", "mensural.d0",
489 dir_down, between_staff_lines);
492 % custos mensural, stem down, on staff line
493 custos_mensural ("Reverse Custos Mensural", "mensural.d1",
494 dir_down, on_staff_line);
497 % custos mensural, stem down, anywhere
498 custos_mensural ("Reverse Custos Mensural", "mensural.d2",
502 fet_endgroup ("custodes");