2 % feta-bolletjes.mf -- implement noteheads
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 1997--2002 Jan Nieuwenhuizen <janneke@gnu.org>
7 % & Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 % & Juergen Reuter <reuter@ipd.uka.de>
12 % most beautiful noteheads are pronounced, not circular,
13 % and not even symmetric.
14 % These examples are inspired by [Wanske], see literature list
17 save black_notehead_width;
18 numeric black_notehead_width;
20 fet_begingroup("noteheads");
22 noteheight#:=staff_space#+ (1 + overdone_heads) *stafflinethickness#;
23 define_pixels(noteheight);
34 brevis_wid# := 2 staff_space#;
36 def draw_brevis(expr brevwid) =
37 save beamheight, head_width;
38 save holeheight, stem_width;
39 save serif_size, serif_protrude;
41 head_width# = brevwid;
42 holeheight = 3 stafflinethickness;
43 stem_width = 1.4 stafflinethickness;
46 define_pixels(head_width);
47 set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
49 2 beamheight + holeheight = noteheight;
50 serif_size = (holeheight - stafflinethickness)/2;
51 serif_protrude = 1.5 serif_size;
52 penpos1(stem_width, 0);
53 penpos2(stem_width, 0);
54 penpos3(beamheight, 90);
55 penpos4(beamheight, 90);
56 penpos5(stem_width, 180);
59 z2l = (0, -stafflinethickness/2);
60 z3r = z2r + serif_size *(1,-1);
63 z5l = z3l + (-serif_size, -serif_protrude);
65 penlabels(1,2,3,4, 5);
66 fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
67 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
69 addto currentpicture also currentpicture yscaled -1;
71 addto currentpicture also currentpicture
72 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
78 % Some sources (eg Musix/OpusTeX think that the appendage should be on
79 % the left, some say right. Right wins democratically.
81 def draw_longa (expr wid) =
88 z6 - z7 = (stem_width/2, -staff_space);
89 theta = angle(z6-z7)+ 90;
90 penpos7(stem_width, theta);
91 penpos6(1.2 stem_width, theta);
93 fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
98 % En wij presenteren U: de opvolgster van Emily
102 fet_beginchar("Maxima notehead", "-3mensural", "mensuralmaximahead");
103 draw_longa (1.3 brevis_wid#)
106 fet_beginchar("Longa notehead", "-2mensural", "mensurallongahead");
107 draw_longa (brevis_wid#)
110 fet_beginchar("Brevis notehead", "-1mensural", "mensuralbrevishead")
111 draw_brevis(brevis_wid#);
114 def draw_neo_mensural_black_head (expr wid) =
117 set_char_box (0, head_width#, noteheight#/2, noteheight#/2);
121 x2 = x4 = (x1 + x3) /2;
122 define_pixels (head_width);
123 pickup pencircle scaled blot_diameter;
129 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
132 def draw_neo_mensural_open_head (expr wid)=
133 draw_neo_mensural_black_head (wid);
135 diamNW = length (z2 - z1) + blot_diameter;
136 diamSW = length (z4 - z1) + blot_diameter;
138 save hole_widthNW, hole_widthSW;
139 hole_widthNW = 0.34 diamNW ;
140 hole_widthSW + 2.6 stafflinethickness = diamSW;
142 (z7 + z5)/2 = (w/2, 0);
143 (z8 + z6)/2 = (w/2, 0);
144 (z6 - z5) = hole_widthNW * unitvector (z2 - z1);
145 (z7 - z6) = hole_widthSW * unitvector (z4 - z1);
147 labels (1,2,3,4,5,6,7,8);
149 unfill z5 -- z6 -- z7 -- z8 --cycle;
152 fet_beginchar("Neo-mensural open head","0neo_mensural","neomensuralminimhead")
153 draw_neo_mensural_open_head (staff_space#);
156 fet_beginchar("Neo-mensural open head","1neo_mensural","neomensuralsemiminimhead")
157 draw_neo_mensural_open_head (staff_space#);
160 fet_beginchar("Neo-mensural black head","2neo_mensural","neofusahead")
161 draw_neo_mensural_black_head (staff_space#);
165 def draw_mensural_head (expr wid, open) =
168 set_char_box (head_width#/2, head_width#/2,
169 noteheight#/2, noteheight#/2);
171 define_pixels(head_width, noteheight);
174 y1 = x2 = y3 = x4 = 0;
176 y2 = 1.4 noteheight/2;
180 xscaled 0.15 head_width
181 yscaled 0.30 head_width
184 % pencircle width correction
185 save zc, zd; pair zc, zd;
186 zc = (+0.150 head_width * sind(30), +0.150 head_width * cosd(30));
187 zd = (+0.075 head_width * sind(30), -0.075 head_width * cosd(30));
190 draw (z1+zc+zd) -- (z2-zc+zd) --
191 (z3-zc-zd) -- (z4+zc-zd) -- cycle;
193 filldraw (z1+zc+zd) -- (z2-zc+zd) --
194 (z3-zc-zd) -- (z4+zc-zd) -- cycle;
199 fet_beginchar("Mensural open head","0mensural","mensuralminimhead")
200 draw_mensural_head (staff_space#, true);
203 fet_beginchar("Mensural open head","1mensural","mensuralsemiminimhead")
204 draw_mensural_head (staff_space#, true);
207 fet_beginchar("Mensural black head","2mensural","fusahead")
208 draw_mensural_head (staff_space#, false);
215 % ledger (leger) lines
217 fet_beginchar("Ledger ending", "ledgerending", "ledgerending")
218 set_char_box (5/2 ledgerlinethickness#, 5/2 ledgerlinethickness#,
219 ledgerlinethickness#/2,ledgerlinethickness#/2);
220 pickup pencircle scaled 1.3 blot_diameter;
232 filldraw z1 --- z2 --- z3 --- z4 --- cycle ;
240 % EDITIO VATICANA (including solesmes extensions)
245 % parameterized punctum
246 def punctum_char (expr verbose_name, internal_name, mudela_name,
247 left_stem, right_stem, linea, cavum,
248 straight, auctum, direction_up, excentric, up_shift, mag) =
250 fet_beginchar(verbose_name, internal_name, mudela_name)
252 a_b := 1.54; % b_h*a_b/a_w = wd/ht
256 save a, beta, ht, wd;
257 ht# = noteheight# * mag;
261 set_char_box(0.50wd#, 0.10wd#, 0.5ht#, 0);
262 black_notehead_width# := wd#;
265 save direction, direction_sign;
272 direction_sign# = -1;
275 % convexity and excentricity
276 save u_convexity, u_excentricity;
278 u_convexity# = -0.01ht#;
279 u_excentricity# = 0.0ht#; % dummy
281 u_convexity# = -0.03ht#;
282 u_excentricity# = +0.25ht#;
284 u_convexity# = -0.05ht#;
285 u_excentricity# = 0.0ht#; % dummy
287 save convexity, excentricity;
288 convexity# = direction_sign# * u_convexity#;
289 excentricity# = direction_sign# * u_excentricity#;
299 define_pixels(convexity, excentricity, yoffs, ht, wd);
300 pickup pencircle scaled stafflinethickness;
303 save height, yoffs_bt;
304 define_pixels (height, yoffs_bt);
305 height# = max (0.5ht# - stafflinethickness#, 0);
306 yoffs_bt# = yoffs# - (height# - stafflinethickness#)/2 -
308 xpart z1a = xpart z1b;
309 xpart z2a = xpart z2b;
310 xpart z3a = xpart z3b;
311 ypart z1a + height = ypart z1b;
312 ypart z2a + height = ypart z2b;
313 ypart z3a + height = ypart z3b;
316 z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
317 z2a = (0.20wd, yoffs_bt + 1.0*convexity);
318 z3a = (0.40wd - stafflinethickness/2,
319 yoffs_bt + 1.0*excentricity);
320 p = z1a .. {right}z2a .. {direction}z3a --
321 z3b{-direction} .. z2b{left} .. z1b -- cycle;
323 z1a = (0.00wd + stafflinethickness/2,
324 yoffs_bt - 1.0*convexity);
325 z2a = (0.08wd, yoffs_bt + 1.4*convexity);
326 z3a = (0.40wd - stafflinethickness/2, yoffs_bt);
327 p = z1a{direction} .. z2a{right} .. z3a --
328 z3b .. {left}z2b .. {-direction}z1b -- cycle;
330 z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
331 z2a = (0.20wd, yoffs_bt + 1.0*convexity);
332 z3a = (0.40wd - stafflinethickness/2, yoffs_bt);
333 p = z1a .. z2a .. z3a --
334 z3b .. z2b .. z1b -- cycle;
344 pickup pencircle scaled stafflinethickness;
347 z5=(0.00wd + stafflinethickness/2, yoffs);
348 z6=(0.00wd + stafflinethickness/2, yoffs - 1.5ht);
353 z5=(0.40wd - stafflinethickness/2, yoffs);
354 z6=(0.40wd - stafflinethickness/2, yoffs - 1.5ht);
359 save linea_width, linea_height;
360 linea_width# = stafflinethickness#;
361 linea_height# = 0.85 ht#;
362 define_pixels (linea_width, linea_height);
363 draw_block ((-0.10wd - linea_width/2,
364 yoffs - linea_height/2),
365 (-0.10wd + linea_width/2,
366 yoffs + linea_height/2));
367 draw_block ((+0.50wd - linea_width/2,
368 yoffs - linea_height/2),
369 (+0.50wd + linea_width/2,
370 yoffs + linea_height/2));
375 % parameterized punctum inclinatum
376 def inclinatum_char(expr verbose_name, internal_name, mudela_name,
377 small, stropha, auctum) =
379 fet_beginchar(verbose_name, internal_name, mudela_name)
382 a_b := 1.54; % b_h*a_b/a_w = wd/ht
386 save a, beta, ht, wd;
391 set_char_box(0.3wd#, 0.3wd#, 0.5 ht#, 0.5 ht#);
392 black_notehead_width# := wd#;
394 save za, alpha, size;
397 define_pixels(ht, wd);
408 xscaled blot_diameter
409 yscaled size rotated -alpha;
410 za = (0, size - blot_diameter/2) / 2 rotated alpha;
416 yscaled size rotated alpha;
417 save za, off_angle; pair za;
419 za = (0, -size) / 2 rotated -(alpha + off_angle);
424 pickup pencircle scaled stafflinethickness;
427 za = ((0, -size) rotated -alpha) +
428 (0, stafflinethickness/2);
431 draw za{(0,-1) rotated alpha} ..
432 {(0,1) rotated -alpha}zb;
438 punctum_char("Ed. Vat. punctum", "0vaticana_punctum", "vatpunctumhead",
439 false, false, false, false, false,
440 false, false, false, false, 1.0);
442 % punctum cavum (for OpusTeX compatibility)
443 %punctum_char("Ed. Vat. punctum cavum", "0vaticana_punctum_cavum",
444 % "vatpunctumcavumhead",
445 % false, false, false, true, false,
446 % false, false, false, false, 1.0);
448 % linea punctum (for OpusTeX compatibility)
449 %punctum_char("Ed. Vat. linea punctum", "0vaticana_linea_punctum",
450 % "vatlineapunctumhead",
451 % false, false, true, false, false,
452 % false, false, false, false, 1.0);
454 % linea punctum cavum (for OpusTeX compatibility)
455 %punctum_char("Ed. Vat. linea punctum cavum", "0vaticana_linea_punctum_cavum",
456 % "vatlineapunctumcavumhead",
457 % false, false, true, true, false,
458 % false, false, false, false, 1.0);
461 inclinatum_char("Ed. Vat. inclinatum", "0vaticana_inclinatum",
463 false, false, false);
465 % virga (i.e. right stemmed punctum)
466 punctum_char("Ed. Vat. virga", "0vaticana_virga", "vatvirgahead",
467 false, true, false, false, false,
468 false, false, false, false, 1.0);
470 % left stemmed punctum as used in clivis (flexa) ligature
471 punctum_char("Ed. Vat. reverse virga", "0vaticana_rvirga", "vatrvirgahead",
472 true, false, false, false, false,
473 false, false, false, false, 1.0);
476 punctum_char("Ed. Vat. pes lower punctum", "0vaticana_lpes", "vatlpeshead",
477 false, false, false, false, true,
478 false, true, false, false, 1.0);
481 punctum_char("Ed. Vat. pes upper punctum", "0vaticana_upes", "vatupeshead",
482 false, false, false, false, true,
483 false, false, false, false, 1.0);
485 % pes upper punctum (shifted variation)
487 % Note: This note head is used instead of the regular pes upper
488 % punctum to avoid collision with the lower punctum note of the pes when
489 % the upper punctum sits directly on top of the lower punctum.
491 punctum_char("Ed. Vat. var pes upper punctum", "0vaticana_vupes",
493 false, false, false, false, true,
494 false, false, false, true, 1.0);
496 % small punctum as used in epiphonus/cephalicus
497 punctum_char("Ed. Vat. plica", "0vaticana_plica", "vatplicahead",
498 false, false, false, false, true,
499 false, false, false, false, 0.5);
501 % excentric punctum as used in epiphonus
502 punctum_char("Ed. Vat. epiphonus", "0vaticana_epiphonus", "vatepiphonushead",
503 false, false, false, false, false,
504 false, true, true, false, 1.0);
506 % excentric punctum as used in cephalicus
507 punctum_char("Ed. Vat. cephalicus", "0vaticana_cephalicus",
509 false, false, false, false, false,
510 false, false, true, false, 1.0);
513 fet_beginchar("Ed. Vat. quilisma", "0vaticana_quilisma", "vatquilismahead")
515 a_b:=1.54; % b_h*a_b/a_w = wd/ht
519 save a, beta, ht, wd;
524 set_char_box(0.4wd#, 0.00wd#, 0.5 ht#, 0.5 ht#);
525 black_notehead_width# := wd#;
527 define_pixels(ht, wd);
528 pickup pencircle xscaled stafflinethickness yscaled 0.4ht;
529 z1 = (0.00wd, -0.11ht);
530 z2 = (0.00wd, +0.06ht);
531 z3 = (0.10wd, -0.05ht);
532 z4 = (0.16wd, +0.11ht);
533 z5 = (0.24wd, -0.01ht);
534 z6 = (0.30wd, +0.15ht);
535 z7 = (0.40wd, +0.04ht);
536 z8 = (0.40wd, +0.21ht);
537 draw z1 -- z2 -- z3 -- z4 -- z5 -- z6 -- z7 -- z8;
540 % solesmes punctum inclinatum parvum
541 %inclinatum_char("Solesmes punctum inclinatum parvum", "0solesmes_incl_parvum",
542 % "solinclparvumhead",
543 % true, false, false);
545 % solesmes punctum auctum ascendens
546 %punctum_char("Solesmes punctum auctum ascendens", "0solesmes_auct_asc",
548 % false, false, false, false, false,
549 % true, true, false, false, 1.0);
551 % solesmes punctum auctum descendens
552 %punctum_char("Solesmes punctum auctum descendens", "0solesmes_auct_desc",
554 % false, false, false, false, false,
555 % true, false, false, false, 1.0);
557 % solesmes punctum inclinatum auctum
558 %inclinatum_char("Solesmes punctum incl. auctum", "0solesmes_incl_auctum",
559 % "solpunctuminclinatumauctumhead",
560 % false, false, true);
563 %inclinatum_char("Solesmes stropha", "0solesmes_stropha",
565 % false, true, false);
567 % solesmes stropha aucta
568 %inclinatum_char("Solesmes stropha aucta", "0solesmes_stropha_aucta",
569 % "solstrophaauctahead",
570 % false, true, true);
573 fet_beginchar("Solesmes oriscus", "0solesmes_oriscus",
576 a_b := 1.54; % b_h*a_b/a_w = wd/ht
580 save a, beta, ht, wd;
581 ht# = noteheight# * mag;
585 set_char_box(0.5wd#, 0.0wd#, 0.5ht#, 0.5ht#);
586 black_notehead_width# := wd#;
589 convexity# = +0.05ht#;
591 define_pixels(ht, wd, convexity);
592 pickup pencircle xscaled blot_diameter yscaled 0.50ht;
593 z1 = (0.00wd, -convexity);
594 z2 = (0.16wd, +convexity);
595 z3 = (0.33wd, -convexity);
596 z4 = (0.50wd, +convexity);
597 draw z1 .. z2 .. z3 .. z4;
610 fet_beginchar("Ed. Med. inclinatum", "0medicaea_inclinatum",
613 a_b := 1.54; % b_h*a_b/a_w = wd/ht
617 save a, beta, ht, wd;
622 set_char_box(wd#/2, wd#/2, 0.5 ht#, 0.5 ht#);
623 black_notehead_width# := wd#;
625 save za, alpha, size;
627 define_pixels(ht, wd);
631 xscaled blot_diameter
632 yscaled size rotated -alpha;
633 za = (0, size) / 2 rotated alpha;
638 % parametrized punctum
639 def punctum_char (expr verbose_name, internal_name, mudela_name,
640 left_up_stem, left_down_stem) =
642 fet_beginchar(verbose_name, internal_name, mudela_name)
644 save a, beta, ht, wd;
645 ht# = 2 staff_space#;
647 set_char_box(0.0, 0.4wd#, 0.5ht#, 0.5ht#);
648 black_notehead_width# := wd#;
650 define_pixels(ht, wd);
652 xscaled blot_diameter
654 z1 = (0.00wd + blot_diameter/2, 0);
655 z2 = (0.40wd - blot_diameter/2, 0);
659 xscaled stafflinethickness
660 yscaled blot_diameter;
663 z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
664 z5=(0.00wd + stafflinethickness/2, - 1.25ht);
667 z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
668 z5=(0.00wd + stafflinethickness/2, + 1.25ht);
676 punctum_char("Ed. Med. punctum", "0medicaea_punctum", "medpunctumhead",
679 % left up-stemmed punctum
680 punctum_char("Ed. Med. reverse virga", "0medicaea_rvirga", "medrvirgahead",
683 % virga (i.e. left down-stemmed punctum)
684 punctum_char("Ed. Med. virga", "0medicaea_virga", "medvirgahead",
697 % parametrized punctum
698 def punctum_char (expr verbose_name, internal_name, mudela_name,
701 fet_beginchar(verbose_name, internal_name, mudela_name)
703 a_b := 1.54; % b_h*a_b/a_w = wd/ht
707 save a, beta, ht, wd;
712 set_char_box(wd#/2, wd#/2, 0.5 ht#, 0.5 ht#);
713 black_notehead_width# := wd#;
715 save za, zb, zc, alpha, size;
717 define_pixels(ht, wd);
721 xscaled blot_diameter
722 yscaled size rotated -alpha;
723 za = (0, size) / 2 rotated alpha;
728 zc = (0.00wd, - 1.25ht);
735 punctum_char("Hufnagel punctum", "0hufnagel_punctum", "hufpunctumhead", false)
738 punctum_char("Hufnagel virga", "0hufnagel_virga", "hufvirgahead", true)
741 fet_beginchar("Hufnagel pes lower punctum", "0hufnagel_lpes", "huflpeshead")
743 a_b := 1.54; % b_h*a_b/a_w = wd/ht
747 save a, beta, ht, wd;
752 set_char_box(wd#, wd#, 0.7 ht#, 0.7 ht#);
753 black_notehead_width# := wd#;
755 save za, alpha, size;
757 define_pixels(ht, wd);
761 xscaled blot_diameter
762 yscaled size rotated -alpha;
767 fet_endgroup("noteheads");
768 define_pixels(black_notehead_width);