1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-clefs.mf -- implement ancient clefs
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 2001--2006 Juergen Reuter <reuter@ipd.uka.de>
9 fet_begingroup ("clefs")
14 % Each clef is associated with a particular pitch: the treble clef
15 % with the `g', the alto clef with the `c', the bass clef with the
16 % `f', etc. The shape of each clef character defines a vertical
17 % position that is assumed to represent this pitch. For the treble
18 % clef, it is the vertical position of the center of the spiral
19 % ending that represents the 'g' pitch. For the bass clef, it is
20 % the center between the two fat dots that define the vertical
21 % position of the 'f' pitch. For the alto clef, it is the vertical
22 % center of the clef that is aligned with the 'c' pitch. For each
23 % clef character, this center should be vertically aligned with the
24 % point (0, 0). The horizontal alignment of each clef character
25 % should be such that the vertical line through the point (0, 0)
26 % touches the left-most edge of the clef.
28 % TODO: document exact_center
30 % set_char_box() conventions:
32 % * breapth: Ignored (as far as I know). Should be set to 0.
34 % * width: Should match the clef's width.
36 % * depth: Should match the bottom edge of the clef. Affects vertical
39 % * height: Should match the top edge of the clef. Affects vertical
52 def draw_vaticana_do_clef (expr exact_center, reduction) =
55 reduced_il# = staff_space# * reduction;
57 set_char_box (0 - xpart exact_center,
58 0.5 reduced_il# + xpart exact_center,
59 0.8 reduced_il# - ypart exact_center,
60 0.8 reduced_il# + ypart exact_center);
62 define_pixels (reduced_il);
64 save pat, ellipse, clef;
65 path pat, ellipse, clef;
67 pickup pencircle xscaled 0.6 linethickness
68 yscaled 0.6 reduced_il;
70 ellipse := reverse fullcircle xscaled 0.6 linethickness
71 yscaled 0.6 reduced_il;
75 xoffs# = xpart exact_center;
76 yoffs# = ypart exact_center;
78 define_pixels (xoffs, yoffs);
80 rt z11 = (xoffs + 0.50 reduced_il, yoffs - .45 reduced_il);
81 z12 = (xoffs + 0.25 reduced_il, yoffs - .50 reduced_il);
82 lft z13 = (xoffs + 0.00 reduced_il, yoffs - .28 reduced_il);
83 lft z14 = (xoffs, yoffs);
93 % adjust vertically to fit into bounding box
94 shift = find_tangent_shift (((0, -d + 0.3 reduced_il)
95 -- (w, -d + 0.3 reduced_il)), pat,
96 (0, -d / 2), (0, d / 2));
97 pat := pat shifted shift;
100 .. top (point 1 of pat)
101 .. get_subpath (ellipse,
102 -direction 0 of pat, direction 0 of pat,
104 .. bot (point 1 of pat)
105 .. get_subpath (ellipse,
106 direction 2 of pat, up,
110 -- reverse clef yscaled -1
113 labels (11, 12, 13, 14);
117 fet_beginchar ("Ed. Vat. do clef", "vaticana.do");
119 draw_staff (-1, 3, 0.0);
121 draw_vaticana_do_clef ((0, 0), 1.0);
125 fet_beginchar ("Ed. Vat. do clef", "vaticana.do_change");
126 draw_vaticana_do_clef ((0, 0), 1.0); % no reduction
130 def draw_vaticana_fa_clef (expr exact_center, reduction) =
131 save reduced_il, xoffs, yoffs;
133 reduced_il# = staff_space# * reduction;
134 xoffs# = xpart exact_center;
135 yoffs# = ypart exact_center;
137 define_pixels (reduced_il, xoffs, yoffs);
139 % left-handed punctum
140 pickup pencircle xscaled 0.6 linethickness
141 yscaled 0.5 reduced_il;
146 ellipse := reverse fullcircle xscaled 0.6 linethickness
147 yscaled 0.5 reduced_il;
149 lft z21 = (xoffs + 0.00 reduced_il, yoffs + 0.00 reduced_il);
150 z22 = (xoffs + 0.25 reduced_il, yoffs + 0.05 reduced_il);
151 rt z23 = (xoffs + 0.50 reduced_il, yoffs - 0.05 reduced_il);
157 fill get_subpath (ellipse,
158 -direction 0 of pat, direction 0 of pat, z21)
160 .. get_subpath (ellipse,
161 direction 2 of pat, -direction 2 of pat, z23)
166 pickup pencircle scaled 0.6 linethickness;
169 yoffs = bot y24 + 1.5 reduced_il;
171 draw_rounded_block (bot lft z24, top rt z23, 0.6 linethickness);
173 labels (21, 22, 23, 24);
175 % right-handed puncta as in do clef
176 draw_vaticana_do_clef (exact_center + (0.55 reduced_il#, 0),
179 set_char_box (0 - xpart exact_center,
180 1.05 reduced_il# + xpart exact_center,
181 1.5 reduced_il# - ypart exact_center,
182 0.8 reduced_il# + ypart exact_center);
186 fet_beginchar ("Ed. Vat. fa clef", "vaticana.fa");
188 draw_staff (-1, 3, 0.0);
190 draw_vaticana_fa_clef ((0, 0), 1.0);
194 fet_beginchar ("Ed. Vat. fa clef", "vaticana.fa_change");
195 draw_vaticana_fa_clef ((0, 0), 1.0); % no reduction
207 def draw_medicaea_do_clef (expr exact_center, reduction) =
208 save reduced_il, reduced_slt;
210 reduced_il# = staff_space# * reduction;
211 reduced_slt# = linethickness# * reduction;
213 define_pixels (reduced_il);
214 define_pixels (reduced_slt);
216 set_char_box (0 - xpart exact_center,
217 1.0 reduced_il# + xpart exact_center,
218 1.5 reduced_il# - ypart exact_center,
219 1.5 reduced_il# + ypart exact_center);
223 flag_height# = 0.5 reduced_il#;
225 define_pixels (flag_height);
229 xoffs# = xpart exact_center;
230 yoffs# = ypart exact_center;
232 define_pixels (xoffs, yoffs);
235 pickup pencircle xscaled reduced_slt
241 ellipse := reverse fullcircle xscaled reduced_slt
244 xoffs = lft x1 = rt x2 - reduced_il;
245 y1 = yoffs + 0.5 (reduced_il - flag_height - staff_space);
246 y2 = y1 - reduced_il + flag_height;
249 -- get_subpath (ellipse, z2 - z1, z1 - z2, z2)
253 xoffs = lft x3 = rt x4 - reduced_il;
254 y3 = yoffs + 0.5 (reduced_il - flag_height + staff_space);
255 y4 = y3 - reduced_il + flag_height;
258 -- get_subpath (ellipse, z4 - z3, z3 - z4, z4)
263 pickup pencircle scaled reduced_slt;
265 lft x5 = lft x6 = xoffs;
266 yoffs = top y6 - 1.5 reduced_il = bot y5 + 1.5 reduced_il;
268 draw_rounded_block (bot lft z5, top rt z6, reduced_slt);
270 labels (1, 2, 3, 4, 5, 6);
274 fet_beginchar ("Ed. Med. do clef", "medicaea.do");
276 draw_staff (-1, 3, 0.0);
278 draw_medicaea_do_clef ((0, 0), 1.0);
282 fet_beginchar ("Ed. Med. do clef", "medicaea.do_change");
283 draw_medicaea_do_clef ((0, 0), .8);
287 def draw_medicaea_fa_clef (expr exact_center, reduction) =
288 % inspired by Regensburger Edition of Medicaea (1885/86), in:
289 % MGG, volume 2, col. 1327 ("Choralreform"), fig. 2.
291 save reduced_il, reduced_slt;
293 reduced_il# = staff_space# * reduction;
294 reduced_slt# = linethickness# * reduction;
296 define_pixels (reduced_il);
297 define_pixels (reduced_slt);
301 xoffs# = xpart exact_center;
302 yoffs# = ypart exact_center;
304 define_pixels (xoffs, yoffs);
307 pickup pencircle scaled linethickness;
309 x11 = x12 = xoffs + 0.4 reduced_il;
310 y11 = yoffs = bot y12 + 1.5 reduced_il;
312 draw_rounded_block (bot lft z12, top rt z11, linethickness);
314 % left-handed punctum
316 pickup pencircle xscaled reduced_slt
322 ellipse := reverse fullcircle xscaled reduced_slt
325 lft z13 = (xoffs, yoffs);
326 rt z14 = z11 + (linethickness / 2, 0);
328 fill get_subpath (ellipse, left, right, z13)
329 -- get_subpath (ellipse, right, left, z14)
332 labels (11, 12, 13, 14);
334 % right-handed puncta as in do clef
335 draw_medicaea_do_clef (exact_center + (0.7 reduced_il#, 0),
338 set_char_box (0 - xpart exact_center,
339 1.7 reduced_il# + xpart exact_center,
340 1.5 reduced_il# - ypart exact_center,
341 1.5 reduced_il# + ypart exact_center);
345 fet_beginchar ("Ed. Med. fa clef", "medicaea.fa");
347 draw_staff (-1, 3, 0.0);
349 draw_medicaea_fa_clef ((0, 0), 1.0);
353 fet_beginchar ("Ed. Med. fa clef", "medicaea.fa_change");
354 draw_medicaea_fa_clef ((0, 0), .8);
368 % width: interval from left end to right end
369 % height: interval from bottom of lower beam to top of upper beam
370 % exact_center: the coordinates of the vertical center point of the
373 def draw_brevis (expr exact_center, bwidth, bheight, blinethickness) =
374 save brevis_width, brevis_height, linethickness;
376 brevis_width# = bwidth;
377 brevis_height# = bheight;
378 linethickness# = blinethickness;
380 save beam_width, beam_height;
381 save serif_size, serif_protrude, hole_height;
383 beam_width# = 1.4 linethickness#;
384 hole_height# = 3 linethickness#;
385 2 beam_height# + hole_height# = brevis_height#;
386 serif_size# = (hole_height# - linethickness#) / 2;
387 serif_protrude# = 1.5 serif_size#;
391 xoffs# = xpart exact_center;
392 yoffs# = ypart exact_center;
394 define_pixels (xoffs, yoffs);
395 define_pixels (brevis_width, brevis_height, linethickness);
396 define_pixels (beam_width, beam_height, serif_size, serif_protrude);
398 z1l = (xoffs, yoffs - linethickness);
399 z2r = z1r + serif_size * (1, -1);
400 z3l = z2l + (-serif_size, -serif_protrude);
402 penpos1 (beam_width, 0);
403 penpos2 (beam_height, 90);
404 penpos3 (beam_width, 180);
406 save pat_in, pat_out;
407 path pat_in, pat_out;
413 -- reverse pat_out xscaled -1
414 shifted (2 xoffs + brevis_width, 0);
416 -- reverse pat_out yscaled -1
423 -- reverse pat_in xscaled -1
424 shifted (2 xoffs + brevis_width, 0);
426 -- reverse pat_in yscaled -1
437 % Draw two brevis notes; the second one shifted down by `shift'.
438 % The other parameters are the same as with `draw_brevis'.
440 def draw_double_brevis (expr exact_center, bwidth, bheight,
441 blinethickness, shift) =
442 save brevis_width, brevis_height, linethickness;
444 brevis_width# = bwidth;
445 brevis_height# = bheight;
446 linethickness# = blinethickness;
448 save beam_width, beam_height;
449 save serif_size, serif_protrude, hole_height;
451 beam_width# = 1.4 linethickness#;
452 hole_height# = 3 linethickness#;
453 2 beam_height# + hole_height# = brevis_height#;
454 serif_size# = (hole_height# - linethickness#) / 2;
455 serif_protrude# = 1.5 serif_size#;
459 xoffs# = xpart exact_center;
460 yoffs# = ypart exact_center;
462 define_pixels (xoffs, yoffs);
463 define_pixels (brevis_width, brevis_height, linethickness);
464 define_pixels (beam_width, beam_height, serif_size, serif_protrude);
466 z1l = (xoffs, yoffs - linethickness);
467 z2r = z1r + serif_size * (1, -1);
468 z3l = z2l + (-serif_size, -serif_protrude);
470 penpos1 (beam_width, 0);
471 penpos2 (beam_height, 90);
472 penpos3 (beam_width, 180);
474 z4 = z1 shifted (0, -shift);
475 z5 = z2 shifted (0, -shift);
476 z6 = z3 shifted (0, -shift);
478 penpos4 (beam_width, 0);
479 penpos5 (beam_height, 90);
480 penpos6 (beam_width, 180);
482 save pat_in, pat_out;
483 path pat_in, pat_out;
489 -- reverse pat_out xscaled -1
490 shifted (2 xoffs + brevis_width, 0);
492 -- reverse pat_out yscaled -1
493 shifted (0, shift - 2 yoffs)
501 -- reverse pat_in xscaled -1
502 shifted (2 xoffs + brevis_width, 0);
504 -- reverse pat_in yscaled -1
509 unfill pat_in shifted (0, -shift);
511 penlabels (1, 2, 3, 4, 5, 6);
516 % Draw three brevis notes; the second one shifted down by `shift',
517 % the third one by `2 shift'.
518 % The other parameters are the same as with `draw_brevis'.
520 def draw_triple_brevis (expr exact_center, bwidth, bheight,
521 blinethickness, shift) =
522 save brevis_width, brevis_height, linethickness;
524 brevis_width# = bwidth;
525 brevis_height# = bheight;
526 linethickness# = blinethickness;
528 save beam_width, beam_height;
529 save serif_size, serif_protrude, hole_height;
531 beam_width# = 1.4 linethickness#;
532 hole_height# = 3 linethickness#;
533 2 beam_height# + hole_height# = brevis_height#;
534 serif_size# = (hole_height# - linethickness#) / 2;
535 serif_protrude# = 1.5 serif_size#;
539 xoffs# = xpart exact_center;
540 yoffs# = ypart exact_center;
542 define_pixels (xoffs, yoffs);
543 define_pixels (brevis_width, brevis_height, linethickness);
544 define_pixels (beam_width, beam_height, serif_size, serif_protrude);
546 z1l = (xoffs, yoffs - linethickness);
547 z2r = z1r + serif_size * (1, -1);
548 z3l = z2l + (-serif_size, -serif_protrude);
550 penpos1 (beam_width, 0);
551 penpos2 (beam_height, 90);
552 penpos3 (beam_width, 180);
554 z7 = z1 shifted (0, -2 shift);
555 z8 = z2 shifted (0, -2 shift);
556 z9 = z3 shifted (0, -2 shift);
558 penpos7 (beam_width, 0);
559 penpos8 (beam_height, 90);
560 penpos9 (beam_width, 180);
562 save pat_in, pat_out;
563 path pat_in, pat_out;
569 -- reverse pat_out xscaled -1
570 shifted (2 xoffs + brevis_width, 0);
572 -- reverse pat_out yscaled -1
573 shifted (0, -2 yoffs)
581 -- reverse pat_in xscaled -1
582 shifted (2 xoffs + brevis_width, 0);
584 -- reverse pat_in yscaled -1
589 unfill pat_in shifted (0, -shift);
590 unfill pat_in shifted (0, -2 shift);
592 penlabels (1, 2, 3, 7, 8, 9);
596 def draw_neomensural_c_clef (expr exact_center, reduction) =
597 save reduced_il, reduced_slt, stem_width;
599 reduced_il# = staff_space# * reduction;
600 reduced_slt# = linethickness# * reduction;
601 stem_width# = 1.4 reduced_slt#;
603 define_pixels (reduced_il, reduced_slt, stem_width);
605 set_char_box (0 - xpart exact_center,
606 2 reduced_il# + 6 reduced_slt# + xpart exact_center,
607 2 reduced_il# - ypart exact_center,
608 2 reduced_il# + ypart exact_center);
610 draw_brevis (exact_center + (3 reduced_slt#, 0),
611 2 reduced_il#, reduced_il#, reduced_slt#);
615 xoffs# = xpart exact_center;
616 yoffs# = ypart exact_center;
618 define_pixels (xoffs, yoffs);
620 pickup pencircle xscaled stem_width
621 yscaled blot_diameter;
626 ellipse := fullcircle xscaled stem_width
627 yscaled blot_diameter;
629 lft x11 = lft x12 = xoffs;
630 top y12 - bot y11 = 4 reduced_il;
631 top y12 + bot y11 = 2 yoffs;
638 pat := get_subpath (ellipse, down, up, z13)
643 fill get_subpath (ellipse, down, up, z11)
644 -- get_subpath (ellipse, up, down, z12)
646 fill get_subpath (ellipse, down, up, z14)
647 -- get_subpath (ellipse, up, down, z15)
654 shifted (0, 2 yoffs);
656 shifted (w, 2 yoffs);
658 labels (11, 12, 13, 14, 15);
662 fet_beginchar ("neo-mensural c clef", "neomensural.c");
664 draw_staff (-1, 3, 0.0);
666 draw_neomensural_c_clef ((0, 0), 1.0);
670 fet_beginchar ("neo-mensural c clef", "neomensural.c_change");
671 draw_neomensural_c_clef ((0, 0), .8);
675 def draw_petrucci_c_clef (expr exact_center, flare_align, reduction) =
676 % inspired by Josquin Desprez, "Stabat Mater", Libro tertio,
677 % 1519, printed by Petrucci, in: MGG, volume 7, Table 11.
678 % Also by Petrucci's Canti C, Venedig 1503. In: MGG, volume
681 save reduced_il, reduced_slt;
683 reduced_il# = staff_space# * reduction;
684 reduced_slt# = linethickness# * reduction;
686 define_pixels (reduced_il);
688 draw_double_brevis (exact_center + (0, 0.5 staff_space#),
689 reduced_il#, reduced_il#, reduced_slt#,
692 save half_reduced_il, left_depth, left_height;
694 half_reduced_il# = staff_space# * sqrt (reduction);
695 left_height# = half_reduced_il# * min (3.2, 3.2 + 0.2 + flare_align);
696 left_depth# = half_reduced_il# * min (3.2, 3.2 + 0.2 - flare_align);
698 define_pixels (half_reduced_il);
699 define_pixels (left_depth, left_height);
701 set_char_box (0 - xpart exact_center,
702 reduced_il# + xpart exact_center,
703 left_depth# - ypart exact_center,
704 left_height# + ypart exact_center);
708 xoffs# = xpart exact_center;
709 yoffs# = ypart exact_center;
711 define_pixels (xoffs, yoffs);
713 pickup pencircle xscaled 1.4 linethickness
714 yscaled blot_diameter;
719 ellipse := fullcircle xscaled 1.4 linethickness
720 yscaled blot_diameter;
722 lft x11 = lft x13 = xoffs;
723 top y11 = yoffs + left_height;
724 bot y13 = yoffs - left_depth;
725 rt x15 = rt x17 = xoffs + brevis_width;
726 y15 = min (y11 - 0.2 half_reduced_il, yoffs + 2.2 half_reduced_il);
727 y17 = max (y13 + 0.2 half_reduced_il, yoffs - 2.2 half_reduced_il);
729 z12 = z14 yscaled -1;
731 z16 = z18 yscaled -1;
732 rt z18 = lft z14 shifted (brevis_width, 0);
734 penpos12 (1.4 linethickness, 0);
735 penpos14 (1.4 linethickness, 0);
736 penpos16 (1.4 linethickness, 0);
737 penpos18 (1.4 linethickness, 0);
739 if top y11 > -y6 + 0.7 linethickness:
740 fill get_subpath (ellipse, up, down, z11)
745 if bot y13 < y6 - 0.7 linethickness:
746 fill get_subpath (ellipse, down, up, z13)
751 if top y15 > -y6 + 0.7 linethickness:
752 fill get_subpath (ellipse, up, down, z15)
757 if bot y17 < y6 - 0.7 linethickness:
758 fill get_subpath (ellipse, down, up, z17)
764 labels (11, 13, 15, 17);
765 penlabels (12, 14, 16, 18);
769 fet_beginchar ("petrucci c1 clef", "petrucci.c1");
771 draw_staff (-1, 3, 0.0);
773 draw_petrucci_c_clef ((0, 0), +2, 1.0);
777 fet_beginchar ("petrucci c1 clef", "petrucci.c1_change");
778 draw_petrucci_c_clef ((0, 0), +2, .8);
782 fet_beginchar ("petrucci c2 clef", "petrucci.c2");
784 draw_staff (-1, 3, 0.0);
786 draw_petrucci_c_clef ((0, 0), +1, 1.0);
790 fet_beginchar ("petrucci c2 clef", "petrucci.c2_change");
791 draw_petrucci_c_clef ((0, 0), +1, .8);
795 fet_beginchar ("petrucci c3 clef", "petrucci.c3");
797 draw_staff (-1, 3, 0.0);
799 draw_petrucci_c_clef ((0, 0), 0, 1.0);
803 fet_beginchar ("petrucci c3 clef", "petrucci.c3_change");
804 draw_petrucci_c_clef ((0, 0), 0, .8);
808 fet_beginchar ("petrucci c4 clef", "petrucci.c4");
810 draw_staff (-1, 3, 0.0);
812 draw_petrucci_c_clef ((0, 0), -1, 1.0);
816 fet_beginchar ("petrucci c4 clef", "petrucci.c4_change");
817 draw_petrucci_c_clef ((0, 0), -1, .8);
821 fet_beginchar ("petrucci c5 clef", "petrucci.c5");
823 draw_staff (-1, 3, 0.0);
825 draw_petrucci_c_clef ((0, 0), -2, 1.0);
829 fet_beginchar ("petrucci c5 clef", "petrucci.c5_change");
830 draw_petrucci_c_clef ((0, 0), -2, .8);
834 def draw_mensural_c_clef (expr exact_center, reduction) =
835 % inspired by Ockeghem, "Missa Prolationum", in: MGG, volume
840 reduced_il# = staff_space# * reduction;
842 define_pixels (reduced_il);
844 draw_triple_brevis (exact_center + (0, 0.5 staff_space#),
845 2 reduced_il#, 0.8 staff_space#,
846 0.8 linethickness#, staff_space);
848 save half_reduced_il;
850 half_reduced_il# = staff_space# * sqrt (reduction);
852 define_pixels (half_reduced_il);
854 set_char_box (0 - xpart exact_center,
855 2 reduced_il# + xpart exact_center,
856 2.2 half_reduced_il# + staff_space# -
857 2 ypart exact_center,
858 2.2 half_reduced_il# + 2 ypart exact_center);
862 xoffs# = xpart exact_center;
863 yoffs# = ypart exact_center;
865 define_pixels (xoffs, yoffs);
867 pickup pencircle xscaled 1.4 linethickness
868 yscaled blot_diameter;
873 ellipse := fullcircle xscaled 1.4 linethickness
874 yscaled blot_diameter;
876 lft x11 = lft x13 = xoffs;
877 top y11 = yoffs + 2.2 half_reduced_il;
878 bot y13 = yoffs - 2.2 half_reduced_il - staff_space;
879 rt x15 = rt x17 = xoffs + brevis_width;
880 y15 = yoffs + 1.4 half_reduced_il;
881 y17 = yoffs - 1.4 half_reduced_il - staff_space;
883 z12 = z14 yscaled -1 shifted (0, -staff_space);
885 z16 = z18 yscaled -1 shifted (0, -staff_space);
886 rt z18 = lft z14 shifted (brevis_width, 0);
888 penpos12 (1.4 linethickness, 0);
889 penpos14 (1.4 linethickness, 0);
890 penpos16 (1.4 linethickness, 0);
891 penpos18 (1.4 linethickness, 0);
893 fill get_subpath (ellipse, up, down, z11)
897 fill get_subpath (ellipse, down, up, z13)
901 fill get_subpath (ellipse, up, down, z15)
905 fill get_subpath (ellipse, down, up, z17)
910 labels (11, 13, 15, 17);
911 penlabels (12, 14, 16, 18);
915 fet_beginchar ("mensural c clef", "mensural.c");
917 draw_staff (-1, 3, 0.0);
919 draw_mensural_c_clef ((0, 0), 1.0);
923 fet_beginchar ("mensural c clef", "mensural.c_change");
924 draw_mensural_c_clef ((0, 0), .8);
928 def draw_diamond (expr exact_center, reduction) =
929 save stem_width, reduced_nht, holeheight, beamheight;
930 save rh_height, rh_width;
932 stem_width# = 1.4 reduced_slt#;
933 reduced_nht# = noteheight# * reduction;
934 holeheight# = 3 reduced_slt#;
935 beamheight# = 0.4 (reduced_nht# - holeheight#);
937 rh_height# = 1.2 staff_space# * reduction;
938 rh_width# / rh_height# = tand (30);
940 define_pixels (beamheight, stem_width);
941 define_pixels (rh_height, rh_width);
945 xoffs# = xpart exact_center;
946 yoffs# = ypart exact_center;
948 define_pixels (xoffs, yoffs);
950 pickup pencircle xscaled beamheight
957 ellipse := reverse fullcircle xscaled beamheight
961 x21 := xoffs - rh_width / 2;
964 y22 := yoffs + rh_height / 2;
965 x23 := xoffs + rh_width / 2;
968 y24 := yoffs - rh_height / 2;
970 fill get_subpath (ellipse, z21 - z24, z22 - z21, z21)
971 -- get_subpath (ellipse, z22 - z21, z23 - z22, z22)
972 -- get_subpath (ellipse, z23 - z22, z24 - z23, z23)
973 -- get_subpath (ellipse, z24 - z23, z21 - z24, z24)
979 l2122 := (directionpoint (z21 - z22) of ellipse) shifted z21
980 -- (directionpoint (z21 - z22) of ellipse) shifted z22;
981 l2223 := (directionpoint (z22 - z23) of ellipse) shifted z22
982 -- (directionpoint (z22 - z23) of ellipse) shifted z23;
983 l2324 := (directionpoint (z23 - z24) of ellipse) shifted z23
984 -- (directionpoint (z23 - z24) of ellipse) shifted z24;
985 l2421 := (directionpoint (z24 - z21) of ellipse) shifted z24
986 -- (directionpoint (z24 - z21) of ellipse) shifted z21;
988 unfill l2122 intersectionpoint l2223
989 -- l2223 intersectionpoint l2324
990 -- l2324 intersectionpoint l2421
991 -- l2421 intersectionpoint l2122
994 labels (21, 22, 23, 24);
998 def draw_petrucci_f_clef (expr exact_center, reduction) =
999 % inspired by L'homme arme super voces musicales in Misse
1000 % Josquin, 1502, Petrucci, in: MGG, volume 7, col. 200; also
1001 % inspired by Gaspar van Weerbeke, "Virgo Maria" (1502), in:
1002 % MGG, volume 9, col. 653 ("Motette"), fig. 3.; also by Andr'e
1003 % Campra, "Entr'ee des s'er'enades" (1710), in: MGG, volume 2,
1004 % col. 1649 ("Contredanse"), fig. 2.
1006 save interline, reduced_il, reduced_slt;
1008 interline# = staff_space#;
1009 reduced_il# = staff_space# * reduction;
1010 reduced_slt# = linethickness# * reduction;
1012 draw_brevis (exact_center, reduced_il#, reduced_il#, reduced_slt#);
1013 draw_diamond (exact_center +
1014 (1.6 interline# * reduction, interline# / 2),
1016 draw_diamond (exact_center +
1017 (1.6 interline# * reduction, -interline# / 2),
1020 define_pixels (interline, reduced_il, reduced_slt);
1024 stem_width# = 1.4 reduced_slt#;
1026 define_pixels (stem_width);
1030 xoffs# = xpart exact_center;
1031 yoffs# = ypart exact_center;
1033 define_pixels (xoffs, yoffs);
1036 pickup pencircle xscaled stem_width
1037 yscaled blot_diameter;
1042 ellipse := fullcircle xscaled stem_width
1043 yscaled blot_diameter;
1045 rt z8 = (xoffs + reduced_il, yoffs - 4 reduced_slt);
1046 rt z9 = (xoffs + reduced_il, yoffs - 4 reduced_il);
1048 penpos8 (stem_width, 0);
1050 fill get_subpath (ellipse, down, up, z9)
1055 % upper diamond's stem
1056 z10 = (xoffs + 1.6 interline * reduction + stem_width / 2,
1057 yoffs + interline * reduction);
1058 top z11 = z10 + (0, 1.5 interline * reduction);
1060 penpos10 (stem_width, 0);
1062 fill get_subpath (ellipse, up, down, z11)
1067 % lower diamond's stem
1068 z12 = (xoffs + 1.6 interline * reduction - stem_width / 2,
1069 yoffs - interline * reduction);
1070 bot z13 = z12 + (0, -3.5 interline * reduction);
1072 penpos12 (stem_width, 0);
1074 fill get_subpath (ellipse, down, up, z13)
1079 save reduced_il, rh_height, rh_width;
1081 reduced_il# = staff_space# * reduction;
1082 rh_height# = 1.2 reduced_il#;
1083 rh_width# / rh_height# = tand (30);
1085 set_char_box (0 - xpart exact_center,
1086 1.6 interline# * reduction + 0.5 rh_width# +
1088 4.5 interline# * reduction - ypart exact_center,
1089 2.5 interline# * reduction + ypart exact_center);
1092 penlabels (8, 10, 12);
1096 fet_beginchar ("petrucci f clef", "petrucci.f");
1098 draw_staff (-1,3, 0.0);
1100 draw_petrucci_f_clef ((0,0), 1.0);
1104 fet_beginchar ("petrucci f clef", "petrucci.f_change");
1105 draw_petrucci_f_clef ((0,0), .8);
1109 def draw_mensural_f_clef (expr exact_center, reduction) =
1110 % inspired by Philippe le Duc, "Dite Signori" (1590), in: MGG,
1111 % volume 3, col. 848 ("Duc"); also by John Dowland, "The First
1112 % Booke of Songes" (1597), in: MGG, volume 3, col. 721
1113 % ("Dowland"), fig. 3.
1115 save width, reduced_slt, stem_width, dot_diameter;
1117 width# = 1.2 staff_space# * reduction;
1118 reduced_slt# = linethickness# * reduction;
1119 stem_width# = 1.4 reduced_slt#;
1120 dot_diameter# = 0.1 reduction * staff_space#;
1122 define_pixels (width, stem_width, staff_space, dot_diameter);
1126 xoffs# = xpart exact_center;
1127 yoffs# = ypart exact_center;
1129 define_pixels (xoffs, yoffs);
1131 pickup pencircle xscaled 0.2 width
1138 ellipse := fullcircle xscaled 0.2 width
1148 pat := halfcircle scaled width
1150 shifted (z10 - (xoffs, yoffs));
1152 z5 = point 0 of pat;
1153 z6 = point 1 of pat;
1154 z7 = point 2 of pat;
1155 z8 = point 3 of pat;
1156 z9 = point 4 of pat;
1161 dirs5 := direction 0 of pat;
1162 dirs6 := direction 1 of pat;
1163 dirs7 := direction 2 of pat;
1164 dirs8 := direction 3 of pat;
1165 dirs9 := direction 4 of pat;
1167 % we approximate `draw pat'
1168 fill get_subpath (ellipse, -dirs5, dirs5, z5)
1169 .. get_subpoint (ellipse, dirs6, z6)
1170 .. get_subpoint (ellipse, dirs7, z7)
1171 .. get_subpoint (ellipse, dirs8, z8)
1172 .. get_subpath (ellipse, dirs9, -dirs9, z9)
1173 .. get_subpoint (ellipse, -dirs8, z8)
1174 .. get_subpoint (ellipse, -dirs7, z7)
1175 .. get_subpoint (ellipse, -dirs6, z6)
1179 rt x2 = xoffs + width;
1180 top y1 = yoffs + 0.5 width;
1181 z2 - z1 = (dot_diameter, -dot_diameter);
1183 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
1184 -- get_subpath (ellipse, z2 - z1, z1 - z2, z2)
1189 top y1 - bot y4 = width;
1190 z4 - z3 = (dot_diameter, -dot_diameter);
1192 fill get_subpath (ellipse, z3 - z4, z4 - z3, z3)
1193 -- get_subpath (ellipse, z4 - z3, z3 - z4, z4)
1196 set_char_box (0 - xpart exact_center,
1197 width# + xpart exact_center,
1198 0.5 width# - ypart exact_center,
1199 0.5 width# + ypart exact_center);
1201 labels (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1205 fet_beginchar ("mensural f clef", "mensural.f");
1207 draw_staff (-1, 3, 0.0);
1209 draw_mensural_f_clef ((0,0), 1.0);
1213 fet_beginchar ("mensural f clef", "mensural.f_change");
1214 draw_mensural_f_clef ((0, 0), .8);
1218 def draw_petrucci_g_clef (expr exact_center, reduction) =
1219 % inspired by Josquin Desprez, "Stabat Mater", Libro tertio,
1220 % 1519, printed by Petrucci, in: MGG, volume 7, Table 11.
1222 save reduced_il, reduced_slt;
1224 reduced_il# = staff_space# * reduction;
1225 reduced_slt# = linethickness# * reduction;
1226 define_pixels (reduced_il, reduced_slt);
1228 set_char_box (0 - xpart exact_center,
1229 1.25 reduced_il# + xpart exact_center,
1230 0.65 reduced_il# - ypart exact_center,
1231 3.80 reduced_il# + ypart exact_center);
1235 xoffs# = xpart exact_center;
1236 yoffs# = ypart exact_center;
1238 define_pixels (xoffs, yoffs);
1240 pickup pencircle xscaled 0.50 reduced_slt
1241 yscaled 0.22 reduced_il
1244 save ellipse, paths, sub_path, outlines, sub_outlines;
1245 path ellipse, paths[], sub_path, outlines[], sub_outlines[];
1247 ellipse := fullcircle xscaled 0.5 reduced_slt
1248 yscaled 0.22 reduced_il
1251 lft z1 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
1252 lft z2 = (xoffs + 1.00 reduced_il, yoffs + 1.20 reduced_il);
1253 lft z3 = (xoffs + 0.70 reduced_il, yoffs + 2.00 reduced_il);
1254 lft z4 = (xoffs + 0.30 reduced_il, yoffs + 3.00 reduced_il);
1255 lft z5 = (xoffs + 0.80 reduced_il, yoffs + 3.70 reduced_il);
1256 lft z6 = (xoffs + 1.00 reduced_il, yoffs + 3.00 reduced_il);
1257 lft z7 = (xoffs + 0.60 reduced_il, yoffs + 2.00 reduced_il);
1258 lft z8 = (xoffs + 0.30 reduced_il, yoffs + 1.70 reduced_il);
1259 lft z9 = (xoffs + 0.00 reduced_il, yoffs + 0.75 reduced_il);
1260 lft z10 = (xoffs + 0.20 reduced_il, yoffs + 0.60 reduced_il);
1278 % we approximate `draw paths1'
1279 for i = 1 step s until (length paths1 + 1):
1280 dirs[i] := direction (i - 1) of paths1;
1283 outlines1 := get_subpath (ellipse, -dirs1, dirs1, z1)
1284 for i = (1 + s) step s until (length paths1 + 1 - s):
1285 .. get_subpoint (ellipse, dirs[i],
1286 point (i - 1) of paths1)
1288 .. get_subpath (ellipse, dirs10, -dirs10, z10)
1289 for i = (length paths1 + 1 - s) step -s until (1 + s):
1290 .. get_subpoint (ellipse, -dirs[i],
1291 point (i - 1) of paths1)
1297 len := length outlines1;
1299 sub_outlines1 := subpath (0,
1300 floor (1/4 len)) of outlines1;
1301 sub_outlines2 := subpath (floor (1/4 len),
1302 floor (2/4 len)) of outlines1;
1303 sub_outlines3 := subpath (floor (2/4 len),
1304 floor (3/4 len)) of outlines1;
1305 sub_outlines4 := subpath (floor (3/4 len),
1311 (times12, times21) = sub_outlines1 intersectiontimes sub_outlines2;
1312 (times13, times31) = sub_outlines1 intersectiontimes sub_outlines3;
1313 (times42, times24) = sub_outlines4 intersectiontimes sub_outlines2;
1314 (times43, times34) = sub_outlines4 intersectiontimes sub_outlines3;
1316 pickup pencircle xscaled 0.75 reduced_slt
1317 yscaled 0.33 reduced_il
1320 ellipse := fullcircle xscaled 0.75 reduced_slt
1321 yscaled 0.33 reduced_il
1324 lft z21 = (xoffs + 1.05 reduced_il, yoffs + 0.45 reduced_il);
1325 lft z22 = (xoffs + 0.55 reduced_il, yoffs + 0.45 reduced_il);
1326 lft z23 = (xoffs + 0.55 reduced_il, yoffs - 0.45 reduced_il);
1327 lft z24 = (xoffs + 1.05 reduced_il, yoffs - 0.45 reduced_il);
1328 lft z25 = (xoffs + 1.10 reduced_il, yoffs + 0.00 reduced_il);
1329 lft z26 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
1338 sub_path := subpath (0, 1) of paths2;
1340 times1 = xpart (sub_outlines1 intersectiontimes sub_path);
1341 times4 = xpart (sub_outlines4 intersectiontimes sub_path);
1343 % we have to find the envelope intersections (if any)
1347 t1 = find_envelope_cusp (reverse ellipse,
1348 subpath (1, 2) of paths2,
1354 t2 = find_envelope_cusp (ellipse,
1355 subpath (3, 4) of reverse paths2,
1357 t2 := length paths2 - t2;
1360 t3 = find_envelope_cusp (reverse ellipse,
1361 subpath (2, 4 - epsilon) of paths2,
1367 t4 = find_envelope_cusp (ellipse,
1368 subpath (1 + epsilon, 3)
1371 t4 := length paths2 - t4;
1374 fill subpath (times1 + s / 4, times13) of sub_outlines1
1375 -- subpath (times31, infinity) of sub_outlines3
1376 & subpath (0, times42) of sub_outlines4
1377 -- subpath (times24, infinity) of sub_outlines2
1378 & subpath (0, times34) of sub_outlines3
1379 -- subpath (times43, times4 - s / 4) of sub_outlines4
1381 unfill subpath (times12, infinity) of sub_outlines1
1382 & subpath (0, times21) of sub_outlines2
1384 fill subpath (times4 + s / 4, infinity) of sub_outlines4
1385 & subpath (0, times1 - s / 4) of sub_outlines1
1388 % we approximate `draw paths2'
1389 for i = 1 step s until (length paths2 - s):
1390 dirs[i + 20] := direction (i - 1) of paths2;
1393 fill get_subpath (ellipse, -dirs21, dirs21, z21)
1394 for i = (1 + s) step s until (length paths2 - s):
1395 .. get_subpoint (ellipse, dirs[i + 20],
1396 point (i - 1) of paths2)
1398 .. get_subpath (ellipse, up, z26 - z25, z25)
1399 -- get_subpath (ellipse, z26 - z25, z25 - z26, z26)
1400 -- get_subpoint (ellipse, z25 - z26, z25)
1401 -- get_subpoint (ellipse, down, z25)
1402 for i = (length paths2 - s) step -s until (t4 + 1):
1403 .. get_subpoint (ellipse, -dirs[i + 20],
1404 point (i - 1) of paths2)
1406 .. get_subpoint (ellipse, -direction t4 of paths2,
1408 -- get_subpoint (ellipse, -direction t3 of paths2,
1410 for i = (floor (t3 / s) * s + 1) step -s until (t2 + 1):
1411 .. get_subpoint (ellipse, -dirs[i + 20],
1412 point (i - 1) of paths2)
1414 .. get_subpoint (ellipse, -direction t2 of paths2,
1416 -- get_subpoint (ellipse, -direction t1 of paths2,
1418 for i = (floor (t1 / s) * s + 1) step -s until (1 + s):
1419 .. get_subpoint (ellipse, -dirs[i + 20],
1420 point (i - 1) of paths2)
1424 labels (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1425 labels (21, 22, 23, 24, 25, 26);
1429 fet_beginchar ("petrucci g clef", "petrucci.g");
1431 draw_staff (-1, 3, 0.0);
1433 draw_petrucci_g_clef ((0, 0), 1.0);
1437 fet_beginchar ("petrucci g clef", "petrucci.g_change");
1438 draw_petrucci_g_clef ((0, 0), .8);
1442 def draw_mensural_g_clef (expr exact_center, reduction) =
1443 % TODO: Rewrite me. The former mensural g clef looked ugly, and the
1444 % code was removed when it broke for small font sizes after some
1445 % global changes in the font. Currently, the character is mapped to
1446 % a copy of the petrucci g clef (which, after all, *is* a mensural g
1447 % clef, but not the one that we have in mind here). -- jr
1449 % Possible sources of inspiration for this clef include: Francisco
1450 % Guerrero, "Lib. 1. Missarum" (1566), in: MGG, volume 3, col. 858
1451 % ("Ducis"); Stefano Fabri, "Quam speciosa veteranis" (1611), in:
1452 % MGG, volume 3, col. 1698 ("Fabri"); Philippus Dulichius,
1453 % "Fasciculus novus ..." (1598), in: MGG, volume 3, col. 919
1454 % ("Dulichius"), fig. 1; Noe Faignient, "Ic sal de Heer myn God
1455 % gebenedye" (1568), in: MGG, volume 3, col. 1735 ("Faignient").
1460 % FIXME: This clef is preliminarily mapped to the petrucci g clef
1461 % until the code for the mensural g clef will be rewritten.
1463 fet_beginchar ("mensural g clef", "mensural.g");
1465 draw_staff (-1, 3, 0.0);
1467 draw_petrucci_g_clef ((0, 0), 1.0);
1471 fet_beginchar ("mensural g clef", "mensural.g_change");
1472 draw_petrucci_g_clef ((0, 0), .8);
1485 def draw_hufnagel_do_clef (expr exact_center, reduction) =
1486 % inspired by Graduale of Friedrich Zollner (1442), in: MGG,
1487 % volume 9, col. 1413 ("Neustift"), fig. 1.
1491 reduced_il# = staff_space# * reduction;
1493 define_pixels (reduced_il);
1495 set_char_box (0 - xpart exact_center,
1496 1.10 reduced_il# + xpart exact_center,
1497 0.70 reduced_il# - ypart exact_center,
1498 0.75 reduced_il# + ypart exact_center);
1502 xoffs# = xpart exact_center;
1503 yoffs# = ypart exact_center;
1505 define_pixels (xoffs, yoffs);
1507 pickup pencircle xscaled (0.60 reduced_il)
1508 yscaled (0.10 reduced_il)
1514 ellipse := fullcircle xscaled (0.60 reduced_il)
1515 yscaled (0.10 reduced_il)
1518 z1 = (xoffs + 0.90 reduced_il, yoffs + .45 reduced_il);
1519 z2 = (xoffs + 0.80 reduced_il, yoffs + .45 reduced_il);
1520 z3 = (xoffs + 0.50 reduced_il, yoffs + .60 reduced_il);
1521 z4 = (xoffs + 0.20 reduced_il, yoffs + .45 reduced_il);
1522 z5 = (xoffs + 0.20 reduced_il, yoffs - .45 reduced_il);
1523 z6 = (xoffs + 0.40 reduced_il, yoffs - .55 reduced_il);
1532 fill get_subpath (ellipse,
1533 -direction 0 of pat, direction 0 of pat, z1)
1534 .. get_subpoint (ellipse, direction 1 of pat, z2)
1535 .. get_subpath (ellipse,
1536 direction (2 - epsilon) of pat, z4 - z3, z3)
1537 -- get_subpath (ellipse,
1538 z4 - z3, z5 - z4, z4)
1539 -- get_subpath (ellipse,
1540 z5 - z4, z6 - z5, z5)
1541 -- get_subpath (ellipse,
1542 z6 - z5, z5 - z6, z6)
1543 -- get_subpoint (ellipse, z5 - z6, z5)
1544 -- get_subpoint (ellipse, z4 - z5, z5)
1545 -- get_subpoint (ellipse, z4 - z5, z4)
1546 -- get_subpoint (ellipse, -direction (2 - epsilon) of pat, z3)
1547 .. get_subpath (ellipse,
1548 -direction 1 of pat, -direction 1 of pat, z2)
1551 labels (1, 2, 3, 4, 5, 6);
1555 fet_beginchar ("Hufnagel do clef", "hufnagel.do");
1557 draw_staff (-1, 3, 0.0);
1559 draw_hufnagel_do_clef ((0, 0), 1.0);
1563 fet_beginchar ("Hufnagel do clef", "hufnagel.do_change");
1564 draw_hufnagel_do_clef ((0, 0), .8);
1568 def draw_hufnagel_fa_clef (expr exact_center, reduction) =
1569 % inspired by Bamberger Manuscript (15th century), in:
1570 % MGG, volume 2, table 59.
1574 reduced_il# = staff_space# * reduction;
1576 define_pixels (reduced_il);
1578 set_char_box (0 - xpart exact_center,
1579 1.20 reduced_il# + xpart exact_center,
1580 1.15 reduced_il# - ypart exact_center,
1581 1.00 reduced_il# + ypart exact_center);
1583 pickup pencircle xscaled (0.60 reduced_il)
1584 yscaled (0.10 reduced_il)
1589 xoffs# = xpart exact_center;
1590 yoffs# = ypart exact_center;
1592 define_pixels (xoffs, yoffs);
1597 ellipse := fullcircle xscaled (0.60 reduced_il)
1598 yscaled (0.10 reduced_il)
1601 z11 = (xoffs + 0.90 reduced_il, yoffs + 0.70 reduced_il);
1602 z12 = (xoffs + 0.80 reduced_il, yoffs + 0.70 reduced_il);
1603 z13 = (xoffs + 0.50 reduced_il, yoffs + 0.85 reduced_il);
1604 z14 = (xoffs + 0.20 reduced_il, yoffs + 0.70 reduced_il);
1605 z15 = (xoffs + 0.20 reduced_il, yoffs - 1.10 reduced_il);
1613 fill get_subpath (ellipse,
1614 -direction 0 of pat, direction 0 of pat, z11)
1615 .. get_subpoint (ellipse, direction 1 of pat, z12)
1616 .. get_subpath (ellipse,
1617 direction (2 - epsilon) of pat, z14 - z13, z13)
1618 -- get_subpath (ellipse,
1619 z14 - z13, z15 - z14, z14)
1620 -- get_subpath (ellipse,
1621 z15 - z14, z14 - z15, z15)
1622 -- get_subpoint (ellipse, z14 - z15, z14)
1623 -- get_subpoint (ellipse, -direction (2 - epsilon) of pat, z13)
1624 .. get_subpath (ellipse,
1625 -direction 1 of pat, -direction 1 of pat, z12)
1628 z16 = (xoffs + 0.90 reduced_il, yoffs - 0.05 reduced_il);
1629 z17 = (xoffs + 0.80 reduced_il, yoffs - 0.05 reduced_il);
1630 z18 = (xoffs + 0.50 reduced_il, yoffs + 0.10 reduced_il);
1631 z19 = (xoffs + 0.20 reduced_il, yoffs - 0.05 reduced_il);
1638 fill get_subpath (ellipse,
1639 -direction 0 of pat, direction 0 of pat, z16)
1640 .. get_subpoint (ellipse, direction 1 of pat, z17)
1641 .. get_subpath (ellipse,
1642 direction (2 - epsilon) of pat, z19 - z18, z18)
1643 -- get_subpoint (ellipse, z19 - z18, z19)
1644 -- get_subpoint (ellipse, -direction (2 - epsilon) of pat, z18)
1645 .. get_subpoint (ellipse, -direction 1 of pat, z17)
1648 labels (11, 12, 13, 14, 15, 16, 17, 18, 19);
1652 fet_beginchar ("Hufnagel fa clef", "hufnagel.fa");
1654 draw_staff (-1, 3, 0.0);
1656 draw_hufnagel_fa_clef ((0, 0), 1.0);
1660 fet_beginchar ("Hufnagel fa clef", "hufnagel.fa_change");
1661 draw_hufnagel_fa_clef ((0, 0), .8);
1665 def draw_hufnagel_do_fa_clef (expr exact_center, reduction) =
1666 draw_hufnagel_do_clef (exact_center, reduction);
1667 draw_hufnagel_fa_clef (exact_center + (0, -2 staff_space#), reduction);
1669 set_char_box (0 - xpart exact_center,
1670 1.20 reduced_il# + xpart exact_center,
1671 1.15 reduced_il# + 2 staff_space# - ypart exact_center,
1672 0.75 reduced_il# + ypart exact_center);
1676 fet_beginchar ("Hufnagel do/fa clef", "hufnagel.do.fa");
1678 draw_staff (-1, 3, 0.0);
1680 draw_hufnagel_do_fa_clef ((0, 0), 1.0);
1684 fet_beginchar ("Hufnagel do/fa clef", "hufnagel.do.fa_change");
1685 draw_hufnagel_do_fa_clef ((0, 0), .8);
1689 fet_endgroup ("clefs")