]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-custodes.mf
* mf/parmesan-custodes.mf: vaticana custos: bugfix: slightly
[lilypond.git] / mf / parmesan-custodes.mf
1 % -*-Fundamental-*-
2 % parmesan-custodes.mf -- implement ancient custodes
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c)  2000--2003 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 noteheight#:=staff_space#+ (1 + overdone_heads) *stafflinethickness#;
15 define_pixels(noteheight);
16
17 save between_staff_lines, on_staff_line, anywhere;
18 between_staff_lines = 0;
19 on_staff_line = 1;
20 anywhere = 2;
21
22 save dir_up, dir_down;
23 dir_up = 1;
24 dir_down = -1;
25
26
27 %%%%%%%%
28 %
29 %
30 % Hufnagel style
31 %
32 %
33
34 % parameterized hufnagel custos
35 def custos_hufnagel(expr verbose_name, internal_name, ly_name,
36                     direction, staffline_adjustment) =
37
38         fet_beginchar(verbose_name, internal_name, ly_name)
39                 save alpha, dalpha, ht, wd, stem_ht, pen_size;
40                 ht# = noteheight#;
41                 wd#/ht# = 0.6;
42                 alpha# = 35;
43                 dalpha# = direction*alpha#;
44
45                 if staffline_adjustment = between_staff_lines:
46                         stem_ht# = 1.00 staff_space#;
47                 elseif staffline_adjustment = on_staff_line:
48                         stem_ht# = 1.50 staff_space#;
49                 else: % staffline_adjustment = anywhere
50                         stem_ht# = 1.25 staff_space#;
51                 fi;
52                 pen_size# = 0.5*sqrt(wd#*wd#+ht#*ht#);
53
54                 define_pixels(ht, wd, pen_size, stem_ht);
55                 pickup pencircle
56                   xscaled stafflinethickness
57                   yscaled pen_size
58                   rotated -dalpha#;
59
60                 if direction = dir_up:
61                         top y1 = ht/2;
62                         bot y2 = -ht/2;
63                 else:
64                         bot y1 = -ht/2;
65                         top y2 = ht/2;
66                 fi;
67                 lft x1 = 0;
68                 rt  x2 = wd;
69                 y3 - y2 = direction*stem_ht;
70                 (y3 - y2) = (x3 - x2) * tand(90-dalpha#);
71                 draw z1 -- z2 -- z3;
72
73                 if direction > 0:
74                         set_char_box(0, wd#, ht#/2, stem_ht#);
75                 else:
76                         set_char_box(0, wd#, stem_ht#, ht#/2);
77                 fi;
78         fet_endchar;
79 enddef;
80
81 % custos hufnagel, stem up, between staff lines
82 custos_hufnagel("Custos Hufnagel", "hufnagel-u0", "hufnagelu0",
83                 dir_up, between_staff_lines);
84
85 % custos hufnagel, stem up, on staff line
86 custos_hufnagel("Custos Hufnagel", "hufnagel-u1", "hufnagelu1",
87                 dir_up, on_staff_line);
88
89 % custos hufnagel, stem up, anywhere
90 custos_hufnagel("Custos Hufnagel", "hufnagel-u2", "hufnagelu2",
91                 dir_up, anywhere);
92
93 % custos hufnagel, stem down, between staff lines
94 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d0", "hufnageld0",
95                 dir_down, between_staff_lines);
96
97 % custos hufnagel, stem down, on staff line
98 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d1", "hufnageld1",
99                 dir_down, on_staff_line);
100
101 % custos hufnagel, stem down, anywhere
102 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d2", "hufnageld2",
103                 dir_down, anywhere);
104
105 %%%%%%%%
106 %
107 %
108 % Medicaea style
109 %
110 %
111
112 def custos_medicaea(expr verbose_name, internal_name, ly_name,
113                     direction, staffline_adjustment) =
114
115         fet_beginchar(verbose_name, internal_name, ly_name)
116
117                 save ht, wd, stem_ht;
118                 ht# = noteheight#;
119                 wd#/ht# = 0.25;
120
121                 if staffline_adjustment = between_staff_lines:
122                         stem_ht# = 1.00 staff_space#;
123                 elseif staffline_adjustment = on_staff_line:
124                         stem_ht# = 1.50 staff_space#;
125                 else: % staffline_adjustment = anywhere
126                         stem_ht# = 1.25 staff_space#;
127                 fi;
128
129                 define_pixels(ht, wd, stem_ht);
130
131                 pickup pencircle xscaled 0.6stafflinethickness yscaled ht;
132                 lft x1 = 0;
133                 y1 = 0;
134                 rt x2 = wd;
135                 y2 = y1;
136                 draw z1 -- z2;
137
138                 pickup pencircle scaled 0.6stafflinethickness;
139                 rt x3 = wd;
140                 y3 = 0;
141                 x4 = x3;
142                 y4 = direction*stem_ht;
143                 draw z3 -- z4;
144
145                 if direction > 0:
146                         set_char_box(0, wd#, ht#/2, stem_ht#);
147                 else:
148                         set_char_box(0, wd#, stem_ht#, ht#/2);
149                 fi;
150         fet_endchar;
151 enddef;
152
153 % custos medicaea, stem up, between staff lines
154 custos_medicaea("Custos Med.", "medicaea-u0", "medicaeau0",
155                 dir_up, between_staff_lines);
156
157 % custos medicaea, stem up, on staff line
158 custos_medicaea("Custos Med.", "medicaea-u1", "medicaeau1",
159                 dir_up, on_staff_line);
160
161 % custos medicaea, stem up, anywhere
162 custos_medicaea("Custos Med.", "medicaea-u2", "medicaeau2",
163                 dir_up, anywhere);
164
165 % custos medicaea, stem down, between staff lines
166 custos_medicaea("Reverse Custos Med.", "medicaea-d0", "medicaead0",
167                 dir_down, between_staff_lines);
168
169 % custos medicaea, stem down, on staff line
170 custos_medicaea("Reverse Custos Med.", "medicaea-d1", "medicaead1",
171                 dir_down, on_staff_line);
172
173 % custos medicaea, stem down, anywhere
174 custos_medicaea("Reverse Custos Med.", "medicaea-d2", "medicaead2",
175                 dir_down, anywhere);
176
177 %%%%%%%%
178 %
179 %
180 % Editio Vaticana style
181 %
182 %
183
184 def custos_vaticana(expr verbose_name, internal_name, ly_name,
185                     direction, staffline_adjustment) =
186
187         fet_beginchar(verbose_name, internal_name, ly_name)
188                 save ht, wd, u_offs, l_offs, stem_size, stem_end;
189                 save pen_ht, l_shift, curve_ht, bend_ht;
190                 ht# = noteheight#;
191                 wd# = 0.24ht#;
192
193                 if staffline_adjustment = between_staff_lines:
194                         stem_size# = 1.00;
195                 elseif staffline_adjustment = on_staff_line:
196                         stem_size# = 1.50;
197                 else: % staffline_adjustment = anywhere
198                         stem_size# = 1.25;
199                 fi;
200                 curve_ht# = 0.6ht#;
201                 bend_ht# = 0.10ht#;
202                 l_shift# = 0.04ht#;
203                 u_offs# = +direction*0.5*(bend_ht#+l_shift#);
204                 l_offs# = -direction*0.5*(bend_ht#-l_shift#);
205                 stem_end# = direction*stem_size#*staff_space#;
206                 pen_ht# = curve_ht#-l_shift#;
207
208                 define_pixels(u_offs, l_offs, stem_end, ht, wd, pen_ht);
209
210                 pickup pencircle scaled 0.6stafflinethickness;
211                 z1 = (0, u_offs);
212                 z2 = (0.7wd, l_offs);
213                 z3 = (wd, l_offs);
214                 penpos1(pen_ht, 90);
215                 penpos2(pen_ht, 90);
216                 penpos3(pen_ht, 90);
217                 penstroke z1e{z2 - z1} .. {right}z2e .. z3e;
218
219                 rt x4 = wd;
220                 bot y4 = 0;
221                 x5 = x4;
222                 top y5 = stem_end;
223                 draw z4 -- z5;
224
225                 if direction > 0:
226                         set_char_box(0, wd#, -l_offs#+0.5pen_ht#, stem_end#);
227                 else:
228                         set_char_box(0, wd#, -stem_end#, +l_offs#+0.5pen_ht#);
229                 fi;
230
231         fet_endchar;
232 enddef;
233
234 % custos vaticana, stem up, between staff lines
235 custos_vaticana("Custos Ed. Vat.", "vaticana-u0", "vaticanau0",
236                 dir_up, between_staff_lines);
237
238 % custos vaticana, stem up, on staff line
239 custos_vaticana("Custos Ed. Vat.", "vaticana-u1", "vaticanau1",
240                 dir_up, on_staff_line);
241
242 % custos vaticana, stem up, anywhere
243 custos_vaticana("Custos Ed. Vat.", "vaticana-u2", "vaticanau2",
244                 dir_up, anywhere);
245
246 % custos vaticana, stem down, between staff lines
247 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d0", "vaticanad0",
248                 dir_down, between_staff_lines);
249
250 % custos vaticana, stem down, on_staff_line
251 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d1", "vaticanad1",
252                 dir_down, on_staff_line);
253
254 % custos vaticana, stem down, anywhere
255 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d2", "vaticanad2",
256                 dir_down, anywhere);
257
258 %%%%%%%%
259 %
260 %
261 % Mensural style
262 %
263 %
264
265 def custos_mensural(expr verbose_name, internal_name, ly_name,
266                     direction, staffline_adjustment) =
267
268         fet_beginchar(verbose_name, internal_name, ly_name)
269                 save alpha, dalpha, ht, wd, stem_ht;
270                 ht# = noteheight#;
271                 wd#/ht# = 1.2;
272                 alpha# = 35;
273                 dalpha# = direction*alpha#;
274
275                 if staffline_adjustment = between_staff_lines:
276                         stem_ht# = 1.00 staff_space#;
277                 elseif staffline_adjustment = on_staff_line:
278                         stem_ht# = 1.50 staff_space#;
279                 else: % staffline_adjustment = anywhere
280                         stem_ht# = 1.25 staff_space#;
281                 fi;
282
283                 define_pixels(ht, wd, stem_ht);
284                 pickup pencircle
285                   xscaled stafflinethickness
286                   yscaled 0.4ht
287                   rotated -dalpha#;
288
289                 if direction > 0:
290                         bot y1 = bot y3 = bot y5 = -direction*0.33ht;
291                         top y2 = top y4 = +direction*0.33ht;
292                 else:
293                         top y1 = top y3 = top y5 = -direction*0.33ht;
294                         bot y2 = bot y4 = +direction*0.33ht;
295                 fi;
296                 lft x1 = 0.0wd; lft x2 = 0.2wd; lft x3 = 0.4wd;
297                 lft x4 = 0.6wd; lft x5 = 0.8wd;
298                 y6 - y5 = direction*stem_ht;
299                 (y6 - y5) = (x6 - x5) * tand(90-dalpha#);
300
301                 draw z1 -- z2 -- z3 -- z4 -- z5 -- z6;
302
303                 if direction > 0:
304                         set_char_box(0, wd#, +direction*0.33ht#, stem_ht#);
305                 else:
306                         set_char_box(0, wd#, stem_ht#, -direction*0.33ht#);
307                 fi;
308         fet_endchar;
309 enddef;
310
311 % custos mensural, stem up, between staff lines
312 custos_mensural("Custos Mensural", "mensural-u0", "mensuralu0",
313                 dir_up, between_staff_lines);
314
315 % custos mensural, stem up, on staff line
316 custos_mensural("Custos Mensural", "mensural-u1", "mensuralu1",
317                 dir_up, on_staff_line);
318
319 % custos mensural, stem up, anywhere
320 custos_mensural("Custos Mensural", "mensural-u2", "mensuralu2",
321                 dir_up, anywhere);
322
323 % custos mensural, stem down, between staff lines
324 custos_mensural("Reverse Custos Mensural", "mensural-d0", "mensurald0",
325                 dir_down, between_staff_lines);
326
327 % custos mensural, stem down, on staff line
328 custos_mensural("Reverse Custos Mensural", "mensural-d1", "mensurald1",
329                 dir_down, on_staff_line);
330
331 % custos mensural, stem down, anywhere
332 custos_mensural("Reverse Custos Mensural", "mensural-d2", "mensurald2",
333                 dir_down, anywhere);
334
335 fet_endgroup ("custodes")