]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-custodes.mf
Run `make grand-replace'.
[lilypond.git] / mf / parmesan-custodes.mf
1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-custodes.mf -- implement ancient custodes
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 2000--2008 Juergen Reuter <reuter@ipd.uka.de>
7
8
9 save black_notehead_width;
10 numeric black_notehead_width;
11
12 fet_begingroup ("custodes");
13
14 %
15 % character aligment:
16 %
17 %   The custos is assumed to be vertically centered around (0, 0).
18 %   The left-most edge of the custos should touch the vertical line
19 %   that goes though the point (0, 0).
20 %
21 % set_char_box() conventions:
22 %
23 % * breapth: Ignored (as far as I know).  Should be set to 0.
24 %
25 % * width: Should cover the horizontal range of the custos that is to
26 %   be printed in the staff.  If the custos has an appendage that is
27 %   supposed to reach beyond the right end of the staff, the width
28 %   should be set such that the appendage is outside of the char box.
29 %
30 % * depth: Should match the bottom edge of the custos.  Affects
31 %   vertical collision handling.
32 %
33 % * height: Should match the top edge of the custos.  Affects vertical
34 %   collision handling.
35 %
36
37 save between_staff_lines, on_staff_line, anywhere;
38
39 between_staff_lines := 0;
40 on_staff_line := 1;
41 anywhere := 2;
42
43 save dir_up, dir_down;
44
45 dir_up := 1;
46 dir_down := -1;
47
48
49 %%%%%%%%
50 %
51 %
52 % Hufnagel style
53 %
54 %
55
56 % parameterized hufnagel custos
57 def custos_hufnagel (expr verbose_name, internal_name, 
58                           direction, staffline_adjustment) =
59
60         fet_beginchar (verbose_name, internal_name);
61                 save alpha, dalpha, ht, wd, stem_ht, pen_size;
62
63                 ht# = noteheight#;
64                 wd# / ht# = 0.6;
65                 alpha = 35;
66                 dalpha = direction * alpha;
67
68                 if staffline_adjustment = between_staff_lines:
69                         stem_ht# = 1.00 staff_space#;
70                 elseif staffline_adjustment = on_staff_line:
71                         stem_ht# = 1.50 staff_space#;
72                 else: % staffline_adjustment = anywhere
73                         stem_ht# = 1.25 staff_space#;
74                 fi;
75
76                 pen_size# = 0.5 (wd# ++ ht#);
77
78                 define_pixels (ht, wd, pen_size, stem_ht);
79
80                 save ellipse, pat, T;
81                 path ellipse, pat;
82                 transform T;
83
84                 T := identity xscaled linethickness
85                               yscaled pen_size
86                               rotated -dalpha;
87                 pickup pencircle transformed T;
88                 ellipse := fullcircle transformed T;
89
90                 if direction = dir_up:
91                         top y1 = ht / 2;
92                         bot y2 = -ht / 2;
93                 else:
94                         bot y1 = -ht / 2;
95                         top y2 = ht / 2;
96                 fi;
97
98                 lft x1 = 0;
99                 rt  x2 = wd;
100                 y3 - y2 = direction * stem_ht;
101                 (y3 - y2) = (x3 - x2) * tand (90 - dalpha);
102
103                 fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
104                      if direction > 0:
105                              -- get_subpath (ellipse, z2 - z1, z3 - z2, z2)
106                      else:
107                              -- get_subpoint (ellipse, z2 - z1, z2)
108                              -- get_subpoint (ellipse, z3 - z2, z2)
109                      fi
110                      -- get_subpath (ellipse, z3 - z2, z2 - z3, z3)
111                      if direction > 0:
112                              -- get_subpoint (ellipse, z2 - z3, z2)
113                              -- get_subpoint (ellipse, z1 - z2, z2)
114                      else:
115                              -- get_subpath (ellipse, z2 - z3, z1 - z2, z2)
116                      fi
117                      -- cycle;
118
119                 % The stem is intentionally outside of the char box.
120                 if direction > 0:
121                         set_char_box (0, wd#, ht# / 2, stem_ht#);
122                 else:
123                         set_char_box (0, wd#, stem_ht#, ht# / 2);
124                 fi;
125
126                 labels (1, 2, 3);
127         fet_endchar;
128 enddef;
129
130
131 % custos hufnagel, stem up, between staff lines
132 custos_hufnagel ("Custos Hufnagel", "hufnagel.u0", 
133                  dir_up, between_staff_lines);
134
135
136 % custos hufnagel, stem up, on staff line
137 custos_hufnagel ("Custos Hufnagel", "hufnagel.u1", 
138                  dir_up, on_staff_line);
139
140
141 % custos hufnagel, stem up, anywhere
142 custos_hufnagel ("Custos Hufnagel", "hufnagel.u2", 
143                  dir_up, anywhere);
144
145
146 % custos hufnagel, stem down, between staff lines
147 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d0",
148                  dir_down, between_staff_lines);
149
150
151 % custos hufnagel, stem down, on staff line
152 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d1",
153                  dir_down, on_staff_line);
154
155
156 % custos hufnagel, stem down, anywhere
157 custos_hufnagel ("Reverse Custos Hufnagel", "hufnagel.d2",
158                  dir_down, anywhere);
159
160
161 %%%%%%%%
162 %
163 %
164 % Medicaea style
165 %
166 %
167
168 def custos_medicaea (expr verbose_name, internal_name, 
169                           direction, staffline_adjustment) =
170         fet_beginchar (verbose_name, internal_name);
171                 save ht, wd, stem_ht;
172
173                 ht# = noteheight#;
174                 wd# / ht# = 0.25;
175
176                 if staffline_adjustment = between_staff_lines:
177                         stem_ht# = 1.00 staff_space#;
178                 elseif staffline_adjustment = on_staff_line:
179                         stem_ht# = 1.50 staff_space#;
180                 else: % staffline_adjustment = anywhere
181                         stem_ht# = 1.25 staff_space#;
182                 fi;
183
184                 define_pixels (ht, wd, stem_ht);
185
186                 save ellipse, T;
187                 path ellipse;
188                 transform T;
189
190                 T := identity xscaled 0.6 linethickness
191                               yscaled ht;
192                 pickup pencircle transformed T;
193                 ellipse := fullcircle transformed T;
194
195                 lft x1 = 0;
196                 y1 = 0;
197                 rt x2 = wd;
198                 y2 = y1;
199
200                 fill get_subpath (ellipse, left, right, z1)
201                      -- get_subpath (ellipse, right, left, z2)
202                      -- cycle;
203
204                 pickup pencircle scaled 0.6 linethickness;
205
206                 rt x3 = wd;
207                 y3 = 0;
208                 x4 = x3;
209                 if direction > 0:
210                         top y4 = stem_ht;
211                         draw_rounded_block (bot lft z3, top rt z4,
212                                             0.6 linethickness);
213                 else:
214                         bot y4 = -stem_ht;
215                         draw_rounded_block (bot lft z4, top rt z3,
216                                             0.6 linethickness);
217                 fi;
218
219
220                 if direction > 0:
221                         set_char_box (0, wd#, ht# / 2, stem_ht#);
222                 else:
223                         set_char_box (0, wd#, stem_ht#, ht# / 2);
224                 fi;
225
226                 labels (1, 2, 3, 4);
227         fet_endchar;
228 enddef;
229
230
231 % custos medicaea, stem up, between staff lines
232 custos_medicaea ("Custos Med.", "medicaea.u0", 
233                  dir_up, between_staff_lines);
234
235
236 % custos medicaea, stem up, on staff line
237 custos_medicaea ("Custos Med.", "medicaea.u1", 
238                  dir_up, on_staff_line);
239
240
241 % custos medicaea, stem up, anywhere
242 custos_medicaea ("Custos Med.", "medicaea.u2", 
243                  dir_up, anywhere);
244
245
246 % custos medicaea, stem down, between staff lines
247 custos_medicaea ("Reverse Custos Med.", "medicaea.d0", 
248                 dir_down, between_staff_lines);
249
250
251 % custos medicaea, stem down, on staff line
252 custos_medicaea ("Reverse Custos Med.", "medicaea.d1", 
253                  dir_down, on_staff_line);
254
255
256 % custos medicaea, stem down, anywhere
257 custos_medicaea ("Reverse Custos Med.", "medicaea.d2", 
258                  dir_down, anywhere);
259
260
261 %%%%%%%%
262 %
263 %
264 % Editio Vaticana style
265 %
266 %
267
268 def custos_vaticana (expr verbose_name, internal_name, 
269                           direction, staffline_adjustment) =
270         fet_beginchar (verbose_name, internal_name);
271                 save ht, wd, u_offs, l_offs, stem_size, stem_end;
272                 save pen_ht, l_shift, curve_ht, bend_ht;
273
274                 ht# = noteheight#;
275                 wd# = 0.24 ht#;
276
277                 if staffline_adjustment = between_staff_lines:
278                         stem_size# = 1.00;
279                 elseif staffline_adjustment = on_staff_line:
280                         stem_size# = 1.50;
281                 else: % staffline_adjustment = anywhere
282                         stem_size# = 1.25;
283                 fi;
284
285                 curve_ht# = 0.6 ht#;
286                 bend_ht# = 0.10 ht#;
287                 l_shift# = 0.04 ht#;
288                 u_offs# = +direction * 0.5 * (bend_ht# + l_shift#);
289                 l_offs# = -direction * 0.5 * (bend_ht# - l_shift#);
290                 stem_end# = direction * stem_size# * staff_space#;
291                 pen_ht# = curve_ht# - l_shift#;
292
293                 define_pixels (u_offs, l_offs, stem_end, ht, wd, pen_ht);
294
295                 pickup pencircle scaled 0.6 linethickness;
296
297                 z1 = (0, u_offs);
298                 z2 = (0.7 wd, l_offs);
299                 z3 = (wd, l_offs);
300
301                 penpos1 (pen_ht, 90);
302                 penpos2 (pen_ht, 90);
303                 penpos3 (pen_ht, 90);
304
305                 penstroke z1e{z2 - z1}
306                           .. {right}z2e
307                           .. z3e;
308
309                 rt x4 = wd;
310                 x5 = x4;
311
312                 if direction > 0:
313                         y4 = y3r;
314                         top y5 = stem_end;
315                         draw_rounded_block (bot lft z4, top rt z5,
316                                             0.6 linethickness);
317                 else:
318                         y4 = y3l;
319                         bot y5 = stem_end;
320                         draw_rounded_block (bot lft z5, top rt z4,
321                                             0.6 linethickness);
322                 fi;
323
324                 if direction > 0:
325                         set_char_box (0, wd#,
326                                       -l_offs# + 0.5 pen_ht#, stem_end#);
327                 else:
328                         set_char_box (0, wd#,
329                                       -stem_end#, +l_offs# + 0.5 pen_ht#);
330                 fi;
331
332                 penlabels (1, 2, 3);
333                 labels (4, 5);
334         fet_endchar;
335 enddef;
336
337
338 % custos vaticana, stem up, between staff lines
339 custos_vaticana ("Custos Ed. Vat.", "vaticana.u0", 
340                  dir_up, between_staff_lines);
341
342
343 % custos vaticana, stem up, on staff line
344 custos_vaticana ("Custos Ed. Vat.", "vaticana.u1", 
345                  dir_up, on_staff_line);
346
347
348 % custos vaticana, stem up, anywhere
349 custos_vaticana ("Custos Ed. Vat.", "vaticana.u2", 
350                  dir_up, anywhere);
351
352
353 % custos vaticana, stem down, between staff lines
354 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d0", 
355                  dir_down, between_staff_lines);
356
357
358 % custos vaticana, stem down, on_staff_line
359 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d1", 
360                  dir_down, on_staff_line);
361
362
363 % custos vaticana, stem down, anywhere
364 custos_vaticana ("Reverse Custos Ed. Vat.", "vaticana.d2", 
365                  dir_down, anywhere);
366
367
368 %%%%%%%%
369 %
370 %
371 % Mensural style
372 %
373 %
374
375 def custos_mensural (expr verbose_name, internal_name, 
376                           direction, staffline_adjustment) =
377         fet_beginchar (verbose_name, internal_name);
378                 save alpha, dalpha, ht, wd, stem_ht;
379
380                 ht# = noteheight#;
381                 wd# / ht# = 1.2;
382                 alpha = 35;
383                 dalpha = direction * alpha;
384
385                 if staffline_adjustment = between_staff_lines:
386                         stem_ht# = 1.00 staff_space#;
387                 elseif staffline_adjustment = on_staff_line:
388                         stem_ht# = 1.50 staff_space#;
389                 else: % staffline_adjustment = anywhere
390                         stem_ht# = 1.25 staff_space#;
391                 fi;
392
393                 define_pixels (ht, wd, stem_ht);
394
395                 save ellipse, T;
396                 path ellipse;
397                 transform T;
398
399                 T := identity xscaled linethickness
400                               yscaled 0.4 ht
401                               rotated -dalpha;
402                 pickup pencircle transformed T;
403                 ellipse := fullcircle transformed T;
404
405                 if direction > 0:
406                         bot y1 = bot y3 = bot y5 = -direction * 0.33 ht;
407                         top y2 = top y4 = +direction * 0.33 ht;
408                 else:
409                         top y1 = top y3 = top y5 = -direction * 0.33 ht;
410                         bot y2 = bot y4 = +direction * 0.33 ht;
411                 fi;
412
413                 lft x1 = 0.0 wd;
414                 lft x2 = 0.2 wd;
415                 lft x3 = 0.4 wd;
416                 lft x4 = 0.6 wd;
417                 lft x5 = 0.8 wd;
418
419                 y6 - y5 = direction * stem_ht;
420                 y6 - y5 = (x6 - x5) * tand (90 - dalpha);
421
422                 if direction > 0:
423                         fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
424                              -- get_subpoint (ellipse, z2 - z1, z2)
425                              -- get_subpoint (ellipse, z3 - z2, z2)
426                              -- get_subpath (ellipse, z3 - z2, z4 - z3, z3)
427                              -- get_subpoint (ellipse, z4 - z3, z4)
428                              -- get_subpoint (ellipse, z5 - z4, z4)
429                              -- get_subpath (ellipse, z5 - z4, z6 - z5, z5)
430                              -- get_subpath (ellipse, z6 - z5, z5 - z6, z6)
431                              -- get_subpoint (ellipse, z5 - z6, z5)
432                              -- get_subpoint (ellipse, z4 - z5, z5)
433                              -- get_subpath (ellipse, z4 - z5, z3 - z4, z4)
434                              -- get_subpoint (ellipse, z3 - z4, z3)
435                              -- get_subpoint (ellipse, z2 - z3, z3)
436                              -- get_subpath (ellipse, z2 - z3, z1 - z2, z2)
437                              -- cycle;
438                 else:
439                         fill get_subpath (ellipse, z1 - z2, z2 - z1, z1)
440                              -- get_subpath (ellipse, z2 -z1, z3 - z2, z2)
441                              -- get_subpoint (ellipse, z3 - z2, z3)
442                              -- get_subpoint (ellipse, z4 - z3, z3)
443                              -- get_subpath (ellipse, z4 -z3, z5 - z4, z4)
444                              -- get_subpoint (ellipse, z5 - z4, z5)
445                              -- get_subpoint (ellipse, z6 - z5, z5)
446                              -- get_subpath (ellipse, z6 - z5, z5 - z6, z6)
447                              -- get_subpath (ellipse, z5 - z6, z4 - z5, z5)
448                              -- get_subpoint (ellipse, z4 - z5, z4)
449                              -- get_subpoint (ellipse, z3 - z4, z4)
450                              -- get_subpath (ellipse, z3 - z4, z2 - z3, z3)
451                              -- get_subpoint (ellipse, z2 - z3, z2)
452                              -- get_subpoint (ellipse, z1 - z2, z2)
453                              -- cycle;
454                 fi;
455
456                 % The stem is intentionally outside of the char box.
457                 if direction > 0:
458                         set_char_box (0, wd#,
459                                       +direction * 0.33 ht#, stem_ht#);
460                 else:
461                         set_char_box (0, wd#,
462                                       stem_ht#, -direction * 0.33 ht#);
463                 fi;
464
465                 labels (1, 2, 3, 4, 5, 6);
466         fet_endchar;
467 enddef;
468
469
470 % custos mensural, stem up, between staff lines
471 custos_mensural ("Custos Mensural", "mensural.u0", 
472                  dir_up, between_staff_lines);
473
474
475 % custos mensural, stem up, on staff line
476 custos_mensural ("Custos Mensural", "mensural.u1", 
477                  dir_up, on_staff_line);
478
479
480 % custos mensural, stem up, anywhere
481 custos_mensural ("Custos Mensural", "mensural.u2", 
482                  dir_up, anywhere);
483
484
485 % custos mensural, stem down, between staff lines
486 custos_mensural ("Reverse Custos Mensural", "mensural.d0", 
487                  dir_down, between_staff_lines);
488
489
490 % custos mensural, stem down, on staff line
491 custos_mensural ("Reverse Custos Mensural", "mensural.d1", 
492                  dir_down, on_staff_line);
493
494
495 % custos mensural, stem down, anywhere
496 custos_mensural ("Reverse Custos Mensural", "mensural.d2", 
497                  dir_down, anywhere);
498
499
500 fet_endgroup ("custodes");