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--2003 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
38 noteheight# := staff_space# + (1 + overdone_heads)*stafflinethickness#;
39 define_pixels(noteheight);
51 def draw_neo_brevis(expr brevwid) =
52 save beamheight, head_width;
53 save holeheight, stem_width;
54 save serif_size, serif_protrude;
56 head_width# = brevwid;
57 holeheight = 3 stafflinethickness;
58 stem_width = 1.4 stafflinethickness;
61 define_pixels(head_width);
62 set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
64 2 beamheight + holeheight = noteheight;
65 serif_size = (holeheight - stafflinethickness)/2;
66 serif_protrude = 1.5 serif_size;
67 penpos1(stem_width, 0);
68 penpos2(stem_width, 0);
69 penpos3(beamheight, 90);
70 penpos4(beamheight, 90);
71 penpos5(stem_width, 180);
74 z2l = (0, -stafflinethickness/2);
75 z3r = z2r + serif_size *(1,-1);
78 z5l = z3l + (-serif_size, -serif_protrude);
80 penlabels(1,2,3,4, 5);
81 fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
82 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
84 addto currentpicture also currentpicture yscaled -1;
86 addto currentpicture also currentpicture
87 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
92 def draw_neo_left_stemmed_head (expr wid) =
95 x6 = x7 = head_width - stem_width/2;
97 y7 = y5 - 2.25 staff_space;
98 pickup pencircle scaled stem_width;
102 fet_beginchar("Left stemmed notehead", "lneo_mensural", "mensuralleftstemmedhead");
103 draw_neo_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_neo_longa (expr wid) =
111 draw_neo_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("Maxima notehead", "-3neo_mensural", "mensuralmaximahead");
132 draw_neo_longa (2.6 staff_space#)
135 fet_beginchar("Longa notehead", "-2neo_mensural", "mensurallongahead");
136 draw_neo_longa (2 staff_space#)
139 fet_beginchar("Brevis notehead", "-1neo_mensural", "mensuralbrevishead")
140 draw_neo_brevis(2 staff_space#);
143 def draw_neo_mensural_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_neo_mensural_open_head (expr wid, height)=
164 draw_neo_mensural_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 stafflinethickness = 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","0neo_mensural","neomensuralsemibrevishead")
184 draw_neo_mensural_open_head (staff_space#, noteheight#);
187 fet_beginchar("Harmonic notehead (Neo-mensural open)","0harmonic","harmonichead")
188 draw_neo_mensural_open_head (1.3 staff_space#, 1.3 noteheight#);
189 charwx := head_width#;
194 fet_beginchar("Neo-mensural open head","1neo_mensural","neomensuralminimahead")
195 draw_neo_mensural_open_head (staff_space#, noteheight#);
198 fet_beginchar("Neo-mensural black head","2neo_mensural","neomensuralsemiminimahead")
199 draw_neo_mensural_black_head (staff_space#, noteheight#);
204 def draw_brevis (expr wid) =
205 % TODO. For the moment, fall back to draw_neo_brevis.
206 draw_neo_brevis(wid);
209 def draw_left_stemmed_head (expr wid) =
213 x6 = x7 = stem_width/2;
215 y7 = y5 - 2.25staff_space;
216 pickup pencircle scaled stem_width;
220 fet_beginchar("Left stemmed notehead", "lmensural", "mensuralleftstemmedhead");
221 draw_left_stemmed_head (staff_space#)
224 def draw_longa (expr wid) =
227 x6 = x7 = head_width - stem_width/2;
229 y7 = y5 - 2.25staff_space;
230 pickup pencircle scaled stem_width;
234 fet_beginchar("Maxima notehead", "-3mensural", "mensuralmaximahead");
235 draw_longa (2.0 staff_space#)
238 fet_beginchar("Longa notehead", "-2mensural", "mensurallongahead");
239 draw_longa (staff_space#)
242 fet_beginchar("Brevis notehead", "-1mensural", "mensuralbrevishead")
243 draw_brevis(staff_space#);
246 def draw_diamond_head (expr head_h, pen_w, pen_h, angle, open) =
247 save head_width, head_height;
248 head_height# = head_h;
249 head_width# / head_height# = tand(angle);
250 define_pixels(head_width, head_height);
252 set_char_box (0, head_width#,
253 head_height#/2, head_height#/2);
255 charwx := head_width# / 2;
256 charwy := head_height# / 2 - stafflinethickness#;
259 xscaled (min(blot_diameter, pen_w * head_width))
260 yscaled (min(blot_diameter, pen_h * head_width))
263 %% FIXME: replace "xpart (top z2)" (and, analogously,
264 %% "ypart (rt z3)") with an expression that really delivers the
265 %% x coordinate of the uppermost pixel that is drawn with respect
266 %% to the pencircle (this requires some elliptical computations).
267 %% MF obviously interprets "xpart (top z2)" as "top (xpart z2)",
268 %% i.e. "top x2", which is not what we want.
270 xpart (top z2) = ypart (rt z3) = 0;
271 top y2 = head_height/2;
272 rt x3 = head_width/2;
277 draw z1 -- z2 -- z3 -- z4 -- cycle;
279 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
282 currentpicture := currentpicture shifted (head_width/2, 0);
287 fet_beginchar("Mensural open head","0mensural","mensuralsemibrevishead")
288 draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
291 fet_beginchar("Mensural open head","1mensural","mensuralminimahead")
292 draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
295 fet_beginchar("Mensural black head","2mensural","mensuralsemiminimahead")
296 draw_diamond_head (staff_space#, 0.15, 0.30, 30, false);
304 % EDITIO VATICANA (including solesmes extensions)
309 % parameterized punctum
310 def punctum_char (expr verbose_name, internal_name, ly_name,
311 left_stem, right_stem, linea, cavum,
312 straight, auctum, direction_up, excentric, up_shift, down_shift, mag) =
314 fet_beginchar(verbose_name, internal_name, ly_name)
316 a_b := 1.54; % b_h*a_b/a_w = wd/ht
320 save a, beta, ht, wd;
321 ht# = noteheight# * mag;
325 black_notehead_width# := wd#;
328 save direction, direction_sign;
335 direction_sign# = -1;
338 % convexity and excentricity
339 save u_convexity, u_excentricity;
341 u_convexity# = -0.01ht#;
342 u_excentricity# = 0.0ht#; % dummy
344 u_convexity# = -0.03ht#;
345 u_excentricity# = +0.25ht#;
347 u_convexity# = -0.05ht#;
348 u_excentricity# = 0.0ht#; % dummy
350 save convexity, excentricity;
351 convexity# = direction_sign# * u_convexity#;
352 excentricity# = direction_sign# * u_excentricity#;
364 define_pixels(convexity, excentricity, yoffs, ht, wd);
365 pickup pencircle scaled stafflinethickness;
368 save height, yoffs_bt;
369 define_pixels (height, yoffs_bt);
371 yoffs_bt# = yoffs# - 0.5*height# - 0.25*convexity#;
372 xpart z1a = xpart z1b;
373 xpart z2a = xpart z2b;
374 xpart z3a = xpart z3b;
375 ypart z1a + height = ypart z1b;
376 ypart z2a + height = ypart z2b;
377 ypart z3a + height = ypart z3b;
379 save box_top, box_bt;
382 z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
383 z2a = (0.21wd, yoffs_bt + 1.0*convexity);
384 z3a = (0.42wd - stafflinethickness/2,
385 yoffs_bt + 1.0*excentricity);
386 box_top# = height# + yoffs_bt# +
387 max(0, 1.0*convexity#, 1.0*excentricity#);
388 box_bt# = yoffs_bt# +
389 min(0, 1.0*convexity#, 1.0*excentricity#);
390 p = z1a .. {right}z2a .. {direction}z3a --
391 z3b{-direction} .. z2b{left} .. z1b -- cycle;
393 z1a = (0.00wd + stafflinethickness/2,
394 yoffs_bt - 1.0*convexity);
395 z2a = (0.08wd, yoffs_bt + 1.4*convexity);
396 z3a = (0.42wd - stafflinethickness/2,
397 yoffs_bt - 1.0*convexity);
398 box_top# = height# + yoffs_bt# +
399 max(-1.0*convexity#, 1.4*convexity#, 0);
400 box_bt# = yoffs_bt# +
401 min(-1.0*convexity#, 1.4*convexity#, 0);
402 p = z1a{direction} .. z2a{right} .. z3a --
403 z3b .. {left}z2b .. {-direction}z1b -- cycle;
405 z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
406 z2a = (0.21wd, yoffs_bt + 1.0*convexity);
407 z3a = (0.42wd - stafflinethickness/2, yoffs_bt);
408 box_top# = height# + yoffs_bt# +
409 max(0, 1.0*convexity#);
410 box_bt# = yoffs_bt# +
411 min(0, 1.0*convexity#);
412 p = z1a .. z2a .. z3a --
413 z3b .. z2b .. z1b -- cycle;
422 pickup pencircle scaled 0.6stafflinethickness;
427 z5=(0.00wd + 0.6stafflinethickness/2, yoffs);
428 z6=(0.00wd + 0.6stafflinethickness/2, yoffs - 1.1ht);
430 stem_bt# = yoffs# - 1.1ht#;
432 z5=(0.42wd - 0.6stafflinethickness/2, yoffs);
433 z6=(0.42wd - 0.6stafflinethickness/2, yoffs - 1.5ht);
435 stem_bt# = yoffs# - 1.5ht#;
440 set_char_box(0.00wd#, 0.42wd#,
441 max(0, -box_bt#, -stem_bt#) + stafflinethickness#/2,
442 max(0, box_top#) + stafflinethickness#/2);
445 save linea_width, linea_height;
446 linea_width# = 0.6 stafflinethickness#;
447 linea_height# = 0.7 ht#;
448 define_pixels (linea_width, linea_height);
449 draw_block ((-0.10wd - linea_width/2,
451 (-0.10wd + linea_width/2,
453 draw_block ((+0.52wd - linea_width/2,
455 (+0.52wd + linea_width/2,
458 0.62wd# + linea_width#,
461 currentpicture := currentpicture
462 shifted (0.10wd + linea_width/2, 0);
467 % parameterized punctum inclinatum
468 def inclinatum_char(expr verbose_name, internal_name, ly_name,
469 small, stropha, auctum) =
471 fet_beginchar(verbose_name, internal_name, ly_name)
475 ht# = 0.50 noteheight#;
477 ht# = 0.80 noteheight#;
480 draw_diamond_head (ht#, 0, 0, alpha#, false);
484 xscaled (0.25*head_height)
485 yscaled (0.55*head_height)
487 save za, off_angle; pair za;
489 za = (0, -0.25*head_height)
490 rotated -(alpha# + off_angle)
491 shifted (0.48 head_width, -0.02 head_width);
496 pickup pencircle scaled stafflinethickness;
499 za = (0, -0.5 head_height + stafflinethickness);
501 zc = za + (0.52 head_width, 0);
502 draw za{(0,-1) rotated alpha#} .. {right}zb{right} ..
503 {(0,1) rotated -alpha#}zc;
509 punctum_char("Ed. Vat. punctum", "vaticana_punctum", "vatpunctumhead",
510 false, false, false, false, false,
511 false, false, false, false, false, 1.0);
513 % punctum cavum (for OpusTeX compatibility)
514 punctum_char("Ed. Vat. punctum cavum", "vaticana_punctum_cavum",
515 "vatpunctumcavumhead",
516 false, false, false, true, false,
517 false, false, false, false, false, 1.0);
519 % linea punctum (for OpusTeX compatibility)
520 punctum_char("Ed. Vat. linea punctum", "vaticana_linea_punctum",
521 "vatlineapunctumhead",
522 false, false, true, false, false,
523 false, false, false, false, false, 1.0);
525 % linea punctum cavum (for OpusTeX compatibility)
526 punctum_char("Ed. Vat. linea punctum cavum", "vaticana_linea_punctum_cavum",
527 "vatlineapunctumcavumhead",
528 false, false, true, true, false,
529 false, false, false, false, false, 1.0);
532 inclinatum_char("Ed. Vat. inclinatum", "vaticana_inclinatum",
534 false, false, false);
537 punctum_char("Ed. Vat. pes lower punctum", "vaticana_lpes", "vatlpeshead",
538 false, false, false, false, true,
539 false, true, false, false, false, 1.0);
542 punctum_char("Ed. Vat. pes var lower punctum", "vaticana_vlpes", "vatvlpeshead",
543 false, false, false, false, true,
544 false, true, false, false, true, 1.0);
547 punctum_char("Ed. Vat. pes upper punctum", "vaticana_upes", "vatupeshead",
548 false, false, false, false, true,
549 false, false, false, false, false, 1.0);
551 % pes upper punctum (shifted variation)
553 % This note head is used instead of the regular pes upper punctum to
554 % avoid collision with the lower punctum note of the pes when the upper
555 % punctum sits directly on top of the lower punctum.
557 punctum_char("Ed. Vat. var pes upper punctum", "vaticana_vupes",
559 false, false, false, false, true,
560 false, false, false, true, false, 1.0);
562 % small punctum as used in epiphonus
563 punctum_char("Ed. Vat. plica", "vaticana_plica", "vatplicahead",
564 false, false, false, false, false,
565 false, false, false, false, false, 0.6);
567 % excentric punctum as used in epiphonus
568 punctum_char("Ed. Vat. epiphonus", "vaticana_epiphonus", "vatepiphonushead",
569 false, false, false, false, false,
570 false, true, true, false, false, 1.0);
572 % excentric punctum as used in epiphonus (shifted variation)
574 % This note head is used instead of the regular epiphonus punctum to
575 % avoid collision with the plica head when the plica sits directly on
576 % top of the lower head.
578 punctum_char("Ed. Vat. var epiphonus", "vaticana_vepiphonus", "vatvepiphonushead",
579 false, false, false, false, false,
580 false, true, true, false, true, 1.0);
582 % small punctum as used in cephalicus
583 punctum_char("Ed. Vat. rev. plica", "vaticana_reverse_plica", "vatrplicahead",
584 false, false, false, false, false,
585 false, true, false, false, false, 0.6);
587 % excentric punctum as used in cephalicus; without left stem
588 punctum_char("Ed. Vat. cephalicus", "vaticana_inner_cephalicus",
589 "vatinnercephalicushead",
590 false, false, false, false, false,
591 false, false, true, false, false, 1.0);
593 % excentric punctum as used in cephalicus; with left stem
594 punctum_char("Ed. Vat. cephalicus", "vaticana_cephalicus",
596 true, false, false, false, false,
597 false, false, true, false, false, 1.0);
600 fet_beginchar("Ed. Vat. quilisma", "vaticana_quilisma", "vatquilismahead")
602 a_b:=1.54; % b_h*a_b/a_w = wd/ht
606 save a, beta, ht, wd;
611 set_char_box(0, 0.42wd#, 0.28 ht#, 0.36 ht#);
612 black_notehead_width# := wd#;
614 define_pixels(ht, wd);
615 pickup pencircle xscaled stafflinethickness yscaled 0.44ht;
616 lft x1 = 0.00wd; bot y1 = -0.28ht;
617 x2 = 0.11wd; y2 = -0.14ht;
618 x3 = 0.12wd; y3 = +0.03ht;
619 x4 = 0.25wd; y4 = -0.09ht;
620 x5 = 0.26wd; y5 = +0.08ht;
621 x6 = 0.40wd; y6 = -0.04ht;
622 rt x7 = 0.42wd; top y7 = +0.36ht;
623 draw z1 .. z2 -- z3 .. z4 -- z5 .. z6 -- z7;
626 % solesmes punctum inclinatum parvum
627 inclinatum_char("Solesmes punctum inclinatum parvum", "solesmes_incl_parvum",
631 % solesmes punctum auctum ascendens
632 punctum_char("Solesmes punctum auctum ascendens", "solesmes_auct_asc",
634 false, false, false, false, false,
635 true, true, false, false, false, 1.0);
637 % solesmes punctum auctum descendens
638 punctum_char("Solesmes punctum auctum descendens", "solesmes_auct_desc",
640 false, false, false, false, false,
641 true, false, false, false, false, 1.0);
643 % solesmes punctum inclinatum auctum
644 inclinatum_char("Solesmes punctum incl. auctum", "solesmes_incl_auctum",
645 "solpunctuminclinatumauctumhead",
649 inclinatum_char("Solesmes stropha", "solesmes_stropha",
653 % solesmes stropha aucta
654 inclinatum_char("Solesmes stropha aucta", "solesmes_stropha_aucta",
655 "solstrophaauctahead",
659 fet_beginchar("Solesmes oriscus", "solesmes_oriscus",
662 a_b := 1.54; % b_h*a_b/a_w = wd/ht
666 save a, beta, ht, wd;
671 black_notehead_width# := wd#;
674 convexity# = +0.05ht#;
676 define_pixels(ht, wd, convexity);
677 pickup pencircle xscaled blot_diameter yscaled 0.50ht;
678 lft x1 = 0.00wd; y1 = -convexity;
679 x2 = 0.16wd; y2 = +convexity;
680 x3 = 0.33wd; y3 = -convexity;
681 rt x4 = 0.50wd; y4 = +convexity;
682 draw z1 .. z2 .. z3 .. z4;
683 set_char_box(0.00wd#, 0.50wd#,
684 0.25ht# + convexity#, 0.25ht# + convexity#);
697 fet_beginchar("Ed. Med. inclinatum", "medicaea_inclinatum",
699 draw_diamond_head (1.2staff_space#, 0, 0, 35, false);
702 % parametrized punctum
703 def punctum_char (expr verbose_name, internal_name, ly_name,
704 left_up_stem, left_down_stem) =
706 fet_beginchar(verbose_name, internal_name, ly_name)
708 save a, beta, ht, wd;
709 ht# = 2 staff_space#;
711 black_notehead_width# := wd#;
713 define_pixels(ht, wd);
715 xscaled blot_diameter
717 z1 = (0.00wd + blot_diameter/2, 0);
718 z2 = (0.4wd - blot_diameter/2, 0);
722 xscaled stafflinethickness
723 yscaled blot_diameter;
726 z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
727 z5=(0.00wd + stafflinethickness/2, - 1.25ht);
729 set_char_box(0.0, 0.4wd#, 1.25ht#, 0.25ht#);
731 z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
732 z5=(0.00wd + stafflinethickness/2, + 1.25ht);
734 set_char_box(0.0, 0.4wd#, 0.25ht#, 1.25ht#);
736 set_char_box(0.0, 0.4wd#, 0.25ht#, 0.25ht#);
743 punctum_char("Ed. Med. punctum", "medicaea_punctum", "medpunctumhead",
746 % left up-stemmed punctum
747 punctum_char("Ed. Med. reverse virga", "medicaea_rvirga", "medrvirgahead",
750 % virga (i.e. left down-stemmed punctum)
751 punctum_char("Ed. Med. virga", "medicaea_virga", "medvirgahead",
764 % parametrized punctum
765 def punctum_char (expr verbose_name, internal_name, ly_name,
767 fet_beginchar(verbose_name, internal_name, ly_name)
770 draw_diamond_head (staff_space#, 0, 0, alpha#, false);
773 xscaled blot_diameter
774 yscaled (0.7*staff_space)
776 save za, zb; pair za, zb;
777 za = (head_width/2, 0);
778 bot zb = (head_width/2, -1.5staff_space);
780 set_char_box (0, head_width#,
781 1.5staff_space#, head_height#/2);
787 punctum_char("Hufnagel punctum", "hufnagel_punctum", "hufpunctumhead", false)
790 punctum_char("Hufnagel virga", "hufnagel_virga", "hufvirgahead", true)
793 fet_beginchar("Hufnagel pes lower punctum", "hufnagel_lpes", "huflpeshead")
794 save width, height, alpha;
795 width# = 2*staff_space#;
796 height# = 0.7*staff_space#;
799 set_char_box(0, width#, height#/2, height#/2);
801 pickup pencircle scaled stafflinethickness;
802 define_pixels(width, height);
804 rt x3 = -lft x1 = width/2;
807 tand(alpha#) * (y2 - y1) = x2 - x1 = x3 - x4;
809 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
811 currentpicture := currentpicture shifted (width/2, 0);
814 fet_endgroup ("noteheads")