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