Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / mf / parmesan-accidentals.mf
blobb5fe66306128aa5cc837cf5d242a38101a874c61
1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-accidentals.mf -- implement ancient accidentals
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 2001--2009 Juergen Reuter <reuter@ipd.uka.de>
7
9 fet_begingroup ("accidentals");
12 %%%%%%%%
16 % EDITIO MEDICAEA
20 fet_beginchar ("Ed. Med. Flat" , "medicaeaM1");
21         set_char_box (0.1 staff_space#, 0.6 staff_space#,
22                       0.6 staff_space#, 1.0 staff_space#);
24         save ellipse, pat, outline, T;
25         path ellipse, pat, outline;
26         transform T;
28         T := identity xscaled 0.50 linethickness
29                       yscaled 0.22 staff_space;
30         pickup pencircle transformed T;
31         ellipse := fullcircle transformed T;
33         x1 = x2 = 0;
34         top y1 = h;
35         bot y2 = -d;
37         fill get_subpath (ellipse, up, down, z1)
38              -- get_subpath (ellipse, down, up, z2)
39              -- cycle;
41         T := identity xscaled 0.50 linethickness
42                       yscaled 0.22 staff_space
43                       rotated -63;
44         pickup pencircle transformed T;
45         ellipse := fullcircle transformed T;
47         z3 = (0.10 staff_space, -0.50 staff_space);
48         z4 = (0.40 staff_space, +0.40 staff_space);
49         z5 = (0.10 staff_space, +0.40 staff_space);
51         pat := z3{(1, 2)}
52                .. z4
53                .. z5{(-1, -1)};
55         % the original envelope curve created with `draw' contains
56         % cusps which we avoid
57         outline := get_subpath (ellipse, -direction 0 of pat,
58                                 direction 0 of pat, z3)
59                    .. get_subpoint (ellipse, direction 1 of pat, z4)
60                    .. get_subpath (ellipse, direction 2 of pat,
61                                    -direction 1.8 of pat, z5)
62                    .. get_subpoint (ellipse, -direction 1 of pat, z4)
63                         {-direction 1 of pat}
64                    .. cycle;
66         save shift;
67         pair shift;
69         % make the outline touch the bounding box
70         shift = find_tangent_shift (((w, -d) -- (w, h)), outline,
71                                     (b, 0), (-b, 0));
72         outline := outline shifted shift;
74         fill outline;
76         labels (1, 2, 3, 4, 5);
77 fet_endchar;
80 %%%%%%%%
84 % EDITIO VATICANA
88 fet_beginchar ("Ed. Vat. Flat" , "vaticanaM1");
89         z1 = (0.00 staff_space, +0.80 staff_space);
90         z2 = (0.00 staff_space, -0.08 staff_space);
91         z3 = (0.25 staff_space, -0.23 staff_space);
92         z4 = (0.50 staff_space, -0.24 staff_space);
93         z5 = (0.50 staff_space, +0.03 staff_space);
94         z6 = (0.25 staff_space, +0.20 staff_space);
95         z7 = (0.15 staff_space, +0.26 staff_space);
97         save pat, ellipse, T;
98         path pat, ellipse;
99         transform T;
101         T := identity xscaled 0.50 linethickness
102                       yscaled 0.22 staff_space;
103         pickup pencircle transformed T;
104         ellipse := fullcircle transformed T;
106         pat := z1
107                -- z2{down}
108                ... z3
109                ... {up}z4
110                -- z5{up}
111                .. z6
112                .. z7;
114         % the original envelope curve created with `draw' contains
115         % cusps which we avoid
116         fill get_subpath (ellipse, up, down, z1)
117              -- get_subpath (ellipse, down, direction 1.1 of pat, z2)
118              ... bot z3
119              ... get_subpath (ellipse, direction 2.9 of pat, up, z4)
120              -- get_subpath (ellipse, up, direction 4.1 of pat, z5)
121              .. top z6
122              .. get_subpath (ellipse,
123                              direction 6 of pat, -direction 6 of pat, z7)
124              .. bot z6
125              .. {down}bot lft z5
126              -- top lft z4{down}
127              ... top z3
128              ... top rt z2{up}
129              -- cycle;
131         set_char_box (0.00 staff_space# + 0.25 linethickness#,
132                       0.50 staff_space# + 0.25 linethickness#,
133                       0.23 staff_space# + 0.11 staff_space#,
134                       0.80 staff_space# + 0.11 staff_space#);
136         labels (1, 2, 3, 4, 5, 6, 7);
137 fet_endchar;
140 fet_beginchar ("Ed. Vat. Natural" , "vaticana0");
141         save ellipse, T;
142         path ellipse;
143         transform T;
145         T := identity xscaled 0.80 linethickness
146                       yscaled 0.22 staff_space;
147         pickup pencircle transformed T;
148         ellipse := fullcircle transformed T;
150         z1 = (0.00 staff_space, +0.65 staff_space);
151         z2 = (0.00 staff_space, -0.35 staff_space);
153         fill get_subpath (ellipse, up, down, z1)
154              -- get_subpath (ellipse, down, up, z2)
155              -- cycle;
157         pickup penrazor scaled 0.22 staff_space
158                         rotated 90;
160         z3 = (0.00 staff_space, -0.30 staff_space);
161         z4 = (0.40 staff_space, -0.08 staff_space);
163         draw z3
164              -- z4;
166         addto currentpicture also currentpicture
167           xscaled -1
168           yscaled -1
169           shifted (0.40 staff_space, 0.0 staff_space);
171         set_char_box (0.00 staff_space# + 0.40 linethickness#,
172                       0.40 staff_space# + 0.40 linethickness#,
173                       0.65 staff_space# + 0.11 staff_space#,
174                       0.65 staff_space# + 0.11 staff_space#);
176         labels (1, 2, 3, 4);
177 fet_endchar;
180 %%%%%%%%
184 % MENSURAL NOTATION
188 fet_beginchar ("Mensural Sharp" , "mensural1");
189         save stemthick;
191         define_pixels (stemthick);
193         stemthick# = linethickness#;
195         save circle, pat, T;
196         path circle, pat;
197         transform T;
199         T := identity scaled 0.8 stemthick;
200         pickup pencircle transformed T;
201         circle := fullcircle transformed T;
203         z1 = 0.4 staff_space * (0.8, 1);
204         z1 = -z2;
206         pat := get_subpath (circle, z1 - z2, z2 - z1, z1)
207                -- get_subpath (circle, z2 - z1, z1 - z2, z2)
208                -- cycle;
210         fill pat;
211         fill pat xscaled -1;
212         fill pat shifted (0.20 staff_space, 0);
213         fill pat xscaled -1 shifted (0.20 staff_space, 0);
215         set_char_box (0.8 * 0.4 staff_space# + 0.4 stemthick#,
216                       (0.8 * 0.4 + 0.2) * staff_space# + 0.4 stemthick#,
217                       0.4 staff_space# + 0.4 stemthick#, 
218                       0.4 staff_space# + 0.4 stemthick#);
220         labels (1, 2);
221 fet_endchar;
224 fet_beginchar ("Mensural Flat" , "mensuralM1");
225         save stemthick;
227         define_pixels (stemthick);
229         stemthick# = linethickness#;
231         save ellipse, pat, outline, T;
232         path ellipse, pat, outline;
233         transform T;
235         T := identity xscaled 1.4 stemthick
236                       yscaled 0.6 stemthick
237                       rotated 45;
238         pickup pencircle transformed T;
239         ellipse := fullcircle transformed T;
241         z1 = (0.00 staff_space, +1.80 staff_space);
242         z2 = (0.00 staff_space, -0.25 staff_space);
243         z3 = (0.35 staff_space, -0.25 staff_space);
244         z4 = (0.35 staff_space, +0.25 staff_space);
245         z5 = (0.00 staff_space, +0.25 staff_space);
247         pat := z2
248                .. z3
249                .. z4
250                .. z5;
252         save dirs, s;
253         pair dirs[];
255         s := 1/4;
257         % we approximate `draw pat'
258         for i = 2 step s until (length pat + 2):
259                 dirs[i] := direction (i - 2) of pat;
260         endfor;
262         outline := get_subpath (ellipse, up, down, z1)
263                    -- get_subpath (ellipse, down, dirs2, z2)
264                    for i = (2 + s) step s until (length pat + 2 - s):
265                            .. get_subpoint (ellipse, dirs[i],
266                                               point (i - 2) of pat)
267                    endfor
268                    .. top z5
269                    -- bot z5
270                    for i = (length pat + 2 - s) step -s until 2:
271                            .. get_subpoint (ellipse, -dirs[i],
272                                             point (i - 2) of pat)
273                    endfor
274                    -- get_subpoint (ellipse, up, z2)
275                    -- cycle;
277         fill outline;
279         set_char_box (0.00 staff_space# + 0.75 stemthick#,
280                       0.40 staff_space# + 0.75 stemthick#,
281                       0.25 staff_space# + 0.75 stemthick#,
282                       1.80 staff_space# + 0.75 stemthick#);
284         labels (1, 2, 3, 4, 5);
285 fet_endchar;
288 fet_beginchar ("Hufnagel Flat" , "hufnagelM1");
289         save stemthick;
291         define_pixels (stemthick);
293         stemthick# = linethickness#;
295         save ellipse, pat, T;
296         path ellipse, pat;
297         transform T;
299         T := identity xscaled 2.4 stemthick
300                       yscaled 0.4 stemthick
301                       rotated 45;
302         pickup pencircle transformed T;
303         ellipse := fullcircle transformed T;
305         z1 = (0.00 staff_space, +1.80 staff_space);
306         z2 = (0.00 staff_space, -0.15 staff_space);
307         z3 = (0.25 staff_space, -0.30 staff_space);
308         z4 = (0.50 staff_space, +0.00 staff_space);
309         z5 = (0.30 staff_space, +0.30 staff_space);
310         z6 = (0.00 staff_space, +0.15 staff_space);
312         pat := z3
313                .. z4
314                .. z5;
316         save t;
317         numeric t[];
319         % we have to find the envelope intersections (if any)
320         t1 = find_envelope_cusp (reverse ellipse, pat, 1/256) + 3;
321         if t1 < 3:
322                 t1 := 3;
323         fi;
324         t2 = find_envelope_cusp (ellipse, reverse pat, 1/256);
325         if t2 < 0:
326                 t2 := 3;
327         else:
328                 t2 := length pat - t2 + 3;
329         fi;
331         save dirs, s;
332         pair dirs[];
334         s := 1/8;
336         % we approximate `draw pat'
337         for i = 3 step s until 5:
338                 dirs[i] := direction (i - 3) of pat;
339         endfor;
341         fill get_subpath (ellipse, up, down, z1)
342              -- get_subpath (ellipse, down, z3 - z2, z2)
343              -- get_subpoint (ellipse, z3 - z2, z3)
344              for i = 3 step s until 5:
345                      .. get_subpoint (ellipse, dirs[i],
346                                       point (i - 3) of pat)
347              endfor
348              .. get_subpoint (ellipse, z6 - z5, z5)
349              -- get_subpoint (ellipse, z6 - z5, z6)
350              -- get_subpoint (ellipse, z5 - z6, z6)
351              -- get_subpoint (ellipse, z5 - z6, z5)
352              -- get_subpoint (ellipse, -dirs[5], z5)
353              for i = (5 - s) step -s until t2:
354                      .. get_subpoint (ellipse, -dirs[i],
355                                       point (i - 3) of pat)
356              endfor
357              .. get_subpoint (ellipse, -direction (t2 - 3) of pat,
358                               point (t2 - 3) of pat)
359              -- get_subpoint (ellipse, -direction (t1 - 3) of pat,
360                               point (t1 - 3) of pat)
361              for i = (floor ((t1 - 3) / s) * s + 3) step -s until (3 + s):
362                      .. get_subpoint (ellipse, -dirs[i],
363                                       point (i - 3) of pat)
364              endfor
365              .. get_subpoint (ellipse, -dirs[3], z3)
366              -- get_subpoint (ellipse, z2 - z3, z3)
367              -- get_subpoint (ellipse, z2 - z3, z2)
368              -- get_subpoint (ellipse, up, z2)
369              -- cycle;
371 %       draw z1
372 %            -- z2
373 %            -- pat
374 %            -- z6;
376         set_char_box (0.00 staff_space# + 1.0 stemthick#,
377                       0.50 staff_space# + 1.0 stemthick#,
378                       0.30 staff_space# + 0.5 stemthick#, 
379                       1.80 staff_space# + 0.5 stemthick#);
381         labels (1, 2, 3, 4, 5, 6);
382 fet_endchar;
385 fet_endgroup ("accidentals");