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")
17 noteheight#:=staff_space# + (1 + overdone_heads)*stafflinethickness#;
18 define_pixels(noteheight);
29 brevis_wid# := 2 staff_space#;
31 def draw_neo_brevis(expr brevwid) =
32 save beamheight, head_width;
33 save holeheight, stem_width;
34 save serif_size, serif_protrude;
36 head_width# = brevwid;
37 holeheight = 3 stafflinethickness;
38 stem_width = 1.4 stafflinethickness;
41 define_pixels(head_width);
42 set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
44 2 beamheight + holeheight = noteheight;
45 serif_size = (holeheight - stafflinethickness)/2;
46 serif_protrude = 1.5 serif_size;
47 penpos1(stem_width, 0);
48 penpos2(stem_width, 0);
49 penpos3(beamheight, 90);
50 penpos4(beamheight, 90);
51 penpos5(stem_width, 180);
54 z2l = (0, -stafflinethickness/2);
55 z3r = z2r + serif_size *(1,-1);
58 z5l = z3l + (-serif_size, -serif_protrude);
60 penlabels(1,2,3,4, 5);
61 fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
62 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
64 addto currentpicture also currentpicture yscaled -1;
66 addto currentpicture also currentpicture
67 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
72 def draw_neo_left_stemmed_head (expr wid) =
75 x6 = x7 = head_width - stem_width/2;
77 y7 = y5 - 2.25staff_space;
78 pickup pencircle scaled stem_width;
82 fet_beginchar("Left stemmed notehead", "lneo_mensural", "mensuralleftstemmedhead");
83 draw_neo_left_stemmed_head (brevis_wid#)
87 % Some sources (eg Musix/OpusTeX think that the appendage should be on
88 % the left, some say right. Right wins democratically.
90 def draw_neo_longa (expr wid) =
97 z6 - z7 = (stem_width/2, -staff_space);
98 theta = angle(z6-z7)+ 90;
99 penpos7(stem_width, theta);
100 penpos6(1.2 stem_width, theta);
102 fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
107 % En wij presenteren U: de opvolgster van Emily
111 fet_beginchar("Maxima notehead", "-3neo_mensural", "mensuralmaximahead");
112 draw_neo_longa (1.3 brevis_wid#)
115 fet_beginchar("Longa notehead", "-2neo_mensural", "mensurallongahead");
116 draw_neo_longa (brevis_wid#)
119 fet_beginchar("Brevis notehead", "-1neo_mensural", "mensuralbrevishead")
120 draw_neo_brevis(brevis_wid#);
123 def draw_neo_mensural_black_head (expr wid) =
126 set_char_box (0, head_width#, noteheight#/2, noteheight#/2);
130 x2 = x4 = (x1 + x3) /2;
131 define_pixels (head_width);
132 pickup pencircle scaled blot_diameter;
138 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
141 def draw_neo_mensural_open_head (expr wid)=
142 draw_neo_mensural_black_head (wid);
144 diamNW = length (z2 - z1) + blot_diameter;
145 diamSW = length (z4 - z1) + blot_diameter;
147 save hole_widthNW, hole_widthSW;
148 hole_widthNW = 0.34 diamNW ;
149 hole_widthSW + 2.6 stafflinethickness = diamSW;
151 (z7 + z5)/2 = (w/2, 0);
152 (z8 + z6)/2 = (w/2, 0);
153 (z6 - z5) = hole_widthNW * unitvector (z2 - z1);
154 (z7 - z6) = hole_widthSW * unitvector (z4 - z1);
156 labels (1,2,3,4,5,6,7,8);
158 unfill z5 -- z6 -- z7 -- z8 --cycle;
161 fet_beginchar("Neo-mensural open head","0neo_mensural","neomensuralsemibrevishead")
162 draw_neo_mensural_open_head (staff_space#);
165 fet_beginchar("Neo-mensural open head","1neo_mensural","neomensuralminimahead")
166 draw_neo_mensural_open_head (staff_space#);
169 fet_beginchar("Neo-mensural black head","2neo_mensural","neomensuralsemiminimahead")
170 draw_neo_mensural_black_head (staff_space#);
174 brevis_wid# := 1 staff_space#;
176 def draw_brevis (expr wid) =
177 % TODO. For the moment, fall back to draw_neo_brevis.
178 draw_neo_brevis(wid);
181 def draw_left_stemmed_head (expr wid) =
185 x6 = x7 = stem_width/2;
187 y7 = y5 - 2.25staff_space;
188 pickup pencircle scaled stem_width;
192 fet_beginchar("Left stemmed notehead", "lmensural", "mensuralleftstemmedhead");
193 draw_left_stemmed_head (brevis_wid#)
196 def draw_longa (expr wid) =
199 x6 = x7 = head_width - stem_width/2;
201 y7 = y5 - 2.25staff_space;
202 pickup pencircle scaled stem_width;
206 fet_beginchar("Maxima notehead", "-3mensural", "mensuralmaximahead");
207 draw_longa (2.0 brevis_wid#)
210 fet_beginchar("Longa notehead", "-2mensural", "mensurallongahead");
211 draw_longa (brevis_wid#)
214 fet_beginchar("Brevis notehead", "-1mensural", "mensuralbrevishead")
215 draw_brevis(brevis_wid#);
218 def draw_diamond_head (expr head_h, pen_w, pen_h, angle, open) =
219 save head_width, head_height;
220 head_height# = head_h;
221 head_width# / head_height# = tand(angle);
222 define_pixels(head_width, head_height);
224 set_char_box (0, head_width#,
225 head_height#/2, head_height#/2);
228 xscaled (min(blot_diameter, pen_w * head_width))
229 yscaled (min(blot_diameter, pen_h * head_width))
232 %% FIXME: replace "xpart (top z2)" (and, analogously,
233 %% "ypart (rt z3)") with an expression that really delivers the
234 %% x coordinate of the uppermost pixel that is drawn with respect
235 %% to the pencircle (this requires some elliptical computations).
236 %% MF obviously interprets "xpart (top z2)" as "top (xpart z2)",
237 %% i.e. "top x2", which is not what we want.
239 xpart (top z2) = ypart (rt z3) = 0;
240 top y2 = head_height/2;
241 rt x3 = head_width/2;
246 draw z1 -- z2 -- z3 -- z4 -- cycle;
248 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
251 currentpicture := currentpicture shifted (head_width/2, 0);
256 fet_beginchar("Mensural open head","0mensural","mensuralsemibrevishead")
257 draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
260 fet_beginchar("Mensural open head","1mensural","mensuralminimahead")
261 draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
264 fet_beginchar("Mensural black head","2mensural","mensuralsemiminimahead")
265 draw_diamond_head (staff_space#, 0.15, 0.30, 30, false);
273 % EDITIO VATICANA (including solesmes extensions)
278 % parameterized punctum
279 def punctum_char (expr verbose_name, internal_name, ly_name,
280 left_stem, right_stem, linea, cavum,
281 straight, auctum, direction_up, excentric, up_shift, mag) =
283 fet_beginchar(verbose_name, internal_name, ly_name)
285 a_b := 1.54; % b_h*a_b/a_w = wd/ht
289 save a, beta, ht, wd;
290 ht# = noteheight# * mag;
294 black_notehead_width# := wd#;
297 save direction, direction_sign;
304 direction_sign# = -1;
307 % convexity and excentricity
308 save u_convexity, u_excentricity;
310 u_convexity# = -0.01ht#;
311 u_excentricity# = 0.0ht#; % dummy
313 u_convexity# = -0.03ht#;
314 u_excentricity# = +0.25ht#;
316 u_convexity# = -0.05ht#;
317 u_excentricity# = 0.0ht#; % dummy
319 save convexity, excentricity;
320 convexity# = direction_sign# * u_convexity#;
321 excentricity# = direction_sign# * u_excentricity#;
331 define_pixels(convexity, excentricity, yoffs, ht, wd);
332 pickup pencircle scaled stafflinethickness;
335 save height, yoffs_bt;
336 define_pixels (height, yoffs_bt);
337 height# = max (0.5ht# - stafflinethickness#, 0);
338 yoffs_bt# = yoffs# - (height# - stafflinethickness#)/2 -
340 xpart z1a = xpart z1b;
341 xpart z2a = xpart z2b;
342 xpart z3a = xpart z3b;
343 ypart z1a + height = ypart z1b;
344 ypart z2a + height = ypart z2b;
345 ypart z3a + height = ypart z3b;
347 save box_top, box_bt;
350 z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
351 z2a = (0.20wd, yoffs_bt + 1.0*convexity);
352 z3a = (0.40wd - stafflinethickness/2,
353 yoffs_bt + 1.0*excentricity);
354 box_top# = height# + yoffs_bt# +
355 max(0, 1.0*convexity#, 1.0*excentricity#);
356 box_bt# = yoffs_bt# +
357 min(0, 1.0*convexity#, 1.0*excentricity#);
358 p = z1a .. {right}z2a .. {direction}z3a --
359 z3b{-direction} .. z2b{left} .. z1b -- cycle;
361 z1a = (0.00wd + stafflinethickness/2,
362 yoffs_bt - 1.0*convexity);
363 z2a = (0.08wd, yoffs_bt + 1.4*convexity);
364 z3a = (0.40wd - stafflinethickness/2, yoffs_bt);
365 box_top# = height# + yoffs_bt# +
366 max(-1.0*convexity#, 1.4*convexity#, 0);
367 box_bt# = yoffs_bt# +
368 min(-1.0*convexity#, 1.4*convexity#, 0);
369 p = z1a{direction} .. z2a{right} .. z3a --
370 z3b .. {left}z2b .. {-direction}z1b -- cycle;
372 z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
373 z2a = (0.20wd, yoffs_bt + 1.0*convexity);
374 z3a = (0.40wd - stafflinethickness/2, yoffs_bt);
375 box_top# = height# + yoffs_bt# +
376 max(0, 1.0*convexity#);
377 box_bt# = yoffs_bt# +
378 min(0, 1.0*convexity#);
379 p = z1a .. z2a .. z3a --
380 z3b .. z2b .. z1b -- cycle;
389 pickup pencircle scaled stafflinethickness;
392 z5=(0.00wd + stafflinethickness/2, yoffs);
393 z6=(0.00wd + stafflinethickness/2, yoffs - 1.5ht);
398 z5=(0.40wd - stafflinethickness/2, yoffs);
399 z6=(0.40wd - stafflinethickness/2, yoffs - 1.5ht);
405 if left_stem or right_stem:
406 stem_bt# = yoffs# - 1.5ht#;
411 set_char_box(0.00wd#, 0.40wd#,
412 max(0, -box_bt#, -stem_bt#) + stafflinethickness#/2,
413 max(0, box_top#) + stafflinethickness#/2);
416 save linea_width, linea_height;
417 linea_width# = stafflinethickness#;
418 linea_height# = 0.85 ht#;
419 define_pixels (linea_width, linea_height);
420 draw_block ((-0.10wd - linea_width/2,
422 (-0.10wd + linea_width/2,
424 draw_block ((+0.50wd - linea_width/2,
426 (+0.50wd + linea_width/2,
428 set_char_box(0.10wd# + linea_width#/2,
429 0.50wd# + linea_width#/2,
436 % parameterized punctum inclinatum
437 def inclinatum_char(expr verbose_name, internal_name, ly_name,
438 small, stropha, auctum) =
440 fet_beginchar(verbose_name, internal_name, ly_name)
444 ht# = 0.50 noteheight#;
446 ht# = 0.80 noteheight#;
449 draw_diamond_head (ht#, 0, 0, alpha#, false);
453 xscaled (0.2*head_height)
454 yscaled (0.5*head_height)
456 save za, off_angle; pair za;
458 za = (0, -0.25*head_height)
459 rotated -(alpha# + off_angle)
460 shifted (0.5 head_width, 0);
465 pickup pencircle scaled stafflinethickness;
468 za = (0, -0.5 head_height + stafflinethickness);
469 zb = za + (0.5 head_width, 0);
470 draw za{(0,-1) rotated alpha#} ..
471 {(0,1) rotated -alpha#}zb;
477 punctum_char("Ed. Vat. punctum", "vaticana_punctum", "vatpunctumhead",
478 false, false, false, false, false,
479 false, false, false, false, 1.0);
481 % punctum cavum (for OpusTeX compatibility)
482 punctum_char("Ed. Vat. punctum cavum", "vaticana_punctum_cavum",
483 "vatpunctumcavumhead",
484 false, false, false, true, false,
485 false, false, false, false, 1.0);
487 % linea punctum (for OpusTeX compatibility)
488 punctum_char("Ed. Vat. linea punctum", "vaticana_linea_punctum",
489 "vatlineapunctumhead",
490 false, false, true, false, false,
491 false, false, false, false, 1.0);
493 % linea punctum cavum (for OpusTeX compatibility)
494 punctum_char("Ed. Vat. linea punctum cavum", "vaticana_linea_punctum_cavum",
495 "vatlineapunctumcavumhead",
496 false, false, true, true, false,
497 false, false, false, false, 1.0);
500 inclinatum_char("Ed. Vat. inclinatum", "vaticana_inclinatum",
502 false, false, false);
504 % virga (i.e. right stemmed punctum)
505 punctum_char("Ed. Vat. virga", "vaticana_virga", "vatvirgahead",
506 false, true, false, false, false,
507 false, false, false, false, 1.0);
509 % left stemmed punctum as used in clivis (flexa) ligature
510 punctum_char("Ed. Vat. reverse virga", "vaticana_rvirga", "vatrvirgahead",
511 true, false, false, false, false,
512 false, false, false, false, 1.0);
515 punctum_char("Ed. Vat. pes lower punctum", "vaticana_lpes", "vatlpeshead",
516 false, false, false, false, true,
517 false, true, false, false, 1.0);
520 punctum_char("Ed. Vat. pes upper punctum", "vaticana_upes", "vatupeshead",
521 false, false, false, false, true,
522 false, false, false, false, 1.0);
524 % pes upper punctum (shifted variation)
526 % Note: This note head is used instead of the regular pes upper
527 % punctum to avoid collision with the lower punctum note of the pes when
528 % the upper punctum sits directly on top of the lower punctum.
530 punctum_char("Ed. Vat. var pes upper punctum", "vaticana_vupes",
532 false, false, false, false, true,
533 false, false, false, true, 1.0);
535 % small punctum as used in epiphonus
536 punctum_char("Ed. Vat. plica", "vaticana_plica", "vatplicahead",
537 false, false, false, false, false,
538 false, false, false, false, 0.7);
540 % excentric punctum as used in epiphonus
541 punctum_char("Ed. Vat. epiphonus", "vaticana_epiphonus", "vatepiphonushead",
542 false, false, false, false, false,
543 false, true, true, false, 1.0);
545 % small punctum as used in cephalicus
546 punctum_char("Ed. Vat. rev. plica", "vaticana_reverse_plica", "vatrplicahead",
547 false, false, false, false, false,
548 false, true, false, false, 0.7);
550 % excentric punctum as used in cephalicus
551 punctum_char("Ed. Vat. cephalicus", "vaticana_cephalicus",
553 true, false, false, false, false,
554 false, false, true, false, 1.0);
557 fet_beginchar("Ed. Vat. quilisma", "vaticana_quilisma", "vatquilismahead")
559 a_b:=1.54; % b_h*a_b/a_w = wd/ht
563 save a, beta, ht, wd;
568 set_char_box(0, 0.40wd#, 0.31 ht#, 0.41 ht#);
569 black_notehead_width# := wd#;
571 define_pixels(ht, wd);
572 pickup pencircle xscaled stafflinethickness yscaled 0.4ht;
573 lft x1 = 0.00wd; bot y1 = -0.31ht;
574 lft x2 = 0.00wd; y2 = +0.06ht;
575 x3 = 0.10wd; y3 = -0.05ht;
576 x4 = 0.16wd; y4 = +0.11ht;
577 x5 = 0.24wd; y5 = -0.01ht;
578 x6 = 0.30wd; y6 = +0.15ht;
579 rt x7 = 0.40wd; y7 = +0.04ht;
580 rt x8 = 0.40wd; top y8 = +0.41ht;
581 draw z1 -- z2 -- z3 -- z4 -- z5 -- z6 -- z7 -- z8;
584 % solesmes punctum inclinatum parvum
585 inclinatum_char("Solesmes punctum inclinatum parvum", "solesmes_incl_parvum",
589 % solesmes punctum auctum ascendens
590 punctum_char("Solesmes punctum auctum ascendens", "solesmes_auct_asc",
592 false, false, false, false, false,
593 true, true, false, false, 1.0);
595 % solesmes punctum auctum descendens
596 punctum_char("Solesmes punctum auctum descendens", "solesmes_auct_desc",
598 false, false, false, false, false,
599 true, false, false, false, 1.0);
601 % solesmes punctum inclinatum auctum
602 inclinatum_char("Solesmes punctum incl. auctum", "solesmes_incl_auctum",
603 "solpunctuminclinatumauctumhead",
607 inclinatum_char("Solesmes stropha", "solesmes_stropha",
611 % solesmes stropha aucta
612 inclinatum_char("Solesmes stropha aucta", "solesmes_stropha_aucta",
613 "solstrophaauctahead",
617 fet_beginchar("Solesmes oriscus", "solesmes_oriscus",
620 a_b := 1.54; % b_h*a_b/a_w = wd/ht
624 save a, beta, ht, wd;
629 black_notehead_width# := wd#;
632 convexity# = +0.05ht#;
634 define_pixels(ht, wd, convexity);
635 pickup pencircle xscaled blot_diameter yscaled 0.50ht;
636 lft x1 = 0.00wd; y1 = -convexity;
637 x2 = 0.16wd; y2 = +convexity;
638 x3 = 0.33wd; y3 = -convexity;
639 rt x4 = 0.50wd; y4 = +convexity;
640 draw z1 .. z2 .. z3 .. z4;
641 set_char_box(0.00wd#, 0.50wd#,
642 0.25ht# + convexity#, 0.25ht# + convexity#);
655 fet_beginchar("Ed. Med. inclinatum", "medicaea_inclinatum",
657 draw_diamond_head (1.2staff_space#, 0, 0, 35, false);
660 % parametrized punctum
661 def punctum_char (expr verbose_name, internal_name, ly_name,
662 left_up_stem, left_down_stem) =
664 fet_beginchar(verbose_name, internal_name, ly_name)
666 save a, beta, ht, wd;
667 ht# = 2 staff_space#;
669 black_notehead_width# := wd#;
671 define_pixels(ht, wd);
673 xscaled blot_diameter
675 z1 = (0.00wd + blot_diameter/2, 0);
676 z2 = (0.40wd - blot_diameter/2, 0);
680 xscaled stafflinethickness
681 yscaled blot_diameter;
684 z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
685 z5=(0.00wd + stafflinethickness/2, - 1.25ht);
687 set_char_box(0.0, 0.4wd#, 1.25ht#, 0.25ht#);
689 z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
690 z5=(0.00wd + stafflinethickness/2, + 1.25ht);
692 set_char_box(0.0, 0.4wd#, 0.25ht#, 1.25ht#);
694 set_char_box(0.0, 0.4wd#, 0.25ht#, 0.25ht#);
701 punctum_char("Ed. Med. punctum", "medicaea_punctum", "medpunctumhead",
704 % left up-stemmed punctum
705 punctum_char("Ed. Med. reverse virga", "medicaea_rvirga", "medrvirgahead",
708 % virga (i.e. left down-stemmed punctum)
709 punctum_char("Ed. Med. virga", "medicaea_virga", "medvirgahead",
722 % parametrized punctum
723 def punctum_char (expr verbose_name, internal_name, ly_name,
725 fet_beginchar(verbose_name, internal_name, ly_name)
728 draw_diamond_head (staff_space#, 0, 0, alpha#, false);
731 xscaled blot_diameter
732 yscaled (0.7*staff_space)
734 save za, zb; pair za, zb;
735 za = (head_width/2, 0);
736 bot zb = (head_width/2, -1.5staff_space);
738 set_char_box (0, head_width#,
739 1.5staff_space#, head_height#/2);
745 punctum_char("Hufnagel punctum", "hufnagel_punctum", "hufpunctumhead", false)
748 punctum_char("Hufnagel virga", "hufnagel_virga", "hufvirgahead", true)
751 fet_beginchar("Hufnagel pes lower punctum", "hufnagel_lpes", "huflpeshead")
752 save width, height, alpha;
753 width# = 2*staff_space#;
754 height# = 0.7*staff_space#;
757 set_char_box(0, width#, height#/2, height#/2);
759 pickup pencircle scaled stafflinethickness;
760 define_pixels(width, height);
762 rt x3 = -lft x1 = width/2;
765 tand(alpha#) * (y2 - y1) = x2 - x1 = x3 - x4;
767 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
769 currentpicture := currentpicture shifted (width/2, 0);
772 fet_endgroup ("noteheads")