- %
- % This code is completely undebuggable.
- %
- % the shift command is forbidden because (pen)labels come out
- % completely wrong
- %
-
- %
- % inspired by Francisco Guerrero, "Lib. 1. Missarum" (1566),
- % in: MGG, volume 3, col. 858 ("Ducis"); also by Stefano
- % Fabri, "Quam speciosa veteranis" (1611), in: MGG, volume 3,
- % col. 1698 ("Fabri"); also by Philippus Dulichius,
- % "Fasciculus novus ..." (1598), in: MGG, volume 3, col. 919
- % ("Dulichius"), fig. 1; also by Noe Faignient, "Ic sal de
- % Heer myn God gebenedye" (1568), in: MGG, volume 3, col. 1735
- % ("Faignient").
- %
- % Metafont code partially inspired by Schwabacher 'G' of yswab
- % font.
-
- save reduced_il, stem_width, height, width, apex_o, hair;
-
- reduced_il#=staff_space#*reduction;
-
- set_char_box(0 - xpart exact_center,
- 1.2reduced_il# + xpart exact_center,
- 0.8reduced_il# - ypart exact_center,
- 1.5reduced_il# + ypart exact_center);
-
- stem_width# = 0.17 reduced_il#;
- height# = 1.5 reduced_il#;
- width# = 1.13 reduced_il#;
- apex_o# = 0.02 reduced_il#;
- hair# = 3 linethickness#;
- define_pixels(reduced_il, stem_width, height, width, apex_o, hair);
-
- penpos1(2 stem_width, -142);
- z1l = (0.715 width, 0.742 height);
- penpos1'(hair, -90);
- z1'l = z1r;
- penpos2(1.179 stem_width, -142);
- z2l = (width, 0.466 height);
- penpos3(hair, 77);
- z3 = (0.764 width, 0.067 height);
- z4 = (0.59 width, -apex_o);
- penpos5(1.179 stem_width, 32);
- z5l=(0, 0.457 height);
- penpos6(hair, -56.5);
- z7 = (x4 - 0.843 stem_width, height + apex_o);
- z7 - z6l = whatever * dir33.5;
- penpos8(1.286 stem_width, -130);
- z8r = (0.715 width, 0.742 height) + (-apex_o, apex_o);
- z6r - z8r = whatever * (z7 - z8l);
- filldraw
- z1'r{dir45} .. z2r{down} .. z3r{dir207} .. z5r{up} ..
- z6r{z7-z6l} & z6r -- z8r -- z8l -- z7 --- z6l ...
- z5l{down} .. z4{right} .. z3l{dir27} .. z2l{up} ..
- z1l{1/3[z6l,z7]-z1l} & z1l -- z1r -- z1'r & cycle
- shifted (-exact_center + (0, -0.75reduced_il));
-
- penpos9(stem_width, 0);
- x9r = x4; y9 = 0.3 height;
-
- pickup pencircle
- scaled stem_width
- rotated 45;
- draw z9 -- (z9 + (0, -0.4reduced_il))
- shifted (-exact_center + (0, -0.75reduced_il));
-
- pickup pencircle
- xscaled stem_width
- yscaled hair
- rotated 30;
-
- draw halfcircle
- scaled 0.5 reduced_il
- rotated -90
- shifted z8
- shifted (0, 0.25reduced_il)
- shifted (-exact_center + (0, -0.75reduced_il));
-
- draw halfcircle
- scaled 0.4 reduced_il
- rotated 90
- shifted (z8 + (0, 0.45 reduced_il))
- shifted (0, 0.25reduced_il)
- shifted (-exact_center + (0, -0.75reduced_il));
+ reduced_il# = staff_space# * reduction;
+ reduced_slt# = linethickness# * reduction;
+ define_pixels (reduced_il, reduced_slt);
+
+ set_char_box (0 - xpart exact_center,
+ 1.25 reduced_il# + xpart exact_center,
+ 0.65 reduced_il# - ypart exact_center,
+ 3.80 reduced_il# + ypart exact_center);
+
+ save xoffs, yoffs;
+
+ xoffs# = xpart exact_center;
+ yoffs# = ypart exact_center;
+
+ define_pixels (xoffs, yoffs);
+
+ save ellipse, paths, sub_path, outlines, sub_outlines, T;
+ path ellipse, paths[], sub_path, outlines[], sub_outlines[];
+ transform T;
+
+ T := identity xscaled 0.5 reduced_slt
+ yscaled 0.22 reduced_il
+ rotated -35;
+ pickup pencircle transformed T;
+ ellipse := fullcircle transformed T;
+
+ lft z1 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
+ lft z2 = (xoffs + 1.00 reduced_il, yoffs + 1.20 reduced_il);
+ lft z3 = (xoffs + 0.70 reduced_il, yoffs + 2.00 reduced_il);
+ lft z4 = (xoffs + 0.30 reduced_il, yoffs + 3.00 reduced_il);
+ lft z5 = (xoffs + 0.80 reduced_il, yoffs + 3.70 reduced_il);
+ lft z6 = (xoffs + 1.00 reduced_il, yoffs + 3.00 reduced_il);
+ lft z7 = (xoffs + 0.60 reduced_il, yoffs + 2.00 reduced_il);
+ lft z8 = (xoffs + 0.30 reduced_il, yoffs + 1.70 reduced_il);
+ lft z9 = (xoffs + 0.00 reduced_il, yoffs + 0.75 reduced_il);
+ lft z10 = (xoffs + 0.20 reduced_il, yoffs + 0.60 reduced_il);
+
+ paths1 := z1{-1, 2}
+ .. z2
+ .. z3
+ .. z4
+ .. z5
+ .. z6
+ .. z7
+ .. z8
+ .. z9
+ .. z10;
+
+ save dirs, s;
+ pair dirs[];
+
+ s := 1/4;
+
+ % we approximate `draw paths1'
+ for i = 1 step s until (length paths1 + 1):
+ dirs[i] := direction (i - 1) of paths1;
+ endfor;
+
+ outlines1 := get_subpath (ellipse, -dirs1, dirs1, z1)
+ for i = (1 + s) step s until (length paths1 + 1 - s):
+ .. get_subpoint (ellipse, dirs[i],
+ point (i - 1) of paths1)
+ endfor
+ .. get_subpath (ellipse, dirs10, -dirs10, z10)
+ for i = (length paths1 + 1 - s) step -s until (1 + s):
+ .. get_subpoint (ellipse, -dirs[i],
+ point (i - 1) of paths1)
+ endfor
+ .. cycle;
+
+ save len;
+
+ len := length outlines1;
+
+ sub_outlines1 := subpath (0,
+ floor (1/4 len)) of outlines1;
+ sub_outlines2 := subpath (floor (1/4 len),
+ floor (2/4 len)) of outlines1;
+ sub_outlines3 := subpath (floor (2/4 len),
+ floor (3/4 len)) of outlines1;
+ sub_outlines4 := subpath (floor (3/4 len),
+ len) of outlines1;
+
+ save times;
+ numeric times[];
+
+ (times12, times21) = sub_outlines1 intersectiontimes sub_outlines2;
+ (times13, times31) = sub_outlines1 intersectiontimes sub_outlines3;
+ (times42, times24) = sub_outlines4 intersectiontimes sub_outlines2;
+ (times43, times34) = sub_outlines4 intersectiontimes sub_outlines3;
+
+ T := identity xscaled 0.75 reduced_slt
+ yscaled 0.33 reduced_il
+ rotated -35;
+ pickup pencircle transformed T;
+ ellipse := fullcircle transformed T;
+
+ lft z21 = (xoffs + 1.05 reduced_il, yoffs + 0.45 reduced_il);
+ lft z22 = (xoffs + 0.55 reduced_il, yoffs + 0.45 reduced_il);
+ lft z23 = (xoffs + 0.55 reduced_il, yoffs - 0.45 reduced_il);
+ lft z24 = (xoffs + 1.05 reduced_il, yoffs - 0.45 reduced_il);
+ lft z25 = (xoffs + 1.10 reduced_il, yoffs + 0.00 reduced_il);
+ lft z26 = (xoffs + 0.80 reduced_il, yoffs + 0.00 reduced_il);
+
+ paths2 := z21
+ .. z22
+ .. z23
+ .. z24
+ .. {up}z25
+ -- z26;
+
+ sub_path := subpath (0, 1) of paths2;
+
+ times1 = xpart (sub_outlines1 intersectiontimes sub_path);
+ times4 = xpart (sub_outlines4 intersectiontimes sub_path);
+
+ % we have to find the envelope intersections (if any)
+ save t;
+ numeric t[];
+
+ t1 = find_envelope_cusp (reverse ellipse,
+ subpath (1, 2) of paths2,
+ 1/256) + 1;
+ if t1 < 1:
+ t1 := 1;
+ t2 := 1;
+ else:
+ t2 = find_envelope_cusp (ellipse,
+ subpath (3, 4) of reverse paths2,
+ 1/256) + 3;
+ t2 := length paths2 - t2;
+ fi;
+
+ t3 = find_envelope_cusp (reverse ellipse,
+ subpath (2, 4 - epsilon) of paths2,
+ 1/256) + 2;
+ if t3 < 2:
+ t3 := 3;
+ t4 := 3;
+ else:
+ t4 = find_envelope_cusp (ellipse,
+ subpath (1 + epsilon, 3)
+ of reverse paths2,
+ 1/256) + 1;
+ t4 := length paths2 - t4;
+ fi;
+
+ fill subpath (times1 + s / 4, times13) of sub_outlines1
+ -- subpath (times31, infinity) of sub_outlines3
+ & subpath (0, times42) of sub_outlines4
+ -- subpath (times24, infinity) of sub_outlines2
+ & subpath (0, times34) of sub_outlines3
+ -- subpath (times43, times4 - s / 4) of sub_outlines4
+ -- cycle;
+ unfill subpath (times12, infinity) of sub_outlines1
+ & subpath (0, times21) of sub_outlines2
+ -- cycle;
+ fill subpath (times4 + s / 4, infinity) of sub_outlines4
+ & subpath (0, times1 - s / 4) of sub_outlines1
+ -- cycle;
+
+
+ % we approximate `draw paths2'
+ for i = 1 step s until (length paths2 - s):
+ dirs[i + 20] := direction (i - 1) of paths2;
+ endfor;
+
+ sub_outlines21 := get_subpath (ellipse, -dirs21, dirs21, z21)
+ for i = (1 + s) step s until (length paths2 - s):
+ .. get_subpoint (ellipse, dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor
+ .. get_subpath (ellipse, up, z26 - z25, z25);
+ sub_outlines22 := get_subpath (ellipse, z26 - z25, z25 - z26, z26)
+ -- get_subpoint (ellipse, z25 - z26, z25);
+ sub_outlines23 := get_subpoint (ellipse, down, z25)
+ for i = (length paths2 - s) step -s until (t4 + 1):
+ .. get_subpoint (ellipse, -dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor
+ .. get_subpoint (ellipse, -direction t4 of paths2,
+ point t4 of paths2);
+ sub_outlines24 := get_subpoint (ellipse, -direction t3 of paths2,
+ point t3 of paths2)
+ for i = (floor (t3 / s) * s + 1) step -s until (t2 + 1):
+ .. get_subpoint (ellipse, -dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor
+ .. get_subpoint (ellipse, -direction t2 of paths2,
+ point t2 of paths2);
+ sub_outlines25 := get_subpoint (ellipse, -direction t1 of paths2,
+ point t1 of paths2)
+ for i = (floor (t1 / s) * s + 1) step -s until (1 + s):
+ .. get_subpoint (ellipse, -dirs[i + 20],
+ point (i - 1) of paths2)
+ endfor;
+
+ (times2223, times2322) = sub_outlines22 intersectiontimes sub_outlines23;
+ (times2324, times2423) = sub_outlines23 intersectiontimes sub_outlines24;
+ (times2425, times2524) = sub_outlines24 intersectiontimes sub_outlines25;
+
+ fill sub_outlines21
+ -- subpath (0, times2223) of sub_outlines22
+ -- subpath (times2322, times2324) of sub_outlines23
+ -- subpath (times2423, times2425) of sub_outlines24
+ -- subpath (times2524, infinity) of sub_outlines25
+ .. cycle;
+
+ labels (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ labels (21, 22, 23, 24, 25, 26);