Fix metronome alignment.
[lilypond/mpolesky.git] / mf / parmesan-timesignatures.mf
blobbe3eccb3b4afe257222ae88a046f8f7e7b2e79d5
1 % Feta (not the Font-En-Tja) music font --  ancient time signatures
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 1998--2010 Mats Bengtsson <matsb@s3.kth.se>,
5 %                Christian Mondrup <scancm@biobase.dk>
6 % Copyright (C) 2002--2010 Juergen Reuter <reuter@ipd.uka.de>
9 % LilyPond is free software: you can redistribute it and/or modify
10 % it under the terms of the GNU General Public License as published by
11 % the Free Software Foundation, either version 3 of the License, or
12 % (at your option) any later version.
14 % LilyPond is distributed in the hope that it will be useful,
15 % but WITHOUT ANY WARRANTY; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 % GNU General Public License for more details.
19 % You should have received a copy of the GNU General Public License
20 % along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
22 fet_begingroup ("timesig");
25 path threequartercircle;
27 threequartercircle := halfcircle & quartercircle rotated 180;
29 save mensural_Cdiameter, mensural_Cthickness, mensural_Chairpin;
31 mensural_Cdiameter# := 3/2 staff_space#;
32 mensural_Cthickness# := 2 linethickness#;
33 mensural_Chairpin# := 0.5 linethickness#;
35 define_pixels (mensural_Cdiameter, mensural_Cthickness, mensural_Chairpin);
38 %%%%%%%%
42 % MENSURAL NOTATION
47 def draw_nail (expr bottom_left, top_right) =
48         save round;
50         round = floor min (blot_diameter,
51                            xpart (top_right-bottom_left),
52                            ypart (top_right-bottom_left));
54         pickup pencircle scaled round;
56         z2 + (round / 2, round / 2) = top_right +
57                                         (mensural_Cthickness / 2, 0);
58         z4 - (round / 2,round / 2) = bottom_left;
59         y3 = y2;
60         y4 = y1;
61         x2 = x1 + mensural_Cthickness / 2;
62         x2 - x1 = x4 - x3;
63         x5 = x1;
64         x6 = x4;
65         y5 = y6 = y2 - 2 mensural_Cthickness;
67         fill bot z1{right}
68              .. rt z1{up}
69              -- rt z5{up}
70              .. rt z2
71              .. top z2{left}
72              -- top z3{left}
73              .. lft z3
74              .. lft z6{down}
75              -- lft z4{down}
76              .. bot z4{right}
77              -- cycle;
79 %       labels (1, 2, 3, 4, 5, 6);
80 enddef;
83 def mensural_timesig (expr verbose_name, internal_name,
84                            full_circle, reverse_circle, slashed, dotted) =
85         fet_beginchar (verbose_name, internal_name);
86                 if slashed:
87                         set_char_box (
88                           0,
89                           mensural_Cdiameter# + mensural_Cthickness#,
90                           .75 (mensural_Cdiameter# + mensural_Cthickness#),
91                           .75 (mensural_Cdiameter# + mensural_Cthickness#));
93                         if (full_circle or dotted):
94                                 draw_nail ((-mensural_Cthickness / 2, -d),
95                                            (mensural_Cthickness / 2, h));
96                         elseif reverse_circle:
97                                 draw_nail ((0, -d), (mensural_Cthickness, h));
98                         else:
99                                 draw_nail ((-mensural_Cthickness, -d), (0, h));
100                         fi;
101                 else:
102                         set_char_box (
103                           0,
104                           mensural_Cdiameter# + mensural_Cthickness#,
105                           .5 (mensural_Cdiameter# + mensural_Cthickness#),
106                           .5 (mensural_Cdiameter# + mensural_Cthickness#));
107                 fi;
109                 save ellipse, pat;
110                 path ellipse, pat;
112                 ellipse := fullcircle xscaled mensural_Cthickness
113                                       yscaled mensural_Chairpin;
115                 save rot;
117                 if reverse_circle:
118                         rot := 225;
119                 else:
120                         rot := 45;
121                 fi;
123                 if full_circle:
124                         pat := fullcircle scaled mensural_Cdiameter;
126                         fill 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                         unfill get_subpoint (ellipse,
136                                              -direction 0 of pat,
137                                              point 0 of pat)
138                                for i = 1 step 1 until length pat:
139                                        .. get_subpoint (ellipse,
140                                                         -direction i of pat,
141                                                         point i of pat)
142                                endfor
143                                .. cycle;
144                 else:
145                         pat := threequartercircle rotated rot
146                                                   scaled mensural_Cdiameter;
148                         fill get_subpath (ellipse,
149                                           -direction 0 of pat,
150                                           direction 0 of pat,
151                                           point 0 of pat)
152                              for i = 1 step 1 until (length pat - 1):
153                                      .. get_subpoint (ellipse,
154                                                       direction i of pat,
155                                                       point i of pat)
156                              endfor
157                              .. get_subpath (ellipse,
158                                              direction infinity of pat,
159                                              -direction infinity of pat,
160                                              point infinity of pat)
161                              for i = (length pat - 1) step -1 until 1:
162                                      .. get_subpoint (ellipse,
163                                                       -direction i of pat,
164                                                       point i of pat)
165                              endfor
166                              .. cycle;
167                 fi;
169                 if dotted:
170                         pickup pencircle scaled 4 linethickness;
171                         drawdot (0, 0);
172                 fi;
174                 currentpicture := currentpicture
175                                     shifted 0.5 (mensural_Cdiameter
176                                                  + mensural_Cthickness, 0);
177         fet_endchar;
178 enddef;
181 %% tempus imperfectum cum prolatione imperfecta
182 mensural_timesig ("Mensural 4/4 meter", "mensural44",
183                   false, false, false, false);
186 %% tempus imperfectum cum prolatione imperfecta proportio dupla
187 mensural_timesig ("Mensural 2/2 meter", "mensural22",
188                   false, false, true, false);
191 %% tempus perfectum cum prolatione imperfecta
192 mensural_timesig ("Mensural 3/2 meter", "mensural32",
193                   true, false, false, false);
196 %% tempus imperfectum cum prolatione perfecta
197 mensural_timesig ("Mensural 6/4 meter", "mensural64",
198                   false, false, false, true);
201 %% tempus perfectum cum prolatione perfecta
202 mensural_timesig ("Mensural 9/4 meter", "mensural94",
203                   true, false, false, true);
206 %% tempus perfectum cum prolatione imperfecta proportio dupla
207 mensural_timesig ("Mensural 3/4 meter", "mensural34",
208                   true, false, true, false);
211 %% tempus imperfectum cum prolatione perfecta proportio dupla
212 mensural_timesig ("Mensural 6/8 meter", "mensural68",
213                   false, false, true, true);
216 %% tempus perfectum cum prolatione perfecta proportio dupla
217 mensural_timesig ("Mensural 9/8 meter", "mensural98",
218                   true, false, true, true);
221 %% tempus imperfectum cum prolatione imperfecta diminutio simplex
222 mensural_timesig ("Mensural 4/8 meter", "mensural48",
223                   false, true, false, false);
226 %% tempus imperfectum cum prolatione perfecta diminutio simplex
227 mensural_timesig ("Mensural 6/8 meter", "mensural68alt",
228                   false, true, false, true);
231 %% tempus imperfectum cum prolatione imperfecta diminutio duplex
232 mensural_timesig ("Mensural 2/4 meter", "mensural24",
233                   false, true, true, false);
236 %%%%%%%%
240 % NEO-MENSURAL NOTATION
245 save neomensural_Cdiameter, neomensural_Cthickness;
247 neomensural_Cdiameter# := 3/2 staff_space#;
248 neomensural_Cthickness# := 2 linethickness#;
250 define_pixels (neomensural_Cdiameter, neomensural_Cthickness);
253 def neomensural_timesig (expr verbose_name, internal_name,
254                               full_circle, reverse_circle, slashed, dotted) =
255         fet_beginchar (verbose_name, internal_name);
256                 set_char_box (
257                   0,
258                   neomensural_Cdiameter# + neomensural_Cthickness#,
259                   .5 (neomensural_Cdiameter# + neomensural_Cthickness#),
260                   .5 (neomensural_Cdiameter# + neomensural_Cthickness#));
262                 if slashed:
263                         pickup penrazor scaled neomensural_Cthickness;
265                         save t;
266                         t := neomensural_Cthickness / 2;
268                         if (full_circle or dotted):
269                                 draw (0, -d + t)
270                                      -- (0, h - t);
271                         elseif reverse_circle:
272                                 draw (t, -d + t)
273                                      -- (t, h - t);
274                         else:
275                                 draw (-t, -d + t)
276                                      -- (-t, h - t);
277                         fi;
278                 fi;
280                 save ellipse, pat;
281                 path ellipse, pat;
283                 ellipse := fullcircle scaled neomensural_Cthickness;
285                 save rot;
287                 if reverse_circle:
288                         rot := 225;
289                 else:
290                         rot := 45;
291                 fi;
293                 if full_circle:
294                         pat := fullcircle scaled neomensural_Cdiameter;
296                         fill get_subpoint (ellipse,
297                                            direction 0 of pat,
298                                            point 0 of pat)
299                              for i = 1 step 1 until length pat:
300                                      .. get_subpoint (ellipse,
301                                                       direction i of pat,
302                                                       point i of pat)
303                              endfor
304                              .. cycle;
305                         unfill get_subpoint (ellipse,
306                                              -direction 0 of pat,
307                                              point 0 of pat)
308                                for i = 1 step 1 until length pat:
309                                        .. get_subpoint (ellipse,
310                                                         -direction i of pat,
311                                                         point i of pat)
312                                endfor
313                                .. cycle;
314                 else:
315                         pat := threequartercircle rotated rot
316                                                   scaled neomensural_Cdiameter;
318                         fill get_subpath (ellipse,
319                                           -direction 0 of pat,
320                                           direction 0 of pat,
321                                           point 0 of pat)
322                              for i = 1 step 1 until (length pat - 1):
323                                      .. get_subpoint (ellipse,
324                                                       direction i of pat,
325                                                       point i of pat)
326                              endfor
327                              .. get_subpath (ellipse,
328                                              direction infinity of pat,
329                                              -direction infinity of pat,
330                                              point infinity of pat)
331                              for i = (length pat - 1) step -1 until 1:
332                                      .. get_subpoint (ellipse,
333                                                       -direction i of pat,
334                                                       point i of pat)
335                              endfor
336                              .. cycle;
337                 fi;
339                 if dotted:
340                         pickup pencircle scaled 4 linethickness;
341                         drawdot (0, 0);
342                 fi;
344                 currentpicture := currentpicture
345                                      shifted 0.5 (neomensural_Cdiameter
346                                                   + neomensural_Cthickness, 0);
347         fet_endchar;
348 enddef;
351 %% tempus imperfectum cum prolatione imperfecta
352 neomensural_timesig ("Mensural 4/4 meter", "neomensural44",
353                      false, false, false, false);
356 %% tempus imperfectum cum prolatione imperfecta proportio dupla
357 neomensural_timesig ("Mensural 2/2 meter", "neomensural22",
358                      false, false, true, false);
361 %% tempus perfectum cum prolatione imperfecta
362 neomensural_timesig ("Mensural 3/2 meter", "neomensural32",
363                      true, false, false, false);
366 %% tempus imperfectum cum prolatione perfecta
367 neomensural_timesig ("Mensural 6/4 meter", "neomensural64",
368                      false, false, false, true);
371 %% tempus perfectum cum prolatione perfecta
372 neomensural_timesig ("Mensural 9/4 meter", "neomensural94",
373                      true, false, false, true);
376 %% tempus perfectum cum prolatione imperfecta proportio dupla
377 neomensural_timesig ("Mensural 3/4 meter", "neomensural34",
378                      true, false, true, false);
381 %% tempus imperfectum cum prolatione perfecta proportio dupla
382 neomensural_timesig ("Mensural 6/8 meter", "neomensural68",
383                      false, false, true, true);
386 %% tempus perfectum cum prolatione perfecta proportio dupla
387 neomensural_timesig ("Mensural 9/8 meter", "neomensural98",
388                      true, false, true, true);
391 %% tempus imperfectum cum prolatione imperfecta diminutio simplex
392 neomensural_timesig ("Mensural 4/8 meter", "neomensural48",
393                      false, true, false, false);
396 %% tempus imperfectum cum prolatione perfecta diminutio simplex
397 neomensural_timesig ("Mensural 6/8 meter", "neomensural68alt",
398                      false, true, false, true);
401 %% tempus imperfectum cum prolatione imperfecta diminutio duplex
402 neomensural_timesig ("Mensural 2/4 meter", "neomensural24",
403                      false, true, true, false);
406 fet_endgroup ("timesig");