]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-accidentals.mf
ba4bf7886884ea3ef58f16bbf21ba11233f38dc3
[lilypond.git] / mf / parmesan-accidentals.mf
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--2007 Juergen Reuter <reuter@ipd.uka.de>
7
8
9 fet_begingroup ("accidentals");
10
11
12 %%%%%%%%
13 %
14 %
15 %
16 % EDITIO MEDICAEA
17 %
18 %
19 %
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#);
23
24         save ellipse, pat, outline, T;
25         path ellipse, pat, outline;
26         transform T;
27
28         T := identity xscaled 0.50 linethickness
29                       yscaled 0.22 staff_space;
30         pickup pencircle transformed T;
31         ellipse := fullcircle transformed T;
32
33         x1 = x2 = 0;
34         top y1 = h;
35         bot y2 = -d;
36
37         fill get_subpath (ellipse, up, down, z1)
38              -- get_subpath (ellipse, down, up, z2)
39              -- cycle;
40
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;
46
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);
50
51         pat := z3{(1, 2)}
52                .. z4
53                .. z5{(-1, -1)};
54
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;
65
66         save shift;
67         pair shift;
68
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;
73
74         fill outline;
75
76         labels (1, 2, 3, 4, 5);
77 fet_endchar;
78
79
80 %%%%%%%%
81 %
82 %
83 %
84 % EDITIO VATICANA
85 %
86 %
87 %
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);
96
97         save pat, ellipse, T;
98         path pat, ellipse;
99         transform T;
100
101         T := identity xscaled 0.50 linethickness
102                       yscaled 0.22 staff_space;
103         pickup pencircle transformed T;
104         ellipse := fullcircle transformed T;
105
106         pat := z1
107                -- z2{down}
108                ... z3
109                ... {up}z4
110                -- z5{up}
111                .. z6
112                .. z7;
113
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;
130
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#);
135
136         labels (1, 2, 3, 4, 5, 6, 7);
137 fet_endchar;
138
139
140 fet_beginchar ("Ed. Vat. Natural" , "vaticana0");
141         save ellipse, T;
142         path ellipse;
143         transform T;
144
145         T := identity xscaled 0.80 linethickness
146                       yscaled 0.22 staff_space;
147         pickup pencircle transformed T;
148         ellipse := fullcircle transformed T;
149
150         z1 = (0.00 staff_space, +0.65 staff_space);
151         z2 = (0.00 staff_space, -0.35 staff_space);
152
153         fill get_subpath (ellipse, up, down, z1)
154              -- get_subpath (ellipse, down, up, z2)
155              -- cycle;
156
157         pickup penrazor scaled 0.22 staff_space
158                         rotated 90;
159
160         z3 = (0.00 staff_space, -0.30 staff_space);
161         z4 = (0.40 staff_space, -0.08 staff_space);
162
163         draw z3
164              -- z4;
165
166         addto currentpicture also currentpicture
167           xscaled -1
168           yscaled -1
169           shifted (0.40 staff_space, 0.0 staff_space);
170
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#);
175
176         labels (1, 2, 3, 4);
177 fet_endchar;
178
179
180 %%%%%%%%
181 %
182 %
183 %
184 % MENSURAL NOTATION
185 %
186 %
187 %
188 fet_beginchar ("Mensural Sharp" , "mensural1");
189         save stemthick;
190
191         define_pixels (stemthick);
192
193         stemthick# = linethickness#;
194
195         save circle, pat, T;
196         path circle, pat;
197         transform T;
198
199         T := identity scaled 0.8 stemthick;
200         pickup pencircle transformed T;
201         circle := fullcircle transformed T;
202
203         z1 = 0.4 staff_space * (0.8, 1);
204         z1 = -z2;
205
206         pat := get_subpath (circle, z1 - z2, z2 - z1, z1)
207                -- get_subpath (circle, z2 - z1, z1 - z2, z2)
208                -- cycle;
209
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);
214
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#);
219
220         labels (1, 2);
221 fet_endchar;
222
223
224 fet_beginchar ("Mensural Flat" , "mensuralM1");
225         save stemthick;
226
227         define_pixels (stemthick);
228
229         stemthick# = linethickness#;
230
231         save ellipse, pat, outline, T;
232         path ellipse, pat, outline;
233         transform T;
234
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;
240
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);
246
247         pat := z2
248                .. z3
249                .. z4
250                .. z5;
251
252         save dirs, s;
253         pair dirs[];
254
255         s := 1/4;
256
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;
261
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;
276
277         fill outline;
278
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#);
283
284         labels (1, 2, 3, 4, 5);
285 fet_endchar;
286
287
288 fet_beginchar ("Hufnagel Flat" , "hufnagelM1");
289         save stemthick;
290
291         define_pixels (stemthick);
292
293         stemthick# = linethickness#;
294
295         save ellipse, pat, T;
296         path ellipse, pat;
297         transform T;
298
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;
304
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);
311
312         pat := z3
313                .. z4
314                .. z5;
315
316         save t;
317         numeric t[];
318
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;
330
331         save dirs, s;
332         pair dirs[];
333
334         s := 1/8;
335
336         % we approximate `draw pat'
337         for i = 3 step s until 5:
338                 dirs[i] := direction (i - 3) of pat;
339         endfor;
340
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;
370
371 %       draw z1
372 %            -- z2
373 %            -- pat
374 %            -- z6;
375
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#);
380
381         labels (1, 2, 3, 4, 5, 6);
382 fet_endchar;
383
384
385 fet_endgroup ("accidentals");