]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-timesig.mf
Merge branch 'master' into lilypond/translation
[lilypond.git] / mf / parmesan-timesig.mf
1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-timesig.mf -- implement ancient time signatures
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 1998--2007 Mats Bengtsson <matsb@s3.kth.se>,
7 %                Christian Mondrup <scancm@biobase.dk>
8 % (c) 2002--2007 Juergen Reuter <reuter@ipd.uka.de>
9
10
11 fet_begingroup ("timesig");
12
13
14 path threequartercircle;
15
16 threequartercircle := halfcircle & quartercircle rotated 180;
17
18 save mensural_Cdiameter, mensural_Cthickness, mensural_Chairpin;
19
20 mensural_Cdiameter# := 3/2 staff_space#;
21 mensural_Cthickness# := 2 linethickness#;
22 mensural_Chairpin# := 0.5 linethickness#;
23
24 define_pixels (mensural_Cdiameter, mensural_Cthickness, mensural_Chairpin);
25
26
27 %%%%%%%%
28 %
29 %
30 %
31 % MENSURAL NOTATION
32 %
33 %
34 %
35
36 def draw_nail (expr bottom_left, top_right) =
37         save round;
38
39         round = floor min (blot_diameter,
40                            xpart (top_right-bottom_left),
41                            ypart (top_right-bottom_left));
42
43         pickup pencircle scaled round;
44
45         z2 + (round / 2, round / 2) = top_right +
46                                         (mensural_Cthickness / 2, 0);
47         z4 - (round / 2,round / 2) = bottom_left;
48         y3 = y2;
49         y4 = y1;
50         x2 = x1 + mensural_Cthickness / 2;
51         x2 - x1 = x4 - x3;
52         x5 = x1;
53         x6 = x4;
54         y5 = y6 = y2 - 2 mensural_Cthickness;
55
56         fill bot z1{right}
57              .. rt z1{up}
58              -- rt z5{up}
59              .. rt z2
60              .. top z2{left}
61              -- top z3{left}
62              .. lft z3
63              .. lft z6{down}
64              -- lft z4{down}
65              .. bot z4{right}
66              -- cycle;
67
68 %       labels (1, 2, 3, 4, 5, 6);
69 enddef;
70
71
72 def mensural_timesig (expr verbose_name, internal_name,
73                            full_circle, reverse_circle, slashed, dotted) =
74         fet_beginchar (verbose_name, internal_name);
75                 if slashed:
76                         set_char_box (
77                           0,
78                           mensural_Cdiameter# + mensural_Cthickness#,
79                           .75 (mensural_Cdiameter# + mensural_Cthickness#),
80                           .75 (mensural_Cdiameter# + mensural_Cthickness#));
81
82                         if (full_circle or dotted):
83                                 draw_nail ((-mensural_Cthickness / 2, -d),
84                                            (mensural_Cthickness / 2, h));
85                         elseif reverse_circle:
86                                 draw_nail ((0, -d), (mensural_Cthickness, h));
87                         else:
88                                 draw_nail ((-mensural_Cthickness, -d), (0, h));
89                         fi;
90                 else:
91                         set_char_box (
92                           0,
93                           mensural_Cdiameter# + mensural_Cthickness#,
94                           .5 (mensural_Cdiameter# + mensural_Cthickness#),
95                           .5 (mensural_Cdiameter# + mensural_Cthickness#));
96                 fi;
97
98                 save ellipse, pat;
99                 path ellipse, pat;
100
101                 ellipse := fullcircle xscaled mensural_Cthickness
102                                       yscaled mensural_Chairpin;
103
104                 save rot;
105
106                 if reverse_circle:
107                         rot := 225;
108                 else:
109                         rot := 45;
110                 fi;
111
112                 if full_circle:
113                         pat := fullcircle scaled mensural_Cdiameter;
114
115                         fill get_subpoint (ellipse,
116                                            direction 0 of pat,
117                                            point 0 of pat)
118                              for i = 1 step 1 until length pat:
119                                      .. get_subpoint (ellipse,
120                                                       direction i of pat,
121                                                       point i of pat)
122                              endfor
123                              .. cycle;
124                         unfill get_subpoint (ellipse,
125                                              -direction 0 of pat,
126                                              point 0 of pat)
127                                for i = 1 step 1 until length pat:
128                                        .. get_subpoint (ellipse,
129                                                         -direction i of pat,
130                                                         point i of pat)
131                                endfor
132                                .. cycle;
133                 else:
134                         pat := threequartercircle rotated rot
135                                                   scaled mensural_Cdiameter;
136
137                         fill get_subpath (ellipse,
138                                           -direction 0 of pat,
139                                           direction 0 of pat,
140                                           point 0 of pat)
141                              for i = 1 step 1 until (length pat - 1):
142                                      .. get_subpoint (ellipse,
143                                                       direction i of pat,
144                                                       point i of pat)
145                              endfor
146                              .. get_subpath (ellipse,
147                                              direction infinity of pat,
148                                              -direction infinity of pat,
149                                              point infinity of pat)
150                              for i = (length pat - 1) step -1 until 1:
151                                      .. get_subpoint (ellipse,
152                                                       -direction i of pat,
153                                                       point i of pat)
154                              endfor
155                              .. cycle;
156                 fi;
157
158                 if dotted:
159                         pickup pencircle scaled 4 linethickness;
160                         drawdot (0, 0);
161                 fi;
162
163                 currentpicture := currentpicture
164                                     shifted 0.5 (mensural_Cdiameter
165                                                  + mensural_Cthickness, 0);
166         fet_endchar;
167 enddef;
168
169
170 %% tempus imperfectum cum prolatione imperfecta
171 mensural_timesig ("Mensural 4/4 meter", "mensural44",
172                   false, false, false, false);
173
174
175 %% tempus imperfectum cum prolatione imperfecta proportio dupla
176 mensural_timesig ("Mensural 2/2 meter", "mensural22",
177                   false, false, true, false);
178
179
180 %% tempus perfectum cum prolatione imperfecta
181 mensural_timesig ("Mensural 3/2 meter", "mensural32",
182                   true, false, false, false);
183
184
185 %% tempus imperfectum cum prolatione perfecta
186 mensural_timesig ("Mensural 6/4 meter", "mensural64",
187                   false, false, false, true);
188
189
190 %% tempus perfectum cum prolatione perfecta
191 mensural_timesig ("Mensural 9/4 meter", "mensural94",
192                   true, false, false, true);
193
194
195 %% tempus perfectum cum prolatione imperfecta proportio dupla
196 mensural_timesig ("Mensural 3/4 meter", "mensural34",
197                   true, false, true, false);
198
199
200 %% tempus imperfectum cum prolatione perfecta proportio dupla
201 mensural_timesig ("Mensural 6/8 meter", "mensural68",
202                   false, false, true, true);
203
204
205 %% tempus perfectum cum prolatione perfecta proportio dupla
206 mensural_timesig ("Mensural 9/8 meter", "mensural98",
207                   true, false, true, true);
208
209         
210 %% tempus imperfectum cum prolatione imperfecta diminutio simplex
211 mensural_timesig ("Mensural 4/8 meter", "mensural48",
212                   false, true, false, false);
213
214
215 %% tempus imperfectum cum prolatione perfecta diminutio simplex
216 mensural_timesig ("Mensural 6/8 meter", "mensural68alt",
217                   false, true, false, true);
218
219
220 %% tempus imperfectum cum prolatione imperfecta diminutio duplex
221 mensural_timesig ("Mensural 2/4 meter", "mensural24",
222                   false, true, true, false);
223
224
225 %%%%%%%%
226 %
227 %
228 %
229 % NEO-MENSURAL NOTATION
230 %
231 %
232 %
233
234 save neomensural_Cdiameter, neomensural_Cthickness;
235
236 neomensural_Cdiameter# := 3/2 staff_space#;
237 neomensural_Cthickness# := 2 linethickness#;
238
239 define_pixels (neomensural_Cdiameter, neomensural_Cthickness);
240
241
242 def neomensural_timesig (expr verbose_name, internal_name,
243                               full_circle, reverse_circle, slashed, dotted) =
244         fet_beginchar (verbose_name, internal_name);
245                 set_char_box (
246                   0,
247                   neomensural_Cdiameter# + neomensural_Cthickness#,
248                   .5 (neomensural_Cdiameter# + neomensural_Cthickness#),
249                   .5 (neomensural_Cdiameter# + neomensural_Cthickness#));
250
251                 if slashed:
252                         pickup penrazor scaled neomensural_Cthickness;
253
254                         save t;
255                         t := neomensural_Cthickness / 2;
256
257                         if (full_circle or dotted):
258                                 draw (0, -d + t)
259                                      -- (0, h - t);
260                         elseif reverse_circle:
261                                 draw (t, -d + t)
262                                      -- (t, h - t);
263                         else:
264                                 draw (-t, -d + t)
265                                      -- (-t, h - t);
266                         fi;
267                 fi;
268
269                 save ellipse, pat;
270                 path ellipse, pat;
271
272                 ellipse := fullcircle scaled neomensural_Cthickness;
273
274                 save rot;
275
276                 if reverse_circle:
277                         rot := 225;
278                 else:
279                         rot := 45;
280                 fi;
281
282                 if full_circle:
283                         pat := fullcircle scaled neomensural_Cdiameter;
284
285                         fill get_subpoint (ellipse,
286                                            direction 0 of pat,
287                                            point 0 of pat)
288                              for i = 1 step 1 until length pat:
289                                      .. get_subpoint (ellipse,
290                                                       direction i of pat,
291                                                       point i of pat)
292                              endfor
293                              .. cycle;
294                         unfill get_subpoint (ellipse,
295                                              -direction 0 of pat,
296                                              point 0 of pat)
297                                for i = 1 step 1 until length pat:
298                                        .. get_subpoint (ellipse,
299                                                         -direction i of pat,
300                                                         point i of pat)
301                                endfor
302                                .. cycle;
303                 else:
304                         pat := threequartercircle rotated rot
305                                                   scaled neomensural_Cdiameter;
306
307                         fill get_subpath (ellipse,
308                                           -direction 0 of pat,
309                                           direction 0 of pat,
310                                           point 0 of pat)
311                              for i = 1 step 1 until (length pat - 1):
312                                      .. get_subpoint (ellipse,
313                                                       direction i of pat,
314                                                       point i of pat)
315                              endfor
316                              .. get_subpath (ellipse,
317                                              direction infinity of pat,
318                                              -direction infinity of pat,
319                                              point infinity of pat)
320                              for i = (length pat - 1) step -1 until 1:
321                                      .. get_subpoint (ellipse,
322                                                       -direction i of pat,
323                                                       point i of pat)
324                              endfor
325                              .. cycle;
326                 fi;
327
328                 if dotted:
329                         pickup pencircle scaled 4 linethickness;
330                         drawdot (0, 0);
331                 fi;
332
333                 currentpicture := currentpicture
334                                      shifted 0.5 (neomensural_Cdiameter
335                                                   + neomensural_Cthickness, 0);
336         fet_endchar;
337 enddef;
338
339
340 %% tempus imperfectum cum prolatione imperfecta
341 neomensural_timesig ("Mensural 4/4 meter", "neomensural44",
342                      false, false, false, false);
343
344
345 %% tempus imperfectum cum prolatione imperfecta proportio dupla
346 neomensural_timesig ("Mensural 2/2 meter", "neomensural22",
347                      false, false, true, false);
348
349
350 %% tempus perfectum cum prolatione imperfecta
351 neomensural_timesig ("Mensural 3/2 meter", "neomensural32",
352                      true, false, false, false);
353
354
355 %% tempus imperfectum cum prolatione perfecta
356 neomensural_timesig ("Mensural 6/4 meter", "neomensural64",
357                      false, false, false, true);
358
359
360 %% tempus perfectum cum prolatione perfecta
361 neomensural_timesig ("Mensural 9/4 meter", "neomensural94",
362                      true, false, false, true);
363
364
365 %% tempus perfectum cum prolatione imperfecta proportio dupla
366 neomensural_timesig ("Mensural 3/4 meter", "neomensural34",
367                      true, false, true, false);
368
369
370 %% tempus imperfectum cum prolatione perfecta proportio dupla
371 neomensural_timesig ("Mensural 6/8 meter", "neomensural68",
372                      false, false, true, true);
373
374
375 %% tempus perfectum cum prolatione perfecta proportio dupla
376 neomensural_timesig ("Mensural 9/8 meter", "neomensural98",
377                      true, false, true, true);
378
379         
380 %% tempus imperfectum cum prolatione imperfecta diminutio simplex
381 neomensural_timesig ("Mensural 4/8 meter", "neomensural48",
382                      false, true, false, false);
383
384
385 %% tempus imperfectum cum prolatione perfecta diminutio simplex
386 neomensural_timesig ("Mensural 6/8 meter", "neomensural68alt",
387                      false, true, false, true);
388
389
390 %% tempus imperfectum cum prolatione imperfecta diminutio duplex
391 neomensural_timesig ("Mensural 2/4 meter", "neomensural24",
392                      false, true, true, false);
393
394
395 fet_endgroup ("timesig");