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