]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-accidentals.mf
Merge branch 'master' of git://git.sv.gnu.org/lilypond
[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--2006 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" , "medicaea-1");
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;
25         path ellipse, pat, outline;
26
27         pickup pencircle xscaled 0.50 linethickness
28                          yscaled 0.22 staff_space;
29
30         ellipse := fullcircle xscaled 0.5 linethickness
31                                       yscaled 0.22 staff_space;
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         pickup pencircle xscaled 0.50 linethickness
42                          yscaled 0.22 staff_space
43                          rotated -63;
44
45         ellipse := fullcircle xscaled 0.50 linethickness
46                               yscaled 0.22 staff_space
47                               rotated -63;
48
49         z3 = (0.10 staff_space, -0.50 staff_space);
50         z4 = (0.40 staff_space, +0.40 staff_space);
51         z5 = (0.10 staff_space, +0.40 staff_space);
52
53         pat := z3{(1, 2)}
54                .. z4
55                .. z5{(-1, -1)};
56
57         % the original envelope curve created with `draw' contains
58         % cusps which we avoid
59         outline := get_subpath (ellipse, -direction 0 of pat,
60                                 direction 0 of pat, z3)
61                    .. get_subpoint (ellipse, direction 1 of pat, z4)
62                    .. get_subpath (ellipse, direction 2 of pat,
63                                    -direction 1.8 of pat, z5)
64                    .. get_subpoint (ellipse, -direction 1 of pat, z4)
65                         {-direction 1 of pat}
66                    .. cycle;
67
68         save shift;
69         pair shift;
70
71         % make the outline touch the bounding box
72         shift = find_tangent_shift (((w, -d) -- (w, h)), outline,
73                                     (b, 0), (-b, 0));
74         outline := outline shifted shift;
75
76         fill outline;
77
78         labels (1, 2, 3, 4, 5);
79 fet_endchar;
80
81
82 %%%%%%%%
83 %
84 %
85 %
86 % EDITIO VATICANA
87 %
88 %
89 %
90 fet_beginchar ("Ed. Vat. Flat" , "vaticana-1");
91         z1 = (0.00 staff_space, +0.80 staff_space);
92         z2 = (0.00 staff_space, -0.08 staff_space);
93         z3 = (0.25 staff_space, -0.23 staff_space);
94         z4 = (0.50 staff_space, -0.24 staff_space);
95         z5 = (0.50 staff_space, +0.03 staff_space);
96         z6 = (0.25 staff_space, +0.20 staff_space);
97         z7 = (0.15 staff_space, +0.26 staff_space);
98
99         save pat, ellipse;
100         path pat, ellipse;
101
102         pickup pencircle xscaled 0.50 linethickness
103                          yscaled 0.22 staff_space;
104
105         ellipse := fullcircle xscaled 0.50 linethickness
106                               yscaled 0.22 staff_space;
107
108         pat := z1
109                -- z2{down}
110                ... z3
111                ... {up}z4
112                -- z5{up}
113                .. z6
114                .. z7;
115
116         % the original envelope curve created with `draw' contains
117         % cusps which we avoid
118         fill get_subpath (ellipse, up, down, z1)
119              -- get_subpath (ellipse, down, direction 1.1 of pat, z2)
120              ... bot z3
121              ... get_subpath (ellipse, direction 2.9 of pat, up, z4)
122              -- get_subpath (ellipse, up, direction 4.1 of pat, z5)
123              .. top z6
124              .. get_subpath (ellipse,
125                              direction 6 of pat, -direction 6 of pat, z7)
126              .. bot z6
127              .. {down}bot lft z5
128              -- top lft z4{down}
129              ... top z3
130              ... top rt z2{up}
131              -- cycle;
132
133         set_char_box (0.00 staff_space# + 0.25 linethickness#,
134                       0.50 staff_space# + 0.25 linethickness#,
135                       0.23 staff_space# + 0.11 staff_space#,
136                       0.80 staff_space# + 0.11 staff_space#);
137
138         labels (1, 2, 3, 4, 5, 6, 7);
139 fet_endchar;
140
141
142 fet_beginchar ("Ed. Vat. Natural" , "vaticana0");
143         save ellipse;
144         path ellipse;
145
146         pickup pencircle xscaled 0.80 linethickness
147                          yscaled 0.22 staff_space;
148
149         ellipse := fullcircle xscaled 0.8 linethickness
150                               yscaled 0.22 staff_space;
151
152         z1 = (0.00 staff_space, +0.65 staff_space);
153         z2 = (0.00 staff_space, -0.35 staff_space);
154
155         fill get_subpath (ellipse, up, down, z1)
156              -- get_subpath (ellipse, down, up, z2)
157              -- cycle;
158
159         pickup penrazor scaled 0.22 staff_space
160                         rotated 90;
161
162         z3 = (0.00 staff_space, -0.30 staff_space);
163         z4 = (0.40 staff_space, -0.08 staff_space);
164
165         draw z3
166              -- z4;
167
168         addto currentpicture also currentpicture
169           xscaled -1
170           yscaled -1
171           shifted (0.40 staff_space, 0.0 staff_space);
172
173         set_char_box (0.00 staff_space# + 0.40 linethickness#,
174                       0.40 staff_space# + 0.40 linethickness#,
175                       0.65 staff_space# + 0.11 staff_space#,
176                       0.65 staff_space# + 0.11 staff_space#);
177
178         labels (1, 2, 3, 4);
179 fet_endchar;
180
181
182 %%%%%%%%
183 %
184 %
185 %
186 % MENSURAL NOTATION
187 %
188 %
189 %
190 fet_beginchar ("Mensural Sharp" , "mensural1");
191         save stemthick;
192
193         define_pixels (stemthick);
194
195         stemthick# = linethickness#;
196
197         save circle, pat;
198         path circle, pat;
199
200         pickup pencircle scaled 0.8 stemthick;
201
202         circle := fullcircle scaled 0.8 stemthick;
203
204         z1 = 0.4 staff_space * (0.8, 1);
205         z1 = -z2;
206
207         pat := get_subpath (circle, z1 - z2, z2 - z1, z1)
208                -- get_subpath (circle, z2 - z1, z1 - z2, z2)
209                -- cycle;
210
211         fill pat;
212         fill pat xscaled -1;
213         fill pat shifted (0.20 staff_space, 0);
214         fill pat xscaled -1 shifted (0.20 staff_space, 0);
215
216         set_char_box (0.8 * 0.4 staff_space# + 0.4 stemthick#,
217                       (0.8 * 0.4 + 0.2) * staff_space# + 0.4 stemthick#,
218                       0.4 staff_space# + 0.4 stemthick#, 
219                       0.4 staff_space# + 0.4 stemthick#);
220
221         labels (1, 2);
222 fet_endchar;
223
224
225 fet_beginchar ("Mensural Flat" , "mensural-1");
226         save stemthick;
227
228         define_pixels (stemthick);
229
230         stemthick# = linethickness#;
231
232         save ellipse, pat, outline;
233         path ellipse, pat, outline;
234
235         pickup pencircle xscaled 1.4 stemthick
236                          yscaled 0.6 stemthick
237                          rotated 45;
238
239         ellipse := fullcircle xscaled 1.4 stemthick
240                               yscaled 0.6 stemthick
241                               rotated 45;
242
243         z1 = (0.00 staff_space, +1.80 staff_space);
244         z2 = (0.00 staff_space, -0.25 staff_space);
245         z3 = (0.35 staff_space, -0.25 staff_space);
246         z4 = (0.35 staff_space, +0.25 staff_space);
247         z5 = (0.00 staff_space, +0.25 staff_space);
248
249         pat := z2
250                .. z3
251                .. z4
252                .. z5;
253
254         save dirs, s;
255         pair dirs[];
256
257         s := 1/4;
258
259         % we approximate `draw pat'
260         for i = 2 step s until (length pat + 2):
261                 dirs[i] := direction (i - 2) of pat;
262         endfor;
263
264         outline := get_subpath (ellipse, up, down, z1)
265                    -- get_subpath (ellipse, down, dirs2, z2)
266                    for i = (2 + s) step s until (length pat + 2 - s):
267                            .. get_subpoint (ellipse, dirs[i],
268                                               point (i - 2) of pat)
269                    endfor
270                    .. top z5
271                    -- bot z5
272                    for i = (length pat + 2 - s) step -s until 2:
273                            .. get_subpoint (ellipse, -dirs[i],
274                                             point (i - 2) of pat)
275                    endfor
276                    -- get_subpoint (ellipse, up, z2)
277                    -- cycle;
278
279         fill outline;
280
281         set_char_box (0.00 staff_space# + 0.75 stemthick#,
282                       0.40 staff_space# + 0.75 stemthick#,
283                       0.25 staff_space# + 0.75 stemthick#,
284                       1.80 staff_space# + 0.75 stemthick#);
285
286         labels (1, 2, 3, 4, 5);
287 fet_endchar;
288
289
290 fet_beginchar ("Hufnagel Flat" , "hufnagel-1");
291         save stemthick;
292
293         define_pixels (stemthick);
294
295         stemthick# = linethickness#;
296
297         save ellipse, pat;
298         path ellipse, pat;
299
300         pickup pencircle xscaled 2.4 stemthick
301                          yscaled 0.4 stemthick
302                          rotated 45;
303
304         ellipse := fullcircle xscaled 2.4 stemthick
305                               yscaled 0.4 stemthick
306                               rotated 45;
307
308         z1 = (0.00 staff_space, +1.80 staff_space);
309         z2 = (0.00 staff_space, -0.15 staff_space);
310         z3 = (0.25 staff_space, -0.30 staff_space);
311         z4 = (0.50 staff_space, +0.00 staff_space);
312         z5 = (0.30 staff_space, +0.30 staff_space);
313         z6 = (0.00 staff_space, +0.15 staff_space);
314
315         pat := z3
316                .. z4
317                .. z5;
318
319         save t;
320         numeric t[];
321
322         % we have to find the envelope intersections (if any)
323         t1 = find_envelope_cusp (reverse ellipse, pat, 1/256) + 3;
324         if t1 < 3:
325                 t1 := 3;
326         fi;
327         t2 = find_envelope_cusp (ellipse, reverse pat, 1/256);
328         if t2 < 0:
329                 t2 := 3;
330         else:
331                 t2 := length pat - t2 + 3;
332         fi;
333
334         save dirs, s;
335         pair dirs[];
336
337         s := 1/8;
338
339         % we approximate `draw pat'
340         for i = 3 step s until 5:
341                 dirs[i] := direction (i - 3) of pat;
342         endfor;
343
344         fill get_subpath (ellipse, up, down, z1)
345              -- get_subpath (ellipse, down, z3 - z2, z2)
346              -- get_subpoint (ellipse, z3 - z2, z3)
347              for i = 3 step s until 5:
348                      .. get_subpoint (ellipse, dirs[i],
349                                       point (i - 3) of pat)
350              endfor
351              .. get_subpoint (ellipse, z6 - z5, z5)
352              -- get_subpoint (ellipse, z6 - z5, z6)
353              -- get_subpoint (ellipse, z5 - z6, z6)
354              -- get_subpoint (ellipse, z5 - z6, z5)
355              -- get_subpoint (ellipse, -dirs[5], z5)
356              for i = (5 - s) step -s until t2:
357                      .. get_subpoint (ellipse, -dirs[i],
358                                       point (i - 3) of pat)
359              endfor
360              .. get_subpoint (ellipse, -direction (t2 - 3) of pat,
361                               point (t2 - 3) of pat)
362              -- get_subpoint (ellipse, -direction (t1 - 3) of pat,
363                               point (t1 - 3) of pat)
364              for i = (floor ((t1 - 3) / s) * s + 3) step -s until (3 + s):
365                      .. get_subpoint (ellipse, -dirs[i],
366                                       point (i - 3) of pat)
367              endfor
368              .. get_subpoint (ellipse, -dirs[3], z3)
369              -- get_subpoint (ellipse, z2 - z3, z3)
370              -- get_subpoint (ellipse, z2 - z3, z2)
371              -- get_subpoint (ellipse, up, z2)
372              -- cycle;
373
374 %       draw z1
375 %            -- z2
376 %            -- pat
377 %            -- z6;
378
379         set_char_box (0.00 staff_space# + 1.0 stemthick#,
380                       0.50 staff_space# + 1.0 stemthick#,
381                       0.30 staff_space# + 0.5 stemthick#, 
382                       1.80 staff_space# + 0.5 stemthick#);
383
384         labels (1, 2, 3, 4, 5, 6);
385 fet_endchar;
386
387
388 fet_endgroup ("accidentals");