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