]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-custodes.mf
* lily/vaticana-ligature-engraver.cc: bugfix: fixed programming
[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
40                 save b_h, a_w;
41                 a_b := 1.54; % b_h * a_b / a_w = wd / ht
42                 b_h := 0.85;
43                 a_w := 1.09;
44
45                 save a, beta, ht, wd;
46                 ht# = noteheight#;
47                 2beta# = ht# * b_h;
48                 a# = beta# * a_b;
49                 wd# = 2a# / a_w;
50                 black_notehead_width# := wd#;
51
52                 save rh_width, rh_height, rh_edge; % rhombus dimensions
53                 rh_width# / ht# = tand(35);
54                 rh_height# = 1.0ht#;
55                 rh_edge# * cosd(35) = ht# / 2;
56
57                 save stem_size;
58                 if staffline_adjustment = between_staff_lines:
59                         stem_size = 0.25;
60                 elseif staffline_adjustment = on_staff_line:
61                         stem_size = 0.75;
62                 else: % staffline_adjustment = anywhere
63                         stem_size = 0.50;
64                 fi;
65
66                 define_pixels(rh_width, rh_height, rh_edge);
67                 pickup pencircle
68                   xscaled stafflinethickness
69                   yscaled rh_edge
70                   rotated (-35*direction);
71                 z1=(0.0rh_width,+0.25direction*rh_height);
72                 z2=(0.5rh_width,-0.25direction*rh_height);
73                 z3-z2=(stem_size*rh_width,+0.75*stem_size*direction*rh_height);
74                 draw z1 -- z2 -- z3;
75
76                 set_char_box(stafflinethickness#, wd# / 2,
77                              ht# / 2, ht# / 2);
78
79         fet_endchar;
80 enddef;
81
82 % custos hufnagel, stem up, between staff lines
83 custos_hufnagel("Custos Hufnagel", "hufnagel-u0", "hufnagelu0",
84                 dir_up, between_staff_lines);
85
86 % custos hufnagel, stem up, on staff line
87 custos_hufnagel("Custos Hufnagel", "hufnagel-u1", "hufnagelu1",
88                 dir_up, on_staff_line);
89
90 % custos hufnagel, stem up, anywhere
91 custos_hufnagel("Custos Hufnagel", "hufnagel-u2", "hufnagelu2",
92                 dir_up, anywhere);
93
94 % custos hufnagel, stem down, between staff lines
95 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d0", "hufnageld0",
96                 dir_down, between_staff_lines);
97
98 % custos hufnagel, stem down, on staff line
99 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d1", "hufnageld1",
100                 dir_down, on_staff_line);
101
102 % custos hufnagel, stem down, anywhere
103 custos_hufnagel("Reverse Custos Hufnagel", "hufnagel-d2", "hufnageld2",
104                 dir_down, anywhere);
105
106 %%%%%%%%
107 %
108 %
109 % Medicaea style
110 %
111 %
112
113 def custos_medicaea(expr verbose_name, internal_name, ly_name,
114                     direction, staffline_adjustment) =
115
116         fet_beginchar(verbose_name, internal_name, ly_name)
117
118                 save b_h, a_w;
119                 a_b := 1.54; % b_h * a_b / a_w = wd / ht
120                 b_h := 0.85;
121                 a_w := 1.09;
122
123                 save a, beta, ht, wd;
124                 ht# = noteheight#; %%  * mag;
125                 2beta# = ht# * b_h;
126                 a# = beta# * a_b;
127                 wd# = 0.4a# / a_w;      % width intentionally too small
128                 black_notehead_width# := wd#;
129
130                 define_pixels(ht, wd);
131
132                 save stem_size;
133                 if staffline_adjustment = between_staff_lines:
134                         stem_size = 0.90;
135                 elseif staffline_adjustment = on_staff_line:
136                         stem_size = 1.40;
137                 else: % staffline_adjustment = anywhere
138                         stem_size = 1.15;
139                 fi;
140
141                 pickup pencircle xscaled blot_diameter yscaled 1.0ht;
142                 z1 = (0.0wd, 0.0ht);
143                 z2 = z1 + (1.0wd - blot_diameter/2, 0);
144                 draw z1 .. z2;
145
146                 pickup pencircle scaled stafflinethickness;
147                 z3 = (1.0wd - stafflinethickness/2, 0.0ht);
148                 z4 = z3 + (0, +direction*stem_size*ht);
149                 draw z3 .. z4;
150
151                 set_char_box(0, wd#, ht# / 2, ht# / 2);
152
153         fet_endchar;
154 enddef;
155
156 % custos medicaea, stem up, between staff lines
157 custos_medicaea("Custos Med.", "medicaea-u0", "medicaeau0",
158                 dir_up, between_staff_lines);
159
160 % custos medicaea, stem up, on staff line
161 custos_medicaea("Custos Med.", "medicaea-u1", "medicaeau1",
162                 dir_up, on_staff_line);
163
164 % custos medicaea, stem up, anywhere
165 custos_medicaea("Custos Med.", "medicaea-u2", "medicaeau2",
166                 dir_up, anywhere);
167
168 % custos medicaea, stem down, between staff lines
169 custos_medicaea("Reverse Custos Med.", "medicaea-d0", "medicaead0",
170                 dir_down, between_staff_lines);
171
172 % custos medicaea, stem down, on staff line
173 custos_medicaea("Reverse Custos Med.", "medicaea-d1", "medicaead1",
174                 dir_down, on_staff_line);
175
176 % custos medicaea, stem down, anywhere
177 custos_medicaea("Reverse Custos Med.", "medicaea-d2", "medicaead2",
178                 dir_down, anywhere);
179
180 %%%%%%%%
181 %
182 %
183 % Editio Vaticana style
184 %
185 %
186
187 def custos_vaticana(expr verbose_name, internal_name, ly_name,
188                     direction, staffline_adjustment) =
189
190         fet_beginchar(verbose_name, internal_name, ly_name)
191
192                 save b_h, a_w;
193                 a_b := 1.54; % b_h * a_b / a_w = wd / ht
194                 b_h := 0.85;
195                 a_w := 1.09;
196
197                 save a, beta, ht, wd;
198                 ht# = noteheight# ; %%  * mag;
199                 2beta# = ht# * b_h;
200                 a# = beta# * a_b;
201                 wd# = 0.4a# / a_w;
202                 black_notehead_width# := wd#;
203
204                 save offs, stem_size, stem_end, penwidth;
205                 if staffline_adjustment = between_staff_lines:
206                         stem_size# = 1.00;
207                 elseif staffline_adjustment = on_staff_line:
208                         stem_size# = 1.50;
209                 else: % staffline_adjustment = anywhere
210                         stem_size# = 0.85;
211                 fi;
212                 offs# = direction*0.05ht#;
213                 stem_end# = direction*stem_size#*staff_space#;
214
215                 define_pixels(offs, stem_end, ht, wd);
216
217                 pickup pencircle scaled 0.6stafflinethickness;
218                 z1 = (0, offs);
219                 z2 = (0.7wd, -offs);
220                 z3 = (wd, -offs);
221                 penpos1(0.6ht, 90);
222                 penpos2(0.6ht, 90);
223                 penpos3(0.6ht, 90);
224                 penstroke z1e{z2 - z1} .. {right}z2e .. z3e;
225
226                 rt x4 = wd;
227                 bot y4 = 0;
228                 x5 = x4;
229                 top y5 = stem_end;
230                 draw z4 -- z5;
231
232                 if direction > 0:
233                         set_char_box(0, wd#, offs#+0.3ht#, stem_end#);
234                 else:
235                         set_char_box(0, wd#, -stem_end#, offs#+0.3ht#);
236                 fi;
237
238         fet_endchar;
239 enddef;
240
241 % custos vaticana, stem up, between staff lines
242 custos_vaticana("Custos Ed. Vat.", "vaticana-u0", "vaticanau0",
243                 dir_up, between_staff_lines);
244
245 % custos vaticana, stem up, on staff line
246 custos_vaticana("Custos Ed. Vat.", "vaticana-u1", "vaticanau1",
247                 dir_up, on_staff_line);
248
249 % custos vaticana, stem up, anywhere
250 custos_vaticana("Custos Ed. Vat.", "vaticana-u2", "vaticanau2",
251                 dir_up, anywhere);
252
253 % custos vaticana, stem down, between staff lines
254 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d0", "vaticanad0",
255                 dir_down, between_staff_lines);
256
257 % custos vaticana, stem down, on_staff_line
258 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d1", "vaticanad1",
259                 dir_down, on_staff_line);
260
261 % custos vaticana, stem down, anywhere
262 custos_vaticana("Reverse Custos Ed. Vat.", "vaticana-d2", "vaticanad2",
263                 dir_down, anywhere);
264
265 %%%%%%%%
266 %
267 %
268 % Mensural style
269 %
270 %
271
272 def custos_mensural(expr verbose_name, internal_name, ly_name,
273                     direction, staffline_adjustment) =
274
275         fet_beginchar(verbose_name, internal_name, ly_name)
276
277                 save b_h,a_w;
278                 a_b:=1.54; % b_h * a_b / a_w = wd / ht
279                 b_h:=0.85;
280                 a_w:=1.09;
281
282                 save a, beta, ht, wd;
283                 ht# = noteheight#;
284                 2beta# = ht# * b_h;
285                 a# = beta# * a_b;
286                 wd# = 2a# / a_w;        % width intentionally too small
287                 set_char_box(0, wd#, ht# / 2, ht# / 2);
288                 black_notehead_width# := wd#;
289
290                 save stem_size;
291                 if staffline_adjustment = between_staff_lines:
292                         stem_size = 0.85;
293                 elseif staffline_adjustment = on_staff_line:
294                         stem_size = 1.35;
295                 else: % staffline_adjustment = anywhere
296                         stem_size = 1.10;
297                 fi;
298
299                 define_pixels(ht, wd);
300                 pickup pencircle
301                   xscaled stafflinethickness
302                   yscaled 0.4ht
303                   rotated (-35*direction);
304                 z1=(0.0wd,-direction*0.2ht);
305                 z2=(0.2wd,+direction*0.2ht);
306                 z3=(0.4wd,-direction*0.2ht);
307                 z4=(0.6wd,+direction*0.2ht);
308                 z5=(0.8wd,-direction*0.2ht);
309                 z6-z5=(stem_size*0.5wd,+direction*stem_size*ht);
310                 draw z1 -- z2 -- z3 -- z4 -- z5 -- z6;
311
312         fet_endchar;
313 enddef;
314
315 % custos mensural, stem up, between staff lines
316 custos_mensural("Custos Mensural", "mensural-u0", "mensuralu0",
317                 dir_up, between_staff_lines);
318
319 % custos mensural, stem up, on staff line
320 custos_mensural("Custos Mensural", "mensural-u1", "mensuralu1",
321                 dir_up, on_staff_line);
322
323 % custos mensural, stem up, anywhere
324 custos_mensural("Custos Mensural", "mensural-u2", "mensuralu2",
325                 dir_up, anywhere);
326
327 % custos mensural, stem down, between staff lines
328 custos_mensural("Reverse Custos Mensural", "mensural-d0", "mensurald0",
329                 dir_down, between_staff_lines);
330
331 % custos mensural, stem down, on staff line
332 custos_mensural("Reverse Custos Mensural", "mensural-d1", "mensurald1",
333                 dir_down, on_staff_line);
334
335 % custos mensural, stem down, anywhere
336 custos_mensural("Reverse Custos Mensural", "mensural-d2", "mensurald2",
337                 dir_down, anywhere);
338
339 fet_endgroup ("custodes")