1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-custodes.mf -- implement ancient custodes
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 2000--2003 Juergen Reuter <reuter@ipd.uka.de>
9 save black_notehead_width;
10 numeric black_notehead_width;
12 fet_begingroup ("custodes")
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
37 noteheight#:=staff_space#+ (1 + overdone_heads) *stafflinethickness#;
38 define_pixels(noteheight);
40 save between_staff_lines, on_staff_line, anywhere;
41 between_staff_lines = 0;
45 save dir_up, dir_down;
57 % parameterized hufnagel custos
58 def custos_hufnagel(expr verbose_name, internal_name, ly_name,
59 direction, staffline_adjustment) =
61 fet_beginchar(verbose_name, internal_name, ly_name)
62 save alpha, dalpha, ht, wd, stem_ht, pen_size;
66 dalpha# = direction*alpha#;
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#;
75 pen_size# = 0.5*sqrt(wd#*wd#+ht#*ht#);
77 define_pixels(ht, wd, pen_size, stem_ht);
79 xscaled stafflinethickness
83 if direction = dir_up:
92 y3 - y2 = direction*stem_ht;
93 (y3 - y2) = (x3 - x2) * tand(90-dalpha#);
96 % The stem is intentionally outside of the char box.
98 set_char_box(0, wd#, ht#/2, stem_ht#);
100 set_char_box(0, wd#, stem_ht#, ht#/2);
105 % custos hufnagel, stem up, between staff lines
106 custos_hufnagel("Custos Hufnagel", "hufnagel-u0", "hufnagelu0",
107 dir_up, between_staff_lines);
109 % custos hufnagel, stem up, on staff line
110 custos_hufnagel("Custos Hufnagel", "hufnagel-u1", "hufnagelu1",
111 dir_up, on_staff_line);
113 % custos hufnagel, stem up, anywhere
114 custos_hufnagel("Custos Hufnagel", "hufnagel-u2", "hufnagelu2",
117 % custos hufnagel, stem down, between staff lines
118 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d0", "hufnageld0",
119 dir_down, between_staff_lines);
121 % custos hufnagel, stem down, on staff line
122 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d1", "hufnageld1",
123 dir_down, on_staff_line);
125 % custos hufnagel, stem down, anywhere
126 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d2", "hufnageld2",
136 def custos_medicaea(expr verbose_name, internal_name, ly_name,
137 direction, staffline_adjustment) =
139 fet_beginchar(verbose_name, internal_name, ly_name)
141 save ht, wd, stem_ht;
145 if staffline_adjustment = between_staff_lines:
146 stem_ht# = 1.00 staff_space#;
147 elseif staffline_adjustment = on_staff_line:
148 stem_ht# = 1.50 staff_space#;
149 else: % staffline_adjustment = anywhere
150 stem_ht# = 1.25 staff_space#;
153 define_pixels(ht, wd, stem_ht);
155 pickup pencircle xscaled 0.6stafflinethickness yscaled ht;
162 pickup pencircle scaled 0.6stafflinethickness;
166 y4 = direction*stem_ht;
170 set_char_box(0, wd#, ht#/2, stem_ht#);
172 set_char_box(0, wd#, stem_ht#, ht#/2);
177 % custos medicaea, stem up, between staff lines
178 custos_medicaea("Custos Med.", "medicaea-u0", "medicaeau0",
179 dir_up, between_staff_lines);
181 % custos medicaea, stem up, on staff line
182 custos_medicaea("Custos Med.", "medicaea-u1", "medicaeau1",
183 dir_up, on_staff_line);
185 % custos medicaea, stem up, anywhere
186 custos_medicaea("Custos Med.", "medicaea-u2", "medicaeau2",
189 % custos medicaea, stem down, between staff lines
190 custos_medicaea("Reverse Custos Med.", "medicaea-d0", "medicaead0",
191 dir_down, between_staff_lines);
193 % custos medicaea, stem down, on staff line
194 custos_medicaea("Reverse Custos Med.", "medicaea-d1", "medicaead1",
195 dir_down, on_staff_line);
197 % custos medicaea, stem down, anywhere
198 custos_medicaea("Reverse Custos Med.", "medicaea-d2", "medicaead2",
204 % Editio Vaticana style
208 def custos_vaticana(expr verbose_name, internal_name, ly_name,
209 direction, staffline_adjustment) =
211 fet_beginchar(verbose_name, internal_name, ly_name)
212 save ht, wd, u_offs, l_offs, stem_size, stem_end;
213 save pen_ht, l_shift, curve_ht, bend_ht;
217 if staffline_adjustment = between_staff_lines:
219 elseif staffline_adjustment = on_staff_line:
221 else: % staffline_adjustment = anywhere
227 u_offs# = +direction*0.5*(bend_ht#+l_shift#);
228 l_offs# = -direction*0.5*(bend_ht#-l_shift#);
229 stem_end# = direction*stem_size#*staff_space#;
230 pen_ht# = curve_ht#-l_shift#;
232 define_pixels(u_offs, l_offs, stem_end, ht, wd, pen_ht);
234 pickup pencircle scaled 0.6stafflinethickness;
236 z2 = (0.7wd, l_offs);
241 penstroke z1e{z2 - z1} .. {right}z2e .. z3e;
250 set_char_box(0, wd#, -l_offs#+0.5pen_ht#, stem_end#);
252 set_char_box(0, wd#, -stem_end#, +l_offs#+0.5pen_ht#);
258 % custos vaticana, stem up, between staff lines
259 custos_vaticana("Custos Ed. Vat.", "vaticana-u0", "vaticanau0",
260 dir_up, between_staff_lines);
262 % custos vaticana, stem up, on staff line
263 custos_vaticana("Custos Ed. Vat.", "vaticana-u1", "vaticanau1",
264 dir_up, on_staff_line);
266 % custos vaticana, stem up, anywhere
267 custos_vaticana("Custos Ed. Vat.", "vaticana-u2", "vaticanau2",
270 % custos vaticana, stem down, between staff lines
271 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d0", "vaticanad0",
272 dir_down, between_staff_lines);
274 % custos vaticana, stem down, on_staff_line
275 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d1", "vaticanad1",
276 dir_down, on_staff_line);
278 % custos vaticana, stem down, anywhere
279 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d2", "vaticanad2",
289 def custos_mensural(expr verbose_name, internal_name, ly_name,
290 direction, staffline_adjustment) =
292 fet_beginchar(verbose_name, internal_name, ly_name)
293 save alpha, dalpha, ht, wd, stem_ht;
297 dalpha# = direction*alpha#;
299 if staffline_adjustment = between_staff_lines:
300 stem_ht# = 1.00 staff_space#;
301 elseif staffline_adjustment = on_staff_line:
302 stem_ht# = 1.50 staff_space#;
303 else: % staffline_adjustment = anywhere
304 stem_ht# = 1.25 staff_space#;
307 define_pixels(ht, wd, stem_ht);
309 xscaled stafflinethickness
314 bot y1 = bot y3 = bot y5 = -direction*0.33ht;
315 top y2 = top y4 = +direction*0.33ht;
317 top y1 = top y3 = top y5 = -direction*0.33ht;
318 bot y2 = bot y4 = +direction*0.33ht;
320 lft x1 = 0.0wd; lft x2 = 0.2wd; lft x3 = 0.4wd;
321 lft x4 = 0.6wd; lft x5 = 0.8wd;
322 y6 - y5 = direction*stem_ht;
323 (y6 - y5) = (x6 - x5) * tand(90-dalpha#);
325 draw z1 -- z2 -- z3 -- z4 -- z5 -- z6;
327 % The stem is intentionally outside of the char box.
329 set_char_box(0, wd#, +direction*0.33ht#, stem_ht#);
331 set_char_box(0, wd#, stem_ht#, -direction*0.33ht#);
336 % custos mensural, stem up, between staff lines
337 custos_mensural("Custos Mensural", "mensural-u0", "mensuralu0",
338 dir_up, between_staff_lines);
340 % custos mensural, stem up, on staff line
341 custos_mensural("Custos Mensural", "mensural-u1", "mensuralu1",
342 dir_up, on_staff_line);
344 % custos mensural, stem up, anywhere
345 custos_mensural("Custos Mensural", "mensural-u2", "mensuralu2",
348 % custos mensural, stem down, between staff lines
349 custos_mensural("Reverse Custos Mensural", "mensural-d0", "mensurald0",
350 dir_down, between_staff_lines);
352 % custos mensural, stem down, on staff line
353 custos_mensural("Reverse Custos Mensural", "mensural-d1", "mensurald1",
354 dir_down, on_staff_line);
356 % custos mensural, stem down, anywhere
357 custos_mensural("Reverse Custos Mensural", "mensural-d2", "mensurald2",
360 fet_endgroup ("custodes")