1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-heads.mf -- implement ancient note heads
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 2001--2005 Juergen Reuter <reuter@ipd.uka.de>
8 % Neo-mensural heads originally by
9 % Christian Mondrup and Mats Bengtsson
12 save black_notehead_width;
13 numeric black_notehead_width;
15 fet_begingroup ("noteheads")
20 % The head is assumed to be vertically centered around (0, 0).
21 % The left-most edge of the head should touch the vertical line
22 % that goes though the point (0, 0).
24 % set_char_box() conventions:
26 % * breapth: Ignored (as far as I know). Should be set to 0.
28 % * width: Should match the head's width.
30 % * depth: Should match the bottom edge of the head. Affects vertical
33 % * height: Should match the top edge of the head. Affects vertical
36 % TODO: should depth/height include appendages/stems?
39 noteheight# := staff_space# + (1 + overdone_heads)*stafflinethickness#;
40 define_pixels(noteheight);
52 def draw_neomensural_brevis(expr brevwid) =
53 save beamheight, head_width;
54 save holeheight, stem_width;
55 save serif_size, serif_protrude;
57 head_width# = brevwid;
58 holeheight = 3 stafflinethickness;
59 stem_width = 1.4 stafflinethickness;
62 define_pixels(head_width);
63 set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
65 2 beamheight + holeheight = noteheight;
66 serif_size = (holeheight - stafflinethickness)/2;
67 serif_protrude = 1.5 serif_size;
68 penpos1(stem_width, 0);
69 penpos2(stem_width, 0);
70 penpos3(beamheight, 90);
71 penpos4(beamheight, 90);
72 penpos5(stem_width, 180);
75 z2l = (0, -stafflinethickness/2);
76 z3r = z2r + serif_size *(1,-1);
79 z5l = z3l + (-serif_size, -serif_protrude);
81 penlabels(1,2,3,4, 5);
82 fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
83 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
85 addto currentpicture also currentpicture yscaled -1;
86 addto currentpicture also currentpicture
87 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
92 def draw_neomensural_left_stemmed_head (expr wid) =
93 draw_neomensural_brevis(wid);
95 x6 = x7 = stem_width/2;
97 y7 = y5 - 2.25 staff_space;
98 pickup pencircle scaled stem_width;
102 fet_beginchar("Left stemmed notehead", "lneomensural");
103 draw_neomensural_left_stemmed_head (2 staff_space#);
107 % Some sources (eg Musix/OpusTeX think that the appendage should be on
108 % the left, some say right. Right wins democratically.
110 def draw_neomensural_longa (expr wid) =
111 draw_neomensural_brevis(wid);
117 z6 - z7 = (stem_width/2, -staff_space);
118 theta = angle(z6-z7)+ 90;
119 penpos7(stem_width, theta);
120 penpos6(1.2 stem_width, theta);
122 fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
127 % En wij presenteren U: de opvolgster van Emily
131 fet_beginchar("Neo-mensural maxima notehead", "s-3neomensural");
132 draw_neomensural_longa (2.6 staff_space#)
135 fet_beginchar("Neo-mensural longa notehead", "s-2neomensural");
136 draw_neomensural_longa (2 staff_space#)
139 fet_beginchar("Neo-mensural brevis notehead", "s-1neomensural")
140 draw_neomensural_brevis(2 staff_space#);
143 def draw_neomensural_black_head (expr wid, height) =
146 set_char_box (0, head_width#, height/2, height/2);
148 charwx := head_width# / 2;
149 charwy := height / 2;
152 x2 = x4 = (x1 + x3) /2;
153 define_pixels (head_width);
154 pickup pencircle scaled blot_diameter;
160 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
163 def draw_neomensural_open_head (expr wid, height)=
164 draw_neomensural_black_head (wid, height);
166 diamNW = length (z2 - z1) + blot_diameter;
167 diamSW = length (z4 - z1) + blot_diameter;
169 save hole_widthNW, hole_widthSW;
170 hole_widthNW = 0.34 diamNW ;
171 hole_widthSW + 2.6 linethickness = diamSW;
173 (z7 + z5)/2 = (w/2, 0);
174 (z8 + z6)/2 = (w/2, 0);
175 (z6 - z5) = hole_widthNW * unitvector (z2 - z1);
176 (z7 - z6) = hole_widthSW * unitvector (z4 - z1);
178 labels (1,2,3,4,5,6,7,8);
180 unfill z5 -- z6 -- z7 -- z8 --cycle;
183 fet_beginchar("Neo-mensural open head","s0neomensural")
184 draw_neomensural_open_head (staff_space#, noteheight#);
188 % WL says the thin lines should be thinner.
191 fet_beginchar("Harmonic notehead (Neo-mensural open)",
194 draw_neomensural_open_head (1.3 staff_space#, 1.3 noteheight#);
195 charwx := head_width#;
200 fet_beginchar("Neo-mensural open head","s1neomensural")
201 draw_neomensural_open_head (staff_space#, noteheight#);
204 fet_beginchar("Neo-mensural black head","s2neomensural")
205 draw_neomensural_black_head (staff_space#, noteheight#);
210 def draw_mensural_brevis (expr wid) =
211 % TODO. For the moment, fall back to draw_neomensural_brevis.
212 draw_neomensural_brevis(wid);
215 def draw_mensural_left_stemmed_head (expr wid) =
216 draw_mensural_brevis(wid);
217 x6 = x7 = stem_width/2;
219 y7 = y5 - 2.25staff_space;
220 pickup pencircle scaled stem_width;
224 def draw_mensural_longa (expr wid) =
225 draw_mensural_brevis(wid);
226 x6 = x7 = head_width - stem_width/2;
228 y7 = y5 - 2.25staff_space;
229 pickup pencircle scaled stem_width;
233 fet_beginchar("Mensural left stemmed notehead", "slmensural");
234 draw_mensural_left_stemmed_head (staff_space#)
237 fet_beginchar("Mensural maxima notehead", "s-3mensural");
238 draw_mensural_longa (2.0 staff_space#)
241 fet_beginchar("Mensural longa notehead", "s-2mensural");
242 draw_mensural_longa (staff_space#)
245 fet_beginchar("Mensural brevis notehead", "s-1mensural")
246 draw_mensural_brevis(staff_space#);
249 def draw_diamond_head (expr head_h, pen_w, pen_h, angle, open) =
250 save head_width, head_height;
251 head_height# = head_h;
252 head_width# / head_height# = tand(angle);
254 set_char_box (0, head_width#,
255 head_height#/2, head_height#/2);
257 charwx := head_width# / 2;
258 charwy := head_height# / 2 - linethickness#;
260 define_pixels(head_width, head_height);
262 xscaled (max(blot_diameter, pen_w * head_width))
263 yscaled (max(blot_diameter, pen_h * head_width))
266 %% FIXME: replace "xpart (top z2)" (and, analogously,
267 %% "ypart (rt z3)") with an expression that really delivers the
268 %% x coordinate of the uppermost pixel that is drawn with respect
269 %% to the pencircle (this requires some elliptical computations).
270 %% MF obviously interprets "xpart (top z2)" as "top (xpart z2)",
271 %% i.e. "top x2", which is not what we want.
273 xpart (top z2) = ypart (rt z3) = 0;
274 top y2 = head_height/2;
275 rt x3 = head_width/2;
280 draw z1 -- z2 -- z3 -- z4 -- cycle;
282 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
285 currentpicture := currentpicture shifted (head_width/2, 0);
290 fet_beginchar("Mensural open head","s0mensural")
291 draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
294 fet_beginchar("Mensural open head","s1mensural")
295 draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
298 fet_beginchar("Mensural black head","s2mensural")
299 draw_diamond_head (staff_space#, 0.15, 0.30, 30, false);
307 % EDITIO VATICANA (including solesmes extensions)
312 % parameterized punctum
313 def punctum_char (expr verbose_name, internal_name,
314 left_stem, right_stem, linea, cavum,
315 straight, auctum, rev_auctum, direction_up,
316 excentric, up_shift, down_shift, mag) =
318 fet_beginchar(verbose_name, "s" & internal_name)
320 a_b := 1.54; % b_h*a_b/a_w = wd/ht
324 save a, beta, ht, wd;
325 ht# = noteheight# * mag;
329 black_notehead_width# := wd#;
332 save direction, direction_sign;
339 direction_sign# = -1;
342 % convexity and excentricity
343 save u_convexity, u_excentricity;
345 u_convexity# = -0.01ht#;
346 u_excentricity# = 0.0ht#; % dummy
348 u_convexity# = -0.03ht#;
349 u_excentricity# = +0.25ht#;
351 u_convexity# = -0.10ht#;
352 u_excentricity# = -0.12ht#;
354 u_convexity# = -0.05ht#;
355 u_excentricity# = 0.0ht#; % dummy
357 save convexity, excentricity;
358 convexity# = direction_sign# * u_convexity#;
359 excentricity# = direction_sign# * u_excentricity#;
371 define_pixels(convexity, excentricity, yoffs, ht, wd);
372 pickup pencircle scaled linethickness;
375 save height, yoffs_bt;
376 define_pixels (height, yoffs_bt);
378 yoffs_bt# = yoffs# - 0.5*height# - 0.25*convexity#;
379 xpart z1a = xpart z1b;
380 xpart z2a = xpart z2b;
381 xpart z3a = xpart z3b;
382 ypart z1a + height = ypart z1b;
383 ypart z2a + height = ypart z2b;
384 ypart z3a + height = ypart z3b;
386 save box_top, box_bt;
388 if auctum or rev_auctum:
389 z1a = (0.00wd + linethickness/2, yoffs_bt);
390 z2a = (0.21wd, yoffs_bt + 1.0*convexity);
391 z3a = (0.42wd - linethickness/2,
392 yoffs_bt + 1.0*excentricity);
393 box_top# = height# + yoffs_bt# +
394 max(0, 1.0*convexity#, 1.0*excentricity#);
395 box_bt# = yoffs_bt# +
396 min(0, 1.0*convexity#, 1.0*excentricity#);
397 p = z1a .. {right}z2a .. {direction}z3a --
398 z3b{-direction} .. z2b{left} .. z1b -- cycle;
400 z1a = (0.00wd + linethickness/2,
401 yoffs_bt - 1.0*convexity);
402 z2a = (0.08wd, yoffs_bt + 1.4*convexity);
403 z3a = (0.42wd - linethickness/2,
404 yoffs_bt - 1.0*convexity);
405 box_top# = height# + yoffs_bt# +
406 max(-1.0*convexity#, 1.4*convexity#, 0);
407 box_bt# = yoffs_bt# +
408 min(-1.0*convexity#, 1.4*convexity#, 0);
409 p = z1a{direction} .. z2a{right} .. z3a --
410 z3b .. {left}z2b .. {-direction}z1b -- cycle;
412 z1a = (0.00wd + linethickness/2, yoffs_bt);
413 z2a = (0.21wd, yoffs_bt + 1.0*convexity);
414 z3a = (0.42wd - linethickness/2, yoffs_bt);
415 box_top# = height# + yoffs_bt# +
416 max(0, 1.0*convexity#);
417 box_bt# = yoffs_bt# +
418 min(0, 1.0*convexity#);
419 p = z1a .. z2a .. z3a --
420 z3b .. z2b .. z1b -- cycle;
429 pickup pencircle scaled 0.6linethickness;
434 z5=(0.00wd + 0.6linethickness/2, yoffs);
435 z6=(0.00wd + 0.6linethickness/2, yoffs - 1.1ht);
437 stem_bt# = yoffs# - 1.1ht#;
439 z5=(0.42wd - 0.6linethickness/2, yoffs);
440 z6=(0.42wd - 0.6linethickness/2, yoffs - 1.5ht);
442 stem_bt# = yoffs# - 1.5ht#;
447 set_char_box(0.00wd#, 0.42wd#,
448 max(0, -box_bt#, -stem_bt#) + linethickness#/2,
449 max(0, box_top#) + linethickness#/2);
452 save linea_width, linea_height;
453 linea_width# = 0.6 linethickness#;
454 linea_height# = 0.7 ht#;
455 define_pixels (linea_width, linea_height);
456 draw_block ((-0.10wd - linea_width/2,
458 (-0.10wd + linea_width/2,
460 draw_block ((+0.52wd - linea_width/2,
462 (+0.52wd + linea_width/2,
465 0.62wd# + linea_width#,
468 currentpicture := currentpicture
469 shifted (0.10wd + linea_width/2, 0);
474 % parameterized punctum inclinatum
475 def inclinatum_char(expr verbose_name, internal_name,
476 small, stropha, auctum) =
478 fet_beginchar(verbose_name, "s"&internal_name)
482 ht# = 0.50 noteheight#;
484 ht# = 0.80 noteheight#;
487 draw_diamond_head (ht#, 0, 0, alpha#, false);
491 xscaled (0.25*head_height)
492 yscaled (0.55*head_height)
494 save za, off_angle; pair za;
496 za = (0, -0.25*head_height)
497 rotated -(alpha# + off_angle)
498 shifted (0.48 head_width, -0.02 head_width);
503 pickup pencircle scaled linethickness;
506 za = (0, -0.5 head_height + linethickness);
508 zc = za + (0.52 head_width, 0);
509 draw za{(0,-1) rotated alpha#} .. {right}zb{right} ..
510 {(0,1) rotated -alpha#}zc;
516 punctum_char("Ed. Vat. punctum", "vaticana.punctum",
517 false, false, false, false, false,
518 false, false, false, false, false, false, 1.0);
520 % punctum cavum (for OpusTeX compatibility)
521 punctum_char("Ed. Vat. punctum cavum", "vaticana.punctum.cavum",
522 false, false, false, true, false,
523 false, false, false, false, false, false, 1.0);
525 % linea punctum (for OpusTeX compatibility)
526 punctum_char("Ed. Vat. linea punctum", "vaticana.linea.punctum",
527 false, false, true, false, false,
528 false, false, false, false, false, false, 1.0);
530 % linea punctum cavum (for OpusTeX compatibility)
531 punctum_char("Ed. Vat. linea punctum cavum", "vaticana.linea.punctum.cavum",
532 false, false, true, true, false,
533 false, false, false, false, false, false, 1.0);
536 inclinatum_char("Ed. Vat. inclinatum", "vaticana.inclinatum",
537 false, false, false);
540 punctum_char("Ed. Vat. pes lower punctum", "vaticana.lpes",
541 false, false, false, false, true,
542 false, false, true, false, false, false, 1.0);
545 punctum_char("Ed. Vat. pes var lower punctum", "vaticana.vlpes",
546 false, false, false, false, true,
547 false, false, true, false, false, true, 1.0);
550 punctum_char("Ed. Vat. pes upper punctum", "vaticana.upes",
551 false, false, false, false, true,
552 false, false, false, false, false, false, 1.0);
554 % pes upper punctum (shifted variation)
556 % This note head is used instead of the regular pes upper punctum to
557 % avoid collision with the lower punctum note of the pes when the upper
558 % punctum sits directly on top of the lower punctum.
560 punctum_char("Ed. Vat. var pes upper punctum", "vaticana.vupes",
561 false, false, false, false, true,
562 false, false, false, false, true, false, 1.0);
564 % small punctum as used in epiphonus
565 punctum_char("Ed. Vat. plica", "vaticana.plica",
566 false, false, false, false, false,
567 false, false, false, false, false, false, 0.6);
569 % small punctum as used in epiphonus
570 punctum_char("Ed. Vat. var plica", "vaticana.vplica",
571 false, false, false, false, false,
572 false, true, false, false, false, true, 0.6);
574 % excentric punctum as used in epiphonus
575 punctum_char("Ed. Vat. epiphonus", "vaticana.epiphonus",
576 false, false, false, false, false,
577 false, false, true, true, false, false, 1.0);
579 % excentric punctum as used in epiphonus (shifted variation)
581 % This note head is used instead of the regular epiphonus punctum to
582 % avoid collision with the plica head when the plica sits directly on
583 % top of the lower head.
585 punctum_char("Ed. Vat. var epiphonus", "vaticana.vepiphonus",
586 false, false, false, false, false,
587 false, false, true, true, false, true, 1.0);
589 % small punctum as used in cephalicus
590 punctum_char("Ed. Vat. rev. plica", "vaticana.reverse.plica",
591 false, false, false, false, false,
592 false, false, true, false, false, false, 0.6);
594 % small punctum as used in cephalicus
595 punctum_char("Ed. Vat. rev. var plica", "vaticana.reverse.vplica",
596 false, false, false, false, false,
597 false, true, true, false, false, true, 0.6);
599 % excentric punctum as used in cephalicus; without left stem
600 punctum_char("Ed. Vat. cephalicus", "vaticana.inner.cephalicus",
601 false, false, false, false, false,
602 false, false, false, true, false, false, 1.0);
604 % excentric punctum as used in cephalicus; with left stem
605 punctum_char("Ed. Vat. cephalicus", "vaticana.cephalicus",
606 true, false, false, false, false,
607 false, false, false, true, false, false, 1.0);
610 fet_beginchar("Ed. Vat. quilisma", "svaticana.quilisma")
612 a_b:=1.54; % b_h*a_b/a_w = wd/ht
616 save a, beta, ht, wd;
621 set_char_box(0, 0.42wd#, 0.28 ht#, 0.36 ht#);
622 black_notehead_width# := wd#;
624 define_pixels(ht, wd);
625 pickup pencircle xscaled linethickness yscaled 0.44ht;
626 lft x1 = 0.00wd; bot y1 = -0.28ht;
627 x2 = 0.11wd; y2 = -0.14ht;
628 x3 = 0.12wd; y3 = +0.03ht;
629 x4 = 0.25wd; y4 = -0.09ht;
630 x5 = 0.26wd; y5 = +0.08ht;
631 x6 = 0.40wd; y6 = -0.04ht;
632 rt x7 = 0.42wd; top y7 = +0.36ht;
633 draw z1 .. z2 -- z3 .. z4 -- z5 .. z6 -- z7;
636 % solesmes punctum inclinatum parvum
637 inclinatum_char("Solesmes punctum inclinatum parvum", "solesmes.incl.parvum",
640 % solesmes punctum auctum ascendens
641 punctum_char("Solesmes punctum auctum ascendens", "solesmes.auct.asc",
642 false, false, false, false, false,
643 true, false, true, false, false, false, 1.0);
645 % solesmes punctum auctum descendens
646 punctum_char("Solesmes punctum auctum descendens", "solesmes.auct.desc",
647 false, false, false, false, false,
648 true, false, false, false, false, false, 1.0);
650 % solesmes punctum inclinatum auctum
651 inclinatum_char("Solesmes punctum incl. auctum", "solesmes.incl.auctum",
655 inclinatum_char("Solesmes stropha", "solesmes.stropha",
658 % solesmes stropha aucta
659 inclinatum_char("Solesmes stropha aucta", "solesmes.stropha.aucta",
663 fet_beginchar("Solesmes oriscus", "ssolesmes.oriscus")
665 a_b := 1.54; % b_h*a_b/a_w = wd/ht
669 save a, beta, ht, wd;
674 black_notehead_width# := wd#;
677 convexity# = +0.05ht#;
679 define_pixels(ht, wd, convexity);
680 pickup pencircle xscaled blot_diameter yscaled 0.50ht;
681 lft x1 = 0.00wd; y1 = -convexity;
682 x2 = 0.16wd; y2 = +convexity;
683 x3 = 0.33wd; y3 = -convexity;
684 rt x4 = 0.50wd; y4 = +convexity;
685 draw z1 .. z2 .. z3 .. z4;
686 set_char_box(0.00wd#, 0.50wd#,
687 0.25ht# + convexity#, 0.25ht# + convexity#);
700 fet_beginchar("Ed. Med. inclinatum", "smedicaea.inclinatum")
701 draw_diamond_head (1.2staff_space#, 0, 0, 35, false);
704 % parametrized punctum
705 def punctum_char (expr verbose_name, internal_name,
706 left_up_stem, left_down_stem) =
708 fet_beginchar(verbose_name, "s"&internal_name)
710 save a, beta, ht, wd;
711 ht# = 2 staff_space#;
713 black_notehead_width# := wd#;
715 define_pixels(ht, wd);
717 xscaled blot_diameter
719 z1 = (0.00wd + blot_diameter/2, 0);
720 z2 = (0.4wd - blot_diameter/2, 0);
724 xscaled linethickness
725 yscaled blot_diameter;
728 z4=(0.00wd + linethickness/2, blot_diameter/2);
729 z5=(0.00wd + linethickness/2, - 1.25ht);
731 set_char_box(0.0, 0.4wd#, 1.25ht#, 0.25ht#);
733 z4=(0.00wd + linethickness/2, blot_diameter/2);
734 z5=(0.00wd + linethickness/2, + 1.25ht);
736 set_char_box(0.0, 0.4wd#, 0.25ht#, 1.25ht#);
738 set_char_box(0.0, 0.4wd#, 0.25ht#, 0.25ht#);
745 punctum_char("Ed. Med. punctum", "medicaea.punctum",
748 % left up-stemmed punctum
749 punctum_char("Ed. Med. reverse virga", "medicaea.rvirga",
752 % virga (i.e. left down-stemmed punctum)
753 punctum_char("Ed. Med. virga", "medicaea.virga",
766 % parametrized punctum
767 def punctum_char (expr verbose_name, internal_name,
769 fet_beginchar(verbose_name, "s" & internal_name)
772 draw_diamond_head (staff_space#, 0, 0, alpha#, false);
775 xscaled blot_diameter
776 yscaled (0.7*staff_space)
778 save za, zb; pair za, zb;
779 za = (head_width/2, 0);
780 bot zb = (head_width/2, -1.5staff_space);
782 set_char_box (0, head_width#,
783 1.5staff_space#, head_height#/2);
789 punctum_char("Hufnagel punctum", "hufnagel.punctum", false)
792 punctum_char("Hufnagel virga", "hufnagel.virga", true)
795 fet_beginchar("Hufnagel pes lower punctum", "shufnagel.lpes")
796 save width, height, alpha;
797 width# = 2*staff_space#;
798 height# = 0.7*staff_space#;
801 set_char_box(0, width#, height#/2, height#/2);
803 pickup pencircle scaled linethickness;
804 define_pixels(width, height);
806 rt x3 = -lft x1 = width/2;
809 tand(alpha#) * (y2 - y1) = x2 - x1 = x3 - x4;
811 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
813 currentpicture := currentpicture shifted (width/2, 0);
816 fet_endgroup ("noteheads")