1 % Feta (not the Font-En-Tja) music font -- ancient clefs
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 2001--2012 Juergen Reuter <reuter@ipd.uka.de>
6 % The LilyPond font is free software: you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation, either version 3 of the License, or
9 % (at your option) any later version, or under the SIL Open Font License.
11 % LilyPond is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 % GNU General Public License for more details.
16 % You should have received a copy of the GNU General Public License
17 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 fet_begingroup ("clefs");
24 % Each clef is associated with a particular pitch: the treble clef
25 % with the `g', the alto clef with the `c', the bass clef with the
26 % `f', etc. The shape of each clef character defines a vertical
27 % position that is assumed to represent this pitch. For the treble
28 % clef, it is the vertical position of the center of the spiral
29 % ending that represents the `g' pitch. For the bass clef, it is
30 % the center between the two fat dots that define the vertical
31 % position of the `f' pitch. For the alto clef, it is the vertical
32 % center of the clef that is aligned with the `c' pitch. For each
33 % clef character, this center should be vertically aligned with the
34 % point (0, 0). The horizontal alignment of each clef character
35 % should be such that the vertical line through the point (0, 0)
36 % touches the left-most edge of the clef.
38 % TODO: document exact_center
40 % set_char_box() conventions:
42 % * breapth: Ignored (as far as I know). Should be set to 0.
44 % * width: Should match the clef's width.
46 % * depth: Should match the bottom edge of the clef. Affects vertical
49 % * height: Should match the top edge of the clef. Affects vertical
62 def draw_vaticana_do_clef (expr exact_center, reduction) =
65 reduced_il# = staff_space# * reduction;
67 set_char_box (0 - xpart exact_center,
68 0.5 reduced_il# + xpart exact_center,
69 0.8 reduced_il# - ypart exact_center,
70 0.8 reduced_il# + ypart exact_center);
72 define_pixels (reduced_il);
74 save pat, ellipse, clef, T;
75 path pat, ellipse, clef;
78 T := identity xscaled 0.6 linethickness
79 yscaled 0.6 reduced_il;
80 pickup pencircle transformed T;
81 ellipse := reverse fullcircle transformed T;
85 xoffs# = xpart exact_center;
86 yoffs# = ypart exact_center;
88 define_pixels (xoffs, yoffs);
90 rt z11 = (xoffs + 0.50 reduced_il, yoffs - .45 reduced_il);
91 z12 = (xoffs + 0.25 reduced_il, yoffs - .50 reduced_il);
92 lft z13 = (xoffs + 0.00 reduced_il, yoffs - .28 reduced_il);
93 lft z14 = (xoffs, yoffs);
103 % adjust vertically to fit into bounding box
104 shift = find_tangent_shift (((0, -d + 0.3 reduced_il)
105 -- (w, -d + 0.3 reduced_il)), pat,
106 (0, -d / 2), (0, d / 2));
107 pat := pat shifted shift;
110 .. top (point 1 of pat)
111 .. get_subpath (ellipse,
112 -direction 0 of pat, direction 0 of pat,
114 .. bot (point 1 of pat)
115 .. get_subpath (ellipse,
116 direction 2 of pat, up,
120 -- reverse clef yscaled -1
123 labels (11, 12, 13, 14);
127 fet_beginchar ("Ed. Vat. do clef", "vaticana.do");
129 draw_staff (-1, 3, 0.0);
131 draw_vaticana_do_clef ((0, 0), 1.0);
135 fet_beginchar ("Ed. Vat. do clef", "vaticana.do_change");
136 draw_vaticana_do_clef ((0, 0), 1.0); % no reduction
140 def draw_vaticana_fa_clef (expr exact_center, reduction) =
141 save reduced_il, xoffs, yoffs;
143 reduced_il# = staff_space# * reduction;
144 xoffs# = xpart exact_center;
145 yoffs# = ypart exact_center;
147 define_pixels (reduced_il, xoffs, yoffs);
149 % left-handed punctum
150 save ellipse, pat, T;
154 T := identity xscaled 0.6 linethickness
155 yscaled 0.5 reduced_il;
156 pickup pencircle transformed T;
157 ellipse := reverse fullcircle transformed T;
159 lft z21 = (xoffs + 0.00 reduced_il, yoffs + 0.00 reduced_il);
160 z22 = (xoffs + 0.25 reduced_il, yoffs + 0.05 reduced_il);
161 rt z23 = (xoffs + 0.50 reduced_il, yoffs - 0.05 reduced_il);
167 fill get_subpath (ellipse,
168 -direction 0 of pat, direction 0 of pat, z21)
170 .. get_subpath (ellipse,
171 direction 2 of pat, -direction 2 of pat, z23)
176 pickup pencircle scaled 0.6 linethickness;
179 yoffs = bot y24 + 1.5 reduced_il;
181 draw_rounded_block (bot lft z24, top rt z23, 0.6 linethickness);
183 labels (21, 22, 23, 24);
185 % right-handed puncta as in do clef
186 draw_vaticana_do_clef (exact_center + (0.55 reduced_il#, 0),
189 set_char_box (0 - xpart exact_center,
190 1.05 reduced_il# + xpart exact_center,
191 1.5 reduced_il# - ypart exact_center,
192 0.8 reduced_il# + ypart exact_center);
196 fet_beginchar ("Ed. Vat. fa clef", "vaticana.fa");
198 draw_staff (-1, 3, 0.0);
200 draw_vaticana_fa_clef ((0, 0), 1.0);
204 fet_beginchar ("Ed. Vat. fa clef", "vaticana.fa_change");
205 draw_vaticana_fa_clef ((0, 0), 1.0); % no reduction
217 def draw_medicaea_do_clef (expr exact_center, reduction) =
218 save reduced_il, reduced_slt;
220 reduced_il# = staff_space# * reduction;
221 reduced_slt# = linethickness# * reduction;
223 define_pixels (reduced_il);
224 define_pixels (reduced_slt);
226 set_char_box (0 - xpart exact_center,
227 1.0 reduced_il# + xpart exact_center,
228 1.5 reduced_il# - ypart exact_center,
229 1.5 reduced_il# + ypart exact_center);
233 flag_height# = 0.5 reduced_il#;
235 define_pixels (flag_height);
239 xoffs# = xpart exact_center;
240 yoffs# = ypart exact_center;
242 define_pixels (xoffs, yoffs);
249 T := identity xscaled reduced_slt
251 pickup pencircle transformed T;
252 ellipse := reverse fullcircle transformed T;
254 xoffs = lft x1 = rt x2 - reduced_il;
255 y1 = yoffs + 0.5 (reduced_il - flag_height - staff_space);
256 y2 = y1 - reduced_il + flag_height;
259 -- get_subpath (ellipse, z2 - z1, z1 - z2, z2)
263 xoffs = lft x3 = rt x4 - reduced_il;
264 y3 = yoffs + 0.5 (reduced_il - flag_height + staff_space);
265 y4 = y3 - reduced_il + flag_height;
268 -- get_subpath (ellipse, z4 - z3, z3 - z4, z4)
273 pickup pencircle scaled reduced_slt;
275 lft x5 = lft x6 = xoffs;
276 yoffs = top y6 - 1.5 reduced_il = bot y5 + 1.5 reduced_il;
278 draw_rounded_block (bot lft z5, top rt z6, reduced_slt);
280 labels (1, 2, 3, 4, 5, 6);
284 fet_beginchar ("Ed. Med. do clef", "medicaea.do");
286 draw_staff (-1, 3, 0.0);
288 draw_medicaea_do_clef ((0, 0), 1.0);
292 fet_beginchar ("Ed. Med. do clef", "medicaea.do_change");
293 draw_medicaea_do_clef ((0, 0), .8);
297 def draw_medicaea_fa_clef (expr exact_center, reduction) =
298 % inspired by Regensburger Edition of Medicaea (1885/86), in:
299 % MGG, volume 2, col. 1327 ("Choralreform"), fig. 2.
301 save reduced_il, reduced_slt;
303 reduced_il# = staff_space# * reduction;
304 reduced_slt# = linethickness# * reduction;
306 define_pixels (reduced_il);
307 define_pixels (reduced_slt);
311 xoffs# = xpart exact_center;
312 yoffs# = ypart exact_center;
314 define_pixels (xoffs, yoffs);
317 pickup pencircle scaled reduced_slt;
319 x11 = x12 = xoffs + 0.4 reduced_il;
320 y11 = yoffs = bot y12 + 1.5 reduced_il;
322 draw_rounded_block (bot lft z12, top rt z11, reduced_slt);
324 % left-handed punctum
329 T := identity xscaled reduced_slt
331 pickup pencircle transformed T;
332 ellipse := reverse fullcircle transformed T;
334 lft z13 = (xoffs, yoffs);
335 rt z14 = z11 + (reduced_slt / 2, 0);
337 fill get_subpath (ellipse, left, right, z13)
338 -- get_subpath (ellipse, right, left, z14)
341 labels (11, 12, 13, 14);
343 % right-handed puncta as in do clef
344 draw_medicaea_do_clef (exact_center + (0.7 reduced_il#, 0),
347 set_char_box (0 - xpart exact_center,
348 1.7 reduced_il# + xpart exact_center,
349 1.5 reduced_il# - ypart exact_center,
350 1.5 reduced_il# + ypart exact_center);
354 fet_beginchar ("Ed. Med. fa clef", "medicaea.fa");
356 draw_staff (-1, 3, 0.0);
358 draw_medicaea_fa_clef ((0, 0), 1.0);
362 fet_beginchar ("Ed. Med. fa clef", "medicaea.fa_change");
363 draw_medicaea_fa_clef ((0, 0), .8);
377 % width: interval from left end to right end
378 % height: interval from bottom of lower beam to top of upper beam
379 % exact_center: the coordinates of the vertical center point of the
382 def draw_brevis (expr exact_center, bwidth, bheight, blinethickness) =
383 save brevis_width, brevis_height, linethickness;
385 brevis_width# = bwidth;
386 brevis_height# = bheight;
387 linethickness# = blinethickness;
389 save beam_width, beam_height;
390 save serif_size, serif_protrude, hole_height;
392 beam_width# = 1.4 linethickness#;
393 hole_height# = 3 linethickness#;
394 2 beam_height# + hole_height# = brevis_height#;
395 serif_size# = (hole_height# - linethickness#) / 2;
396 serif_protrude# = 1.5 serif_size#;
400 xoffs# = xpart exact_center;
401 yoffs# = ypart exact_center;
403 define_pixels (xoffs, yoffs);
404 define_pixels (brevis_width, brevis_height, linethickness);
405 define_pixels (beam_width, beam_height, serif_size, serif_protrude);
407 z1l = (xoffs, yoffs - linethickness);
408 z2r = z1r + serif_size * (1, -1);
409 z3l = z2l + (-serif_size, -serif_protrude);
411 penpos1 (beam_width, 0);
412 penpos2 (beam_height, 90);
413 penpos3 (beam_width, 180);
415 save pat_in, pat_out;
416 path pat_in, pat_out;
422 -- reverse pat_out xscaled -1
423 shifted (2 xoffs + brevis_width, 0);
425 -- reverse pat_out yscaled -1
432 -- reverse pat_in xscaled -1
433 shifted (2 xoffs + brevis_width, 0);
435 -- reverse pat_in yscaled -1
447 % Draw two brevis notes; the second one shifted down by `shift'.
448 % The other parameters are the same as with `draw_brevis'.
450 def draw_double_brevis (expr exact_center, bwidth, bheight,
451 blinethickness, shift) =
452 save brevis_width, brevis_height, linethickness;
454 brevis_width# = bwidth;
455 brevis_height# = bheight;
456 linethickness# = blinethickness;
458 save beam_width, beam_height;
459 save serif_size, serif_protrude, hole_height;
461 beam_width# = 1.4 linethickness#;
462 hole_height# = 3 linethickness#;
463 2 beam_height# + hole_height# = brevis_height#;
464 serif_size# = (hole_height# - linethickness#) / 2;
465 serif_protrude# = 1.5 serif_size#;
469 xoffs# = xpart exact_center;
470 yoffs# = ypart exact_center;
472 define_pixels (xoffs, yoffs);
473 define_pixels (brevis_width, brevis_height, linethickness);
474 define_pixels (beam_width, beam_height, serif_size, serif_protrude);
476 z1l = (xoffs, yoffs - linethickness);
477 z2r = z1r + serif_size * (1, -1);
478 z3l = z2l + (-serif_size, -serif_protrude);
480 penpos1 (beam_width, 0);
481 penpos2 (beam_height, 90);
482 penpos3 (beam_width, 180);
484 z4 = z1 shifted (0, -shift);
485 z5 = z2 shifted (0, -shift);
486 z6 = z3 shifted (0, -shift);
488 penpos4 (beam_width, 0);
489 penpos5 (beam_height, 90);
490 penpos6 (beam_width, 180);
492 save pat_in, pat_out;
493 path pat_in, pat_out;
499 -- reverse pat_out xscaled -1
500 shifted (2 xoffs + brevis_width, 0);
502 -- reverse pat_out yscaled -1
503 shifted (0, shift - 2 yoffs)
511 -- reverse pat_in xscaled -1
512 shifted (2 xoffs + brevis_width, 0);
514 -- reverse pat_in yscaled -1
519 unfill pat_in shifted (0, -shift);
521 penlabels (1, 2, 3, 4, 5, 6);
525 def draw_neomensural_c_clef (expr exact_center, reduction) =
526 save reduced_il, reduced_slt, stem_width;
528 reduced_il# = staff_space# * reduction;
529 reduced_slt# = linethickness# * reduction;
530 stem_width# = 1.4 reduced_slt#;
532 define_pixels (reduced_il, reduced_slt, stem_width);
534 set_char_box (0 - xpart exact_center,
535 2 reduced_il# + 6 reduced_slt# + xpart exact_center,
536 2 reduced_il# - ypart exact_center,
537 2 reduced_il# + ypart exact_center);
539 draw_brevis (exact_center + (3 reduced_slt#, 0),
540 2 reduced_il#, reduced_il#, reduced_slt#);
544 xoffs# = xpart exact_center;
545 yoffs# = ypart exact_center;
547 define_pixels (xoffs, yoffs);
549 save ellipse, pat, T;
553 T := identity xscaled stem_width
554 yscaled blot_diameter;
555 pickup pencircle transformed T;
556 ellipse := fullcircle transformed T;
558 lft x11 = lft x12 = xoffs;
559 top y12 - bot y11 = 4 reduced_il;
560 top y12 + bot y11 = 2 yoffs;
567 pat := get_subpath (ellipse, down, up, z13)
572 fill get_subpath (ellipse, down, up, z11)
573 -- get_subpath (ellipse, up, down, z12)
575 fill get_subpath (ellipse, down, up, z14)
576 -- get_subpath (ellipse, up, down, z15)
583 shifted (0, 2 yoffs);
585 shifted (w, 2 yoffs);
587 labels (11, 12, 13, 14, 15);
591 fet_beginchar ("neo-mensural c clef", "neomensural.c");
593 draw_staff (-1, 3, 0.0);
595 draw_neomensural_c_clef ((0, 0), 1.0);
599 fet_beginchar ("neo-mensural c clef", "neomensural.c_change");
600 draw_neomensural_c_clef ((0, 0), .8);
604 def draw_petrucci_c_clef (expr exact_center, flare_align, reduction) =
605 % inspired by Josquin Desprez, "Stabat Mater", Libro tertio,
606 % 1519, printed by Petrucci, in: MGG, volume 7, Table 11.
607 % Also by Petrucci's Canti C, Venedig 1503. In: MGG, volume
610 save reduced_il, reduced_slt;
612 reduced_il# = staff_space# * reduction;
613 reduced_slt# = linethickness# * reduction;
615 define_pixels (reduced_il);
617 draw_double_brevis (exact_center + (0, 0.5 staff_space#),
618 reduced_il#, reduced_il#, reduced_slt#,
621 save half_reduced_il, left_depth, left_height;
623 half_reduced_il# = staff_space# * sqrt (reduction);
624 left_height# = half_reduced_il# * min (3.2, 3.2 + 0.2 + flare_align);
625 left_depth# = half_reduced_il# * min (3.2, 3.2 + 0.2 - flare_align);
627 define_pixels (half_reduced_il);
628 define_pixels (left_depth, left_height);
630 set_char_box (0 - xpart exact_center,
631 reduced_il# + xpart exact_center,
632 left_depth# - ypart exact_center,
633 left_height# + ypart exact_center);
637 xoffs# = xpart exact_center;
638 yoffs# = ypart exact_center;
640 define_pixels (xoffs, yoffs);
646 T := identity xscaled 1.4 linethickness
647 yscaled blot_diameter;
648 pickup pencircle transformed T;
649 ellipse := fullcircle transformed T;
651 lft x11 = lft x13 = xoffs;
652 top y11 = yoffs + left_height;
653 bot y13 = yoffs - left_depth;
654 rt x15 = rt x17 = xoffs + brevis_width;
655 y15 = min (y11 - 0.2 half_reduced_il, yoffs + 2.2 half_reduced_il);
656 y17 = max (y13 + 0.2 half_reduced_il, yoffs - 2.2 half_reduced_il);
658 z12 = z14 yscaled -1;
660 z16 = z18 yscaled -1;
661 rt z18 = lft z14 shifted (brevis_width, 0);
663 penpos12 (1.4 linethickness, 0);
664 penpos14 (1.4 linethickness, 0);
665 penpos16 (1.4 linethickness, 0);
666 penpos18 (1.4 linethickness, 0);
668 if top y11 > -y6 + 0.7 linethickness:
669 fill get_subpath (ellipse, up, down, z11)
674 if bot y13 < y6 - 0.7 linethickness:
675 fill get_subpath (ellipse, down, up, z13)
680 if top y15 > -y6 + 0.7 linethickness:
681 fill get_subpath (ellipse, up, down, z15)
686 if bot y17 < y6 - 0.7 linethickness:
687 fill get_subpath (ellipse, down, up, z17)
693 labels (11, 13, 15, 17);
694 penlabels (12, 14, 16, 18);
698 fet_beginchar ("petrucci c1 clef", "petrucci.c1");
700 draw_staff (-1, 3, 0.0);
702 draw_petrucci_c_clef ((0, 0), +2, 1.0);
706 fet_beginchar ("petrucci c1 clef", "petrucci.c1_change");
707 draw_petrucci_c_clef ((0, 0), +2, .8);
711 fet_beginchar ("petrucci c2 clef", "petrucci.c2");
713 draw_staff (-1, 3, 0.0);
715 draw_petrucci_c_clef ((0, 0), +1, 1.0);
719 fet_beginchar ("petrucci c2 clef", "petrucci.c2_change");
720 draw_petrucci_c_clef ((0, 0), +1, .8);
724 fet_beginchar ("petrucci c3 clef", "petrucci.c3");
726 draw_staff (-1, 3, 0.0);
728 draw_petrucci_c_clef ((0, 0), 0, 1.0);
732 fet_beginchar ("petrucci c3 clef", "petrucci.c3_change");
733 draw_petrucci_c_clef ((0, 0), 0, .8);
737 fet_beginchar ("petrucci c4 clef", "petrucci.c4");
739 draw_staff (-1, 3, 0.0);
741 draw_petrucci_c_clef ((0, 0), -1, 1.0);
745 fet_beginchar ("petrucci c4 clef", "petrucci.c4_change");
746 draw_petrucci_c_clef ((0, 0), -1, .8);
750 fet_beginchar ("petrucci c5 clef", "petrucci.c5");
752 draw_staff (-1, 3, 0.0);
754 draw_petrucci_c_clef ((0, 0), -2, 1.0);
758 fet_beginchar ("petrucci c5 clef", "petrucci.c5_change");
759 draw_petrucci_c_clef ((0, 0), -2, .8);
763 def draw_mensural_c_clef (expr exact_center, reduction, fill_char) =
764 save reduced_il, vert_thick, hor_thick, blot_rad;
766 reduced_il# = staff_space# * reduction;
767 vert_thick# = linethickness# * 1.4;
768 hor_thick# = staff_space# * reduction * 0.25;
770 blot_rad = blot_diameter / 2;
772 define_pixels (reduced_il, vert_thick, hor_thick);
774 pickup pencircle scaled blot_diameter;
776 penpos1 (vert_thick, 0);
777 penpos2 (vert_thick, 0);
778 penpos3 (hor_thick, 90);
779 penpos4 (hor_thick, 90);
780 penpos5 (hor_thick, 90);
781 penpos6 (hor_thick, 90);
782 penpos7 (vert_thick, 0);
783 penpos8 (hor_thick, 90);
787 top y2 = 2.2 reduced_il;
788 z3 = (vert_thick, 0.75 reduced_il);
789 z4 = z3 + (reduced_il - vert_thick, 0);
790 z5 = z4 + (vert_thick, -0.5 reduced_il);
791 z6 = z5 - (reduced_il, 0);
792 z7 = z4 + (0.5 vert_thick, 0.5 reduced_il);
793 z8 = z5 - (vert_thick, 0);
800 .. z2 + (0, blot_rad)
807 .. z7 + (0, blot_rad)
815 -- reverse pat yscaled -1
820 pat_mid = bot z3l{up}
831 pat_mid := pat_mid shifted (0, -reduced_il);
835 set_char_box (0, reduced_il# + vert_thick#,
836 2.2 reduced_il#, 2.2 reduced_il#);
838 penlabels (1, 2, 3, 4, 5, 6, 7, 8);
842 fet_beginchar ("mensural c clef", "mensural.c");
844 draw_staff (-1, 3, 0.0);
846 draw_mensural_c_clef ((0, 0), 1.0, true);
850 fet_beginchar ("mensural c clef", "mensural.c_change");
851 draw_mensural_c_clef ((0, 0), .8, true);
855 fet_beginchar ("black mensural c clef", "blackmensural.c");
857 draw_staff (-1, 3, 0.0);
859 draw_mensural_c_clef ((0, 0), 1.0, false);
863 fet_beginchar ("black mensural c clef", "blackmensural.c_change");
864 draw_mensural_c_clef ((0, 0), 0.8, false);
868 def draw_diamond (expr exact_center, reduction) =
869 save stem_width, reduced_nht, holeheight, beamheight;
870 save rh_height, rh_width;
872 stem_width# = 1.4 reduced_slt#;
873 reduced_nht# = noteheight# * reduction;
874 holeheight# = 3 reduced_slt#;
875 beamheight# = 0.4 (reduced_nht# - holeheight#);
877 rh_height# = 1.2 staff_space# * reduction;
878 rh_width# / rh_height# = tand (30);
880 define_pixels (beamheight, stem_width);
881 define_pixels (rh_height, rh_width);
885 xoffs# = xpart exact_center;
886 yoffs# = ypart exact_center;
888 define_pixels (xoffs, yoffs);
894 T := identity xscaled beamheight
897 pickup pencircle transformed T;
898 ellipse := reverse fullcircle transformed T;
900 x21 := xoffs - rh_width / 2;
903 y22 := yoffs + rh_height / 2;
904 x23 := xoffs + rh_width / 2;
907 y24 := yoffs - rh_height / 2;
909 fill get_subpath (ellipse, z21 - z24, z22 - z21, z21)
910 -- get_subpath (ellipse, z22 - z21, z23 - z22, z22)
911 -- get_subpath (ellipse, z23 - z22, z24 - z23, z23)
912 -- get_subpath (ellipse, z24 - z23, z21 - z24, z24)
918 l2122 := (directionpoint (z21 - z22) of ellipse) shifted z21
919 -- (directionpoint (z21 - z22) of ellipse) shifted z22;
920 l2223 := (directionpoint (z22 - z23) of ellipse) shifted z22
921 -- (directionpoint (z22 - z23) of ellipse) shifted z23;
922 l2324 := (directionpoint (z23 - z24) of ellipse) shifted z23
923 -- (directionpoint (z23 - z24) of ellipse) shifted z24;
924 l2421 := (directionpoint (z24 - z21) of ellipse) shifted z24
925 -- (directionpoint (z24 - z21) of ellipse) shifted z21;
927 unfill l2122 intersectionpoint l2223
928 -- l2223 intersectionpoint l2324
929 -- l2324 intersectionpoint l2421
930 -- l2421 intersectionpoint l2122
933 labels (21, 22, 23, 24);
937 def draw_petrucci_f_clef (expr exact_center, reduction) =
938 % inspired by L'homme arme super voces musicales in Misse
939 % Josquin, 1502, Petrucci, in: MGG, volume 7, col. 200; also
940 % inspired by Gaspar van Weerbeke, "Virgo Maria" (1502), in:
941 % MGG, volume 9, col. 653 ("Motette"), fig. 3.; also by Andr'e
942 % Campra, "Entr'ee des s'er'enades" (1710), in: MGG, volume 2,
943 % col. 1649 ("Contredanse"), fig. 2.
945 save interline, reduced_il, reduced_slt;
947 interline# = staff_space#;
948 reduced_il# = staff_space# * reduction;
949 reduced_slt# = linethickness# * reduction;
951 draw_brevis (exact_center, reduced_il#, reduced_il#, reduced_slt#);
952 draw_diamond (exact_center +
953 (1.6 interline# * reduction, interline# / 2),
955 draw_diamond (exact_center +
956 (1.6 interline# * reduction, -interline# / 2),
959 define_pixels (interline, reduced_il, reduced_slt);
963 stem_width# = 1.4 reduced_slt#;
965 define_pixels (stem_width);
969 xoffs# = xpart exact_center;
970 yoffs# = ypart exact_center;
972 define_pixels (xoffs, yoffs);
979 T := identity xscaled stem_width
980 yscaled blot_diameter;
981 pickup pencircle transformed T;
982 ellipse := fullcircle transformed T;
984 rt x8 = xoffs + reduced_il;
986 rt z9 = (xoffs + reduced_il, yoffs - 4 reduced_il);
988 penpos8 (stem_width, 0);
990 fill get_subpath (ellipse, down, up, z9)
995 % upper diamond's stem
996 z10 = (xoffs + 1.6 interline * reduction + stem_width / 2,
997 yoffs + interline * reduction);
998 top z11 = z10 + (0, 1.5 interline * reduction);
1000 penpos10 (stem_width, 0);
1002 fill get_subpath (ellipse, up, down, z11)
1007 % lower diamond's stem
1008 z12 = (xoffs + 1.6 interline * reduction - stem_width / 2,
1009 yoffs - interline * reduction);
1010 bot z13 = z12 + (0, -3.5 interline * reduction);
1012 penpos12 (stem_width, 0);
1014 fill get_subpath (ellipse, down, up, z13)
1019 save reduced_il, rh_height, rh_width;
1021 reduced_il# = staff_space# * reduction;
1022 rh_height# = 1.2 reduced_il#;
1023 rh_width# / rh_height# = tand (30);
1025 set_char_box (0 - xpart exact_center,
1026 1.6 interline# * reduction + 0.5 rh_width# +
1028 4.5 interline# * reduction - ypart exact_center,
1029 2.5 interline# * reduction + ypart exact_center);
1032 penlabels (8, 10, 12);
1036 fet_beginchar ("petrucci f clef", "petrucci.f");
1038 draw_staff (-1, 3, 0.0);
1040 draw_petrucci_f_clef ((0, 0), 1.0);
1044 fet_beginchar ("petrucci f clef", "petrucci.f_change");
1045 draw_petrucci_f_clef ((0, 0), .8);
1049 def draw_mensural_f_clef (expr exact_center, reduction) =
1050 % inspired by Philippe le Duc, "Dite Signori" (1590), in: MGG,
1051 % volume 3, col. 848 ("Duc"); also by John Dowland, "The First
1052 % Booke of Songes" (1597), in: MGG, volume 3, col. 721
1053 % ("Dowland"), fig. 3.
1055 save width, reduced_slt, stem_width, dot_diameter;
1057 width# = 1.2 staff_space# * reduction;
1058 reduced_slt# = linethickness# * reduction;
1059 stem_width# = 1.4 reduced_slt#;
1060 dot_diameter# = 0.1 reduction * staff_space#;
1062 define_pixels (width, stem_width, staff_space, dot_diameter);
1066 xoffs# = xpart exact_center;
1067 yoffs# = ypart exact_center;
1069 define_pixels (xoffs, yoffs);
1075 T := identity xscaled 0.2 width
1078 pickup pencircle transformed T;
1079 ellipse := fullcircle transformed T;
1087 pat := halfcircle scaled width
1089 shifted (z10 - (xoffs, yoffs));
1091 z5 = point 0 of pat;
1092 z6 = point 1 of pat;
1093 z7 = point 2 of pat;
1094 z8 = point 3 of pat;
1095 z9 = point 4 of pat;
1100 dirs5 := direction 0 of pat;
1101 dirs6 := direction 1 of pat;
1102 dirs7 := direction 2 of pat;
1103 dirs8 := direction 3 of pat;
1104 dirs9 := direction 4 of pat;
1106 % we approximate `draw pat'
1107 fill get_subpath (ellipse, -dirs5, dirs5, z5)
1108 .. get_subpoint (ellipse, dirs6, z6)
1109 .. get_subpoint (ellipse, dirs7, z7)
1110 .. get_subpoint (ellipse, dirs8, z8)
1111 .. get_subpath (ellipse, dirs9, -dirs9, z9)
1112 .. get_subpoint (ellipse, -dirs8, z8)
1113 .. get_subpoint (ellipse, -dirs7, z7)
1114 .. get_subpoint (ellipse, -dirs6, z6)
1118 rt x2 = xoffs + width;
1119 top y1 = yoffs + 0.5 width;
1120 z2 - z1 = (dot_diameter, -dot_diameter);
1122 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
1123 -- get_subpath (ellipse, z2 - z1, z1 - z2, z2)
1128 top y1 - bot y4 = width;
1129 z4 - z3 = (dot_diameter, -dot_diameter);
1131 fill get_subpath (ellipse, z3 - z4, z4 - z3, z3)
1132 -- get_subpath (ellipse, z4 - z3, z3 - z4, z4)
1135 set_char_box (0 - xpart exact_center,
1136 width# + xpart exact_center,
1137 0.5 width# - ypart exact_center,
1138 0.5 width# + ypart exact_center);
1140 labels (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1144 fet_beginchar ("mensural f clef", "mensural.f");
1146 draw_staff (-1, 3, 0.0);
1148 draw_mensural_f_clef ((0, 0), 1.0);
1152 fet_beginchar ("mensural f clef", "mensural.f_change");
1153 draw_mensural_f_clef ((0, 0), .8);
1157 def draw_petrucci_g_clef (expr exact_center, reduction) =
1158 % inspired by Josquin Desprez, "Stabat Mater", Libro tertio,
1159 % 1519, printed by Petrucci, in: MGG, volume 7, Table 11.
1161 save reduced_il, reduced_slt;
1163 reduced_il# = staff_space# * reduction;
1164 reduced_slt# = linethickness# * reduction;
1165 define_pixels (reduced_il, reduced_slt);
1167 set_char_box (0 - xpart exact_center,
1168 1.25 reduced_il# + xpart exact_center,
1169 0.65 reduced_il# - ypart exact_center,
1170 3.80 reduced_il# + ypart exact_center);
1174 xoffs# = xpart exact_center;
1175 yoffs# = ypart exact_center;
1177 define_pixels (xoffs, yoffs);
1179 save ellipse, paths, sub_path, outlines, sub_outlines, T;
1180 path ellipse, paths[], sub_path, outlines[], sub_outlines[];
1183 T := identity xscaled 0.5 reduced_slt
1184 yscaled 0.22 reduced_il
1186 pickup pencircle transformed T;
1187 ellipse := fullcircle transformed T;
1189 lft z1 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
1190 lft z2 = (xoffs + 1.00 reduced_il, yoffs + 1.20 reduced_il);
1191 lft z3 = (xoffs + 0.70 reduced_il, yoffs + 2.00 reduced_il);
1192 lft z4 = (xoffs + 0.30 reduced_il, yoffs + 3.00 reduced_il);
1193 lft z5 = (xoffs + 0.80 reduced_il, yoffs + 3.70 reduced_il);
1194 lft z6 = (xoffs + 1.00 reduced_il, yoffs + 3.00 reduced_il);
1195 lft z7 = (xoffs + 0.60 reduced_il, yoffs + 2.00 reduced_il);
1196 lft z8 = (xoffs + 0.30 reduced_il, yoffs + 1.70 reduced_il);
1197 lft z9 = (xoffs + 0.00 reduced_il, yoffs + 0.75 reduced_il);
1198 lft z10 = (xoffs + 0.20 reduced_il, yoffs + 0.60 reduced_il);
1216 % we approximate `draw paths1'
1217 for i = 1 step s until (length paths1 + 1):
1218 dirs[i] := direction (i - 1) of paths1;
1221 outlines1 := get_subpath (ellipse, -dirs1, dirs1, z1)
1222 for i = (1 + s) step s until (length paths1 + 1 - s):
1223 .. get_subpoint (ellipse, dirs[i],
1224 point (i - 1) of paths1)
1226 .. get_subpath (ellipse, dirs10, -dirs10, z10)
1227 for i = (length paths1 + 1 - s) step -s until (1 + s):
1228 .. get_subpoint (ellipse, -dirs[i],
1229 point (i - 1) of paths1)
1235 len := length outlines1;
1237 sub_outlines1 := subpath (0,
1238 floor (1/4 len)) of outlines1;
1239 sub_outlines2 := subpath (floor (1/4 len),
1240 floor (2/4 len)) of outlines1;
1241 sub_outlines3 := subpath (floor (2/4 len),
1242 floor (3/4 len)) of outlines1;
1243 sub_outlines4 := subpath (floor (3/4 len),
1249 (times12, times21) = sub_outlines1 intersectiontimes sub_outlines2;
1250 (times13, times31) = sub_outlines1 intersectiontimes sub_outlines3;
1251 (times42, times24) = sub_outlines4 intersectiontimes sub_outlines2;
1252 (times43, times34) = sub_outlines4 intersectiontimes sub_outlines3;
1254 T := identity xscaled 0.75 reduced_slt
1255 yscaled 0.33 reduced_il
1257 pickup pencircle transformed T;
1258 ellipse := fullcircle transformed T;
1260 lft z21 = (xoffs + 1.05 reduced_il, yoffs + 0.45 reduced_il);
1261 lft z22 = (xoffs + 0.55 reduced_il, yoffs + 0.45 reduced_il);
1262 lft z23 = (xoffs + 0.55 reduced_il, yoffs - 0.45 reduced_il);
1263 lft z24 = (xoffs + 1.05 reduced_il, yoffs - 0.45 reduced_il);
1264 lft z25 = (xoffs + 1.10 reduced_il, yoffs + 0.00 reduced_il);
1265 lft z26 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
1274 sub_path := subpath (0, 1) of paths2;
1276 times1 = xpart (sub_outlines1 intersectiontimes sub_path);
1277 times4 = xpart (sub_outlines4 intersectiontimes sub_path);
1279 % we have to find the envelope intersections (if any)
1283 t1 = find_envelope_cusp (reverse ellipse,
1284 subpath (1, 2) of paths2,
1290 t2 = find_envelope_cusp (ellipse,
1291 subpath (3, 4) of reverse paths2,
1293 t2 := length paths2 - t2;
1296 t3 = find_envelope_cusp (reverse ellipse,
1297 subpath (2, 4 - epsilon) of paths2,
1303 t4 = find_envelope_cusp (ellipse,
1304 subpath (1 + epsilon, 3)
1307 t4 := length paths2 - t4;
1310 fill subpath (times1 + s / 4, times13) of sub_outlines1
1311 -- subpath (times31, infinity) of sub_outlines3
1312 & subpath (0, times42) of sub_outlines4
1313 -- subpath (times24, infinity) of sub_outlines2
1314 & subpath (0, times34) of sub_outlines3
1315 -- subpath (times43, times4 - s / 4) of sub_outlines4
1317 unfill subpath (times12, infinity) of sub_outlines1
1318 & subpath (0, times21) of sub_outlines2
1320 fill subpath (times4 + s / 4, infinity) of sub_outlines4
1321 & subpath (0, times1 - s / 4) of sub_outlines1
1325 % we approximate `draw paths2'
1326 for i = 1 step s until (length paths2 - s):
1327 dirs[i + 20] := direction (i - 1) of paths2;
1330 sub_outlines21 := get_subpath (ellipse, -dirs21, dirs21, z21)
1331 for i = (1 + s) step s until (length paths2 - s):
1332 .. get_subpoint (ellipse, dirs[i + 20],
1333 point (i - 1) of paths2)
1335 .. get_subpath (ellipse, up, z26 - z25, z25);
1336 sub_outlines22 := get_subpath (ellipse, z26 - z25, z25 - z26, z26)
1337 -- get_subpoint (ellipse, z25 - z26, z25);
1338 sub_outlines23 := get_subpoint (ellipse, down, z25)
1339 for i = (length paths2 - s) step -s until (t4 + 1):
1340 .. get_subpoint (ellipse, -dirs[i + 20],
1341 point (i - 1) of paths2)
1343 .. get_subpoint (ellipse, -direction t4 of paths2,
1344 point t4 of paths2);
1345 sub_outlines24 := get_subpoint (ellipse, -direction t3 of paths2,
1347 for i = (floor (t3 / s) * s + 1) step -s until (t2 + 1):
1348 .. get_subpoint (ellipse, -dirs[i + 20],
1349 point (i - 1) of paths2)
1351 .. get_subpoint (ellipse, -direction t2 of paths2,
1352 point t2 of paths2);
1353 sub_outlines25 := get_subpoint (ellipse, -direction t1 of paths2,
1355 for i = (floor (t1 / s) * s + 1) step -s until (1 + s):
1356 .. get_subpoint (ellipse, -dirs[i + 20],
1357 point (i - 1) of paths2)
1360 (times2223, times2322) = sub_outlines22 intersectiontimes sub_outlines23;
1361 (times2324, times2423) = sub_outlines23 intersectiontimes sub_outlines24;
1362 (times2425, times2524) = sub_outlines24 intersectiontimes sub_outlines25;
1365 -- subpath (0, times2223) of sub_outlines22
1366 -- subpath (times2322, times2324) of sub_outlines23
1367 -- subpath (times2423, times2425) of sub_outlines24
1368 -- subpath (times2524, infinity) of sub_outlines25
1371 labels (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1372 labels (21, 22, 23, 24, 25, 26);
1376 fet_beginchar ("petrucci g clef", "petrucci.g");
1378 draw_staff (-1, 3, 0.0);
1380 draw_petrucci_g_clef ((0, 0), 1.0);
1384 fet_beginchar ("petrucci g clef", "petrucci.g_change");
1385 draw_petrucci_g_clef ((0, 0), .8);
1389 def draw_mensural_g_clef (expr exact_center, reduction) =
1390 % TODO: Rewrite me. The former mensural g clef looked ugly, and the
1391 % code was removed when it broke for small font sizes after some
1392 % global changes in the font. Currently, the character is mapped to
1393 % a copy of the petrucci g clef (which, after all, *is* a mensural g
1394 % clef, but not the one that we have in mind here). -- jr
1396 % Possible sources of inspiration for this clef include: Francisco
1397 % Guerrero, "Lib. 1. Missarum" (1566), in: MGG, volume 3, col. 858
1398 % ("Ducis"); Stefano Fabri, "Quam speciosa veteranis" (1611), in:
1399 % MGG, volume 3, col. 1698 ("Fabri"); Philippus Dulichius,
1400 % "Fasciculus novus ..." (1598), in: MGG, volume 3, col. 919
1401 % ("Dulichius"), fig. 1; Noe Faignient, "Ic sal de Heer myn God
1402 % gebenedye" (1568), in: MGG, volume 3, col. 1735 ("Faignient").
1407 % FIXME: This clef is preliminarily mapped to the petrucci g clef
1408 % until the code for the mensural g clef will be rewritten.
1410 fet_beginchar ("mensural g clef", "mensural.g");
1412 draw_staff (-1, 3, 0.0);
1414 draw_petrucci_g_clef ((0, 0), 1.0);
1418 fet_beginchar ("mensural g clef", "mensural.g_change");
1419 draw_petrucci_g_clef ((0, 0), .8);
1432 def draw_hufnagel_do_clef (expr exact_center, reduction) =
1433 % inspired by Graduale of Friedrich Zollner (1442), in: MGG,
1434 % volume 9, col. 1413 ("Neustift"), fig. 1.
1438 reduced_il# = staff_space# * reduction;
1440 define_pixels (reduced_il);
1442 set_char_box (0 - xpart exact_center,
1443 1.10 reduced_il# + xpart exact_center,
1444 0.70 reduced_il# - ypart exact_center,
1445 0.75 reduced_il# + ypart exact_center);
1449 xoffs# = xpart exact_center;
1450 yoffs# = ypart exact_center;
1452 define_pixels (xoffs, yoffs);
1454 save ellipse, pat, T;
1458 T := identity xscaled 0.6 reduced_il
1459 yscaled 0.1 reduced_il
1461 pickup pencircle transformed T;
1462 ellipse := fullcircle transformed T;
1464 z1 = (xoffs + 0.90 reduced_il, yoffs + .45 reduced_il);
1465 z2 = (xoffs + 0.80 reduced_il, yoffs + .45 reduced_il);
1466 z3 = (xoffs + 0.50 reduced_il, yoffs + .60 reduced_il);
1467 z4 = (xoffs + 0.20 reduced_il, yoffs + .45 reduced_il);
1468 z5 = (xoffs + 0.20 reduced_il, yoffs - .45 reduced_il);
1469 z6 = (xoffs + 0.40 reduced_il, yoffs - .55 reduced_il);
1478 fill get_subpath (ellipse,
1479 -direction 0 of pat, direction 0 of pat, z1)
1480 .. get_subpoint (ellipse, direction 1 of pat, z2)
1481 .. get_subpath (ellipse,
1482 direction (2 - epsilon) of pat, z4 - z3, z3)
1483 -- get_subpath (ellipse,
1484 z4 - z3, z5 - z4, z4)
1485 -- get_subpath (ellipse,
1486 z5 - z4, z6 - z5, z5)
1487 -- get_subpath (ellipse,
1488 z6 - z5, z5 - z6, z6)
1489 -- get_subpoint (ellipse, z5 - z6, z5)
1490 -- get_subpoint (ellipse, z4 - z5, z5)
1491 -- get_subpoint (ellipse, z4 - z5, z4)
1492 -- get_subpoint (ellipse, -direction (2 - epsilon) of pat, z3)
1493 .. get_subpath (ellipse,
1494 -direction 1 of pat, -direction 1 of pat, z2)
1497 labels (1, 2, 3, 4, 5, 6);
1501 fet_beginchar ("Hufnagel do clef", "hufnagel.do");
1503 draw_staff (-1, 3, 0.0);
1505 draw_hufnagel_do_clef ((0, 0), 1.0);
1509 fet_beginchar ("Hufnagel do clef", "hufnagel.do_change");
1510 draw_hufnagel_do_clef ((0, 0), .8);
1514 def draw_hufnagel_fa_clef (expr exact_center, reduction) =
1515 % inspired by Bamberger Manuscript (15th century), in:
1516 % MGG, volume 2, table 59.
1520 reduced_il# = staff_space# * reduction;
1522 define_pixels (reduced_il);
1524 set_char_box (0 - xpart exact_center,
1525 1.20 reduced_il# + xpart exact_center,
1526 1.15 reduced_il# - ypart exact_center,
1527 1.00 reduced_il# + ypart exact_center);
1531 xoffs# = xpart exact_center;
1532 yoffs# = ypart exact_center;
1534 define_pixels (xoffs, yoffs);
1536 save ellipse, pat, T;
1540 T := identity xscaled 0.6 reduced_il
1541 yscaled 0.1 reduced_il
1543 pickup pencircle transformed T;
1544 ellipse := fullcircle transformed T;
1546 z11 = (xoffs + 0.90 reduced_il, yoffs + 0.70 reduced_il);
1547 z12 = (xoffs + 0.80 reduced_il, yoffs + 0.70 reduced_il);
1548 z13 = (xoffs + 0.50 reduced_il, yoffs + 0.85 reduced_il);
1549 z14 = (xoffs + 0.20 reduced_il, yoffs + 0.70 reduced_il);
1550 z15 = (xoffs + 0.20 reduced_il, yoffs - 1.10 reduced_il);
1558 fill get_subpath (ellipse,
1559 -direction 0 of pat, direction 0 of pat, z11)
1560 .. get_subpoint (ellipse, direction 1 of pat, z12)
1561 .. get_subpath (ellipse,
1562 direction (2 - epsilon) of pat, z14 - z13, z13)
1563 -- get_subpath (ellipse,
1564 z14 - z13, z15 - z14, z14)
1565 -- get_subpath (ellipse,
1566 z15 - z14, z14 - z15, z15)
1567 -- get_subpoint (ellipse, z14 - z15, z14)
1568 -- get_subpoint (ellipse, -direction (2 - epsilon) of pat, z13)
1569 .. get_subpath (ellipse,
1570 -direction 1 of pat, -direction 1 of pat, z12)
1573 z16 = (xoffs + 0.90 reduced_il, yoffs - 0.05 reduced_il);
1574 z17 = (xoffs + 0.80 reduced_il, yoffs - 0.05 reduced_il);
1575 z18 = (xoffs + 0.50 reduced_il, yoffs + 0.10 reduced_il);
1576 z19 = (xoffs + 0.20 reduced_il, yoffs - 0.05 reduced_il);
1583 fill get_subpath (ellipse,
1584 -direction 0 of pat, direction 0 of pat, z16)
1585 .. get_subpoint (ellipse, direction 1 of pat, z17)
1586 .. get_subpath (ellipse,
1587 direction (2 - epsilon) of pat, z19 - z18, z18)
1588 -- get_subpoint (ellipse, z19 - z18, z19)
1589 -- get_subpoint (ellipse, -direction (2 - epsilon) of pat, z18)
1590 .. get_subpoint (ellipse, -direction 1 of pat, z17)
1593 labels (11, 12, 13, 14, 15, 16, 17, 18, 19);
1597 fet_beginchar ("Hufnagel fa clef", "hufnagel.fa");
1599 draw_staff (-1, 3, 0.0);
1601 draw_hufnagel_fa_clef ((0, 0), 1.0);
1605 fet_beginchar ("Hufnagel fa clef", "hufnagel.fa_change");
1606 draw_hufnagel_fa_clef ((0, 0), .8);
1610 def draw_hufnagel_do_fa_clef (expr exact_center, reduction) =
1611 draw_hufnagel_do_clef (exact_center, reduction);
1612 draw_hufnagel_fa_clef (exact_center + (0, -2 staff_space#), reduction);
1614 set_char_box (0 - xpart exact_center,
1615 1.20 reduced_il# + xpart exact_center,
1616 1.15 reduced_il# + 2 staff_space# - ypart exact_center,
1617 0.75 reduced_il# + ypart exact_center);
1621 fet_beginchar ("Hufnagel do/fa clef", "hufnagel.do.fa");
1623 draw_staff (-1, 3, 0.0);
1625 draw_hufnagel_do_fa_clef ((0, 0), 1.0);
1629 fet_beginchar ("Hufnagel do/fa clef", "hufnagel.do.fa_change");
1630 draw_hufnagel_do_fa_clef ((0, 0), .8);
1636 %% Medieval East-Slavic (Kievan) Notation clefs
1637 %% Code by Aleksandr Andreev <aleksandr.andreev@gmail.com>
1641 def draw_kievan_do_clef =
1642 z1 = (1.108 staff_space, 0.554 staff_space);
1643 z2 = (1.063 staff_space, -0.122 staff_space);
1644 z3 = (1.467 staff_space, -1.621 staff_space);
1645 z4 = (1.002 staff_space, -2.253 staff_space);
1650 z6 = (0.917 staff_space, -0.383 staff_space);
1651 z7 = (0.012 staff_space, -0.448 staff_space);
1652 z8 = (0, -0.167 staff_space);
1653 z9 = (0.057 staff_space, 0.464 staff_space);
1654 z10 = (0.994 staff_space, 0.387 staff_space);
1655 z11 = (1.023 staff_space, 0.554 staff_space);
1674 set_char_box (0, 1.5 staff_space#,
1675 2.25 staff_space#, 0.55 staff_space#);
1679 fet_beginchar ("Kievan tsefaut clef", "kievan.do");
1680 % This draws the Tse-Fa-Ut clef; it is a variant alto clef that
1681 % always occurs on the third line of the staff.
1682 draw_kievan_do_clef;
1686 fet_beginchar ("Kievan tsefaut clef", "kievan.do_change");
1687 % This is the same thing as a do clef?
1688 draw_kievan_do_clef;
1691 fet_endgroup ("clefs");