* ly/nederlands.ly: add comment about digits.
[lilypond.git] / mf / parmesan-custodes.mf
blob12b54bf7400a0534b7b70fedd62377731e01570d
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--2004 Juergen Reuter <reuter@ipd.uka.de>
7
9 save black_notehead_width;
10 numeric black_notehead_width;
12 fet_begingroup ("custodes")
15 % character aligment:
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).
21 % set_char_box() conventions:
23 % * breapth: Ignored (as far as I know).  Should be set to 0.
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.
30 % * depth: Should match the bottom edge of the custos.  Affects
31 %   vertical collision handling.
33 % * height: Should match the top edge of the custos.  Affects vertical
34 %   collision handling.
37 save between_staff_lines, on_staff_line, anywhere;
38 between_staff_lines = 0;
39 on_staff_line = 1;
40 anywhere = 2;
42 save dir_up, dir_down;
43 dir_up = 1;
44 dir_down = -1;
47 %%%%%%%%
50 % Hufnagel style
54 % parameterized hufnagel custos
55 def custos_hufnagel(expr verbose_name, internal_name, ly_name,
56                     direction, staffline_adjustment) =
58         fet_beginchar(verbose_name, internal_name, ly_name)
59                 save alpha, dalpha, ht, wd, stem_ht, pen_size;
60                 ht# = noteheight#;
61                 wd#/ht# = 0.6;
62                 alpha# = 35;
63                 dalpha# = direction*alpha#;
65                 if staffline_adjustment = between_staff_lines:
66                         stem_ht# = 1.00 staff_space#;
67                 elseif staffline_adjustment = on_staff_line:
68                         stem_ht# = 1.50 staff_space#;
69                 else: % staffline_adjustment = anywhere
70                         stem_ht# = 1.25 staff_space#;
71                 fi;
72                 pen_size# = 0.5*sqrt(wd#*wd#+ht#*ht#);
74                 define_pixels(ht, wd, pen_size, stem_ht);
75                 pickup pencircle
76                   xscaled linethickness
77                   yscaled pen_size
78                   rotated -dalpha#;
80                 if direction = dir_up:
81                         top y1 = ht/2;
82                         bot y2 = -ht/2;
83                 else:
84                         bot y1 = -ht/2;
85                         top y2 = ht/2;
86                 fi;
87                 lft x1 = 0;
88                 rt  x2 = wd;
89                 y3 - y2 = direction*stem_ht;
90                 (y3 - y2) = (x3 - x2) * tand(90-dalpha#);
91                 draw z1 -- z2 -- z3;
93                 % The stem is intentionally outside of the char box.
94                 if direction > 0:
95                         set_char_box(0, wd#, ht#/2, stem_ht#);
96                 else:
97                         set_char_box(0, wd#, stem_ht#, ht#/2);
98                 fi;
99         fet_endchar;
100 enddef;
102 % custos hufnagel, stem up, between staff lines
103 custos_hufnagel("Custos Hufnagel", "hufnagel-u0", "hufnagelu0",
104                 dir_up, between_staff_lines);
106 % custos hufnagel, stem up, on staff line
107 custos_hufnagel("Custos Hufnagel", "hufnagel-u1", "hufnagelu1",
108                 dir_up, on_staff_line);
110 % custos hufnagel, stem up, anywhere
111 custos_hufnagel("Custos Hufnagel", "hufnagel-u2", "hufnagelu2",
112                 dir_up, anywhere);
114 % custos hufnagel, stem down, between staff lines
115 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d0", "hufnageld0",
116                 dir_down, between_staff_lines);
118 % custos hufnagel, stem down, on staff line
119 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d1", "hufnageld1",
120                 dir_down, on_staff_line);
122 % custos hufnagel, stem down, anywhere
123 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d2", "hufnageld2",
124                 dir_down, anywhere);
126 %%%%%%%%
129 % Medicaea style
133 def custos_medicaea(expr verbose_name, internal_name, ly_name,
134                     direction, staffline_adjustment) =
136         fet_beginchar(verbose_name, internal_name, ly_name)
138                 save ht, wd, stem_ht;
139                 ht# = noteheight#;
140                 wd#/ht# = 0.25;
142                 if staffline_adjustment = between_staff_lines:
143                         stem_ht# = 1.00 staff_space#;
144                 elseif staffline_adjustment = on_staff_line:
145                         stem_ht# = 1.50 staff_space#;
146                 else: % staffline_adjustment = anywhere
147                         stem_ht# = 1.25 staff_space#;
148                 fi;
150                 define_pixels(ht, wd, stem_ht);
152                 pickup pencircle xscaled 0.6linethickness yscaled ht;
153                 lft x1 = 0;
154                 y1 = 0;
155                 rt x2 = wd;
156                 y2 = y1;
157                 draw z1 -- z2;
159                 pickup pencircle scaled 0.6linethickness;
160                 rt x3 = wd;
161                 y3 = 0;
162                 x4 = x3;
163                 y4 = direction*stem_ht;
164                 draw z3 -- z4;
166                 if direction > 0:
167                         set_char_box(0, wd#, ht#/2, stem_ht#);
168                 else:
169                         set_char_box(0, wd#, stem_ht#, ht#/2);
170                 fi;
171         fet_endchar;
172 enddef;
174 % custos medicaea, stem up, between staff lines
175 custos_medicaea("Custos Med.", "medicaea-u0", "medicaeau0",
176                 dir_up, between_staff_lines);
178 % custos medicaea, stem up, on staff line
179 custos_medicaea("Custos Med.", "medicaea-u1", "medicaeau1",
180                 dir_up, on_staff_line);
182 % custos medicaea, stem up, anywhere
183 custos_medicaea("Custos Med.", "medicaea-u2", "medicaeau2",
184                 dir_up, anywhere);
186 % custos medicaea, stem down, between staff lines
187 custos_medicaea("Reverse Custos Med.", "medicaea-d0", "medicaead0",
188                 dir_down, between_staff_lines);
190 % custos medicaea, stem down, on staff line
191 custos_medicaea("Reverse Custos Med.", "medicaea-d1", "medicaead1",
192                 dir_down, on_staff_line);
194 % custos medicaea, stem down, anywhere
195 custos_medicaea("Reverse Custos Med.", "medicaea-d2", "medicaead2",
196                 dir_down, anywhere);
198 %%%%%%%%
201 % Editio Vaticana style
205 def custos_vaticana(expr verbose_name, internal_name, ly_name,
206                     direction, staffline_adjustment) =
208         fet_beginchar(verbose_name, internal_name, ly_name)
209                 save ht, wd, u_offs, l_offs, stem_size, stem_end;
210                 save pen_ht, l_shift, curve_ht, bend_ht;
211                 ht# = noteheight#;
212                 wd# = 0.24ht#;
214                 if staffline_adjustment = between_staff_lines:
215                         stem_size# = 1.00;
216                 elseif staffline_adjustment = on_staff_line:
217                         stem_size# = 1.50;
218                 else: % staffline_adjustment = anywhere
219                         stem_size# = 1.25;
220                 fi;
221                 curve_ht# = 0.6ht#;
222                 bend_ht# = 0.10ht#;
223                 l_shift# = 0.04ht#;
224                 u_offs# = +direction*0.5*(bend_ht#+l_shift#);
225                 l_offs# = -direction*0.5*(bend_ht#-l_shift#);
226                 stem_end# = direction*stem_size#*staff_space#;
227                 pen_ht# = curve_ht#-l_shift#;
229                 define_pixels(u_offs, l_offs, stem_end, ht, wd, pen_ht);
231                 pickup pencircle scaled 0.6linethickness;
232                 z1 = (0, u_offs);
233                 z2 = (0.7wd, l_offs);
234                 z3 = (wd, l_offs);
235                 penpos1(pen_ht, 90);
236                 penpos2(pen_ht, 90);
237                 penpos3(pen_ht, 90);
238                 penstroke z1e{z2 - z1} .. {right}z2e .. z3e;
240                 rt x4 = wd;
241                 bot y4 = 0;
242                 x5 = x4;
243                 top y5 = stem_end;
244                 draw z4 -- z5;
246                 if direction > 0:
247                         set_char_box(0, wd#, -l_offs#+0.5pen_ht#, stem_end#);
248                 else:
249                         set_char_box(0, wd#, -stem_end#, +l_offs#+0.5pen_ht#);
250                 fi;
252         fet_endchar;
253 enddef;
255 % custos vaticana, stem up, between staff lines
256 custos_vaticana("Custos Ed. Vat.", "vaticana-u0", "vaticanau0",
257                 dir_up, between_staff_lines);
259 % custos vaticana, stem up, on staff line
260 custos_vaticana("Custos Ed. Vat.", "vaticana-u1", "vaticanau1",
261                 dir_up, on_staff_line);
263 % custos vaticana, stem up, anywhere
264 custos_vaticana("Custos Ed. Vat.", "vaticana-u2", "vaticanau2",
265                 dir_up, anywhere);
267 % custos vaticana, stem down, between staff lines
268 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d0", "vaticanad0",
269                 dir_down, between_staff_lines);
271 % custos vaticana, stem down, on_staff_line
272 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d1", "vaticanad1",
273                 dir_down, on_staff_line);
275 % custos vaticana, stem down, anywhere
276 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d2", "vaticanad2",
277                 dir_down, anywhere);
279 %%%%%%%%
282 % Mensural style
286 def custos_mensural(expr verbose_name, internal_name, ly_name,
287                     direction, staffline_adjustment) =
289         fet_beginchar(verbose_name, internal_name, ly_name)
290                 save alpha, dalpha, ht, wd, stem_ht;
291                 ht# = noteheight#;
292                 wd#/ht# = 1.2;
293                 alpha# = 35;
294                 dalpha# = direction*alpha#;
296                 if staffline_adjustment = between_staff_lines:
297                         stem_ht# = 1.00 staff_space#;
298                 elseif staffline_adjustment = on_staff_line:
299                         stem_ht# = 1.50 staff_space#;
300                 else: % staffline_adjustment = anywhere
301                         stem_ht# = 1.25 staff_space#;
302                 fi;
304                 define_pixels(ht, wd, stem_ht);
305                 pickup pencircle
306                   xscaled linethickness
307                   yscaled 0.4ht
308                   rotated -dalpha#;
310                 if direction > 0:
311                         bot y1 = bot y3 = bot y5 = -direction*0.33ht;
312                         top y2 = top y4 = +direction*0.33ht;
313                 else:
314                         top y1 = top y3 = top y5 = -direction*0.33ht;
315                         bot y2 = bot y4 = +direction*0.33ht;
316                 fi;
317                 lft x1 = 0.0wd; lft x2 = 0.2wd; lft x3 = 0.4wd;
318                 lft x4 = 0.6wd; lft x5 = 0.8wd;
319                 y6 - y5 = direction*stem_ht;
320                 (y6 - y5) = (x6 - x5) * tand(90-dalpha#);
322                 draw z1 -- z2 -- z3 -- z4 -- z5 -- z6;
324                 % The stem is intentionally outside of the char box.
325                 if direction > 0:
326                         set_char_box(0, wd#, +direction*0.33ht#, stem_ht#);
327                 else:
328                         set_char_box(0, wd#, stem_ht#, -direction*0.33ht#);
329                 fi;
330         fet_endchar;
331 enddef;
333 % custos mensural, stem up, between staff lines
334 custos_mensural("Custos Mensural", "mensural-u0", "mensuralu0",
335                 dir_up, between_staff_lines);
337 % custos mensural, stem up, on staff line
338 custos_mensural("Custos Mensural", "mensural-u1", "mensuralu1",
339                 dir_up, on_staff_line);
341 % custos mensural, stem up, anywhere
342 custos_mensural("Custos Mensural", "mensural-u2", "mensuralu2",
343                 dir_up, anywhere);
345 % custos mensural, stem down, between staff lines
346 custos_mensural("Reverse Custos Mensural", "mensural-d0", "mensurald0",
347                 dir_down, between_staff_lines);
349 % custos mensural, stem down, on staff line
350 custos_mensural("Reverse Custos Mensural", "mensural-d1", "mensurald1",
351                 dir_down, on_staff_line);
353 % custos mensural, stem down, anywhere
354 custos_mensural("Reverse Custos Mensural", "mensural-d2", "mensurald2",
355                 dir_down, anywhere);
357 fet_endgroup ("custodes")