]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-heads.mf
* input/regression/breathing-sign.ly: tiny fixes
[lilypond.git] / mf / parmesan-heads.mf
1 % -*-Fundamental-*-
2 % parmesan-heads.mf -- implement ancient note heads
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c)  2001--2003 Juergen Reuter <reuter@ipd.uka.de>
7
8 % Neo-mensural heads originally by
9 % Christian Mondrup and Mats Bengtsson
10
11
12 save black_notehead_width;
13 numeric black_notehead_width;
14
15 fet_begingroup ("noteheads")
16
17 noteheight#:=staff_space# + (1 + overdone_heads)*stafflinethickness#;
18 define_pixels(noteheight);
19
20
21 %%%%%%%%
22 %
23 %
24 %
25 % MENSURAL NOTATION
26 %
27 %
28 %
29 brevis_wid# := 2 staff_space#;
30
31 def draw_neo_brevis(expr brevwid) =
32         save beamheight, head_width;
33         save holeheight, stem_width;
34         save serif_size, serif_protrude;
35
36         head_width# = brevwid;
37         holeheight = 3 stafflinethickness;
38         stem_width = 1.4 stafflinethickness;
39
40
41         define_pixels(head_width);
42         set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
43         
44         2 beamheight + holeheight = noteheight;
45         serif_size = (holeheight - stafflinethickness)/2;
46         serif_protrude = 1.5 serif_size;
47         penpos1(stem_width, 0);
48         penpos2(stem_width, 0);
49         penpos3(beamheight, 90);
50         penpos4(beamheight, 90);
51         penpos5(stem_width, 180);
52
53         z1l = (0, 0);
54         z2l = (0, -stafflinethickness/2);
55         z3r = z2r + serif_size *(1,-1);
56         y4r = y3r;
57         x4r = head_width/2;
58         z5l = z3l + (-serif_size, -serif_protrude);
59
60         penlabels(1,2,3,4, 5);
61         fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
62                 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
63
64         addto currentpicture also currentpicture yscaled -1;
65         show z4r; show z4l;
66         addto currentpicture also currentpicture 
67                 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
68
69 enddef;
70
71
72 def draw_neo_left_stemmed_head (expr wid) =
73         draw_neo_brevis(wid);
74
75         x6 = x7 = head_width - stem_width/2;
76         y6 = y5;
77         y7 = y5 - 2.25staff_space;
78         pickup pencircle scaled stem_width;
79         draw z6 .. z7;
80 enddef;
81
82 fet_beginchar("Left stemmed notehead", "lneo_mensural", "mensuralleftstemmedhead");
83         draw_neo_left_stemmed_head (brevis_wid#)
84 fet_endchar;
85
86 %
87 % Some sources (eg Musix/OpusTeX think that the appendage should be on
88 % the left, some say right. Right wins democratically.
89 %
90 def draw_neo_longa (expr wid) =
91         draw_neo_brevis(wid);
92         save theta;
93
94         x7r = head_width;
95         y7 = y5;
96 %       z7 = z5;
97         z6 - z7 = (stem_width/2, -staff_space);
98         theta = angle(z6-z7)+ 90;
99         penpos7(stem_width, theta);
100         penpos6(1.2 stem_width, theta);
101         
102         fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
103         penlabels(6,7);
104 enddef;
105
106 %
107 % En wij presenteren U: de opvolgster van Emily
108 %
109 % (ze is wel breed)
110
111 fet_beginchar("Maxima notehead", "-3neo_mensural", "mensuralmaximahead");
112         draw_neo_longa (1.3 brevis_wid#)
113 fet_endchar;
114
115 fet_beginchar("Longa notehead", "-2neo_mensural", "mensurallongahead");
116         draw_neo_longa (brevis_wid#)
117 fet_endchar;
118
119 fet_beginchar("Brevis notehead", "-1neo_mensural", "mensuralbrevishead")
120         draw_neo_brevis(brevis_wid#);
121 fet_endchar;
122
123 def draw_neo_mensural_black_head (expr wid) =
124         save head_width;
125         head_width# = wid;
126         set_char_box (0, head_width#, noteheight#/2, noteheight#/2);
127
128
129         y3 = y1 =0;
130         x2 = x4 = (x1 + x3) /2;
131         define_pixels (head_width);
132         pickup pencircle scaled blot_diameter;
133         top y2 = h;
134         bot y4 = -d;
135         lft x1 = 0;
136         rt x3 = w;
137
138         filldraw z1 -- z2 -- z3 -- z4 -- cycle;
139 enddef;
140
141 def draw_neo_mensural_open_head (expr wid)=
142         draw_neo_mensural_black_head (wid);
143         save diamNW, diamSW;
144         diamNW = length (z2 - z1) + blot_diameter;
145         diamSW = length (z4 - z1) + blot_diameter;
146         
147         save hole_widthNW, hole_widthSW;
148         hole_widthNW = 0.34 diamNW ;
149         hole_widthSW + 2.6 stafflinethickness = diamSW;
150
151         (z7 + z5)/2 = (w/2, 0);
152         (z8 + z6)/2 = (w/2, 0);
153         (z6 - z5) = hole_widthNW * unitvector (z2 - z1);
154         (z7 - z6) = hole_widthSW * unitvector (z4 - z1);
155
156         labels (1,2,3,4,5,6,7,8);
157
158         unfill z5 -- z6 -- z7 -- z8 --cycle;
159 enddef;
160
161 fet_beginchar("Neo-mensural open head","0neo_mensural","neomensuralsemibrevishead")
162       draw_neo_mensural_open_head (staff_space#);
163 fet_endchar;
164
165 fet_beginchar("Neo-mensural open head","1neo_mensural","neomensuralminimahead")
166       draw_neo_mensural_open_head (staff_space#);
167 fet_endchar;
168
169 fet_beginchar("Neo-mensural black head","2neo_mensural","neomensuralsemiminimahead")
170       draw_neo_mensural_black_head (staff_space#);
171 fet_endchar;
172
173
174 brevis_wid# := 1 staff_space#;
175
176 def draw_brevis (expr wid) =
177         % TODO.  For the moment, fall back to draw_neo_brevis.
178         draw_neo_brevis(wid);
179 enddef;
180
181 def draw_left_stemmed_head (expr wid) =
182         draw_brevis(wid);
183         save theta;
184
185         x6 = x7 = stem_width/2;
186         y6 = y5;
187         y7 = y5 - 2.25staff_space;
188         pickup pencircle scaled stem_width;
189         draw z6 .. z7;
190 enddef;
191
192 fet_beginchar("Left stemmed notehead", "lmensural", "mensuralleftstemmedhead");
193         draw_left_stemmed_head (brevis_wid#)
194 fet_endchar;
195
196 def draw_longa (expr wid) =
197         draw_brevis(wid);
198
199         x6 = x7 = head_width - stem_width/2;
200         y6 = y5;
201         y7 = y5 - 2.25staff_space;
202         pickup pencircle scaled stem_width;
203         draw z6 .. z7;
204 enddef;
205
206 fet_beginchar("Maxima notehead", "-3mensural", "mensuralmaximahead");
207         draw_longa (2.0 brevis_wid#)
208 fet_endchar;
209
210 fet_beginchar("Longa notehead", "-2mensural", "mensurallongahead");
211         draw_longa (brevis_wid#)
212 fet_endchar;
213
214 fet_beginchar("Brevis notehead", "-1mensural", "mensuralbrevishead")
215         draw_brevis(brevis_wid#);
216 fet_endchar;
217
218 def draw_diamond_head (expr head_h, pen_w, pen_h, angle, open) =
219       save head_width, head_height;
220       head_height# = head_h;
221       head_width# / head_height# = tand(angle);
222       define_pixels(head_width, head_height);
223
224       set_char_box (0, head_width#,
225                     head_height#/2, head_height#/2);
226
227       pickup pencircle
228              xscaled (min(blot_diameter, pen_w * head_width))
229              yscaled (min(blot_diameter, pen_h * head_width))
230              rotated -angle;
231
232       %% FIXME: replace "xpart (top z2)" (and, analogously,
233       %% "ypart (rt z3)") with an expression that really delivers the
234       %% x coordinate of the uppermost pixel that is drawn with respect
235       %% to the pencircle (this requires some elliptical computations).
236       %% MF obviously interprets "xpart (top z2)" as "top (xpart z2)",
237       %% i.e. "top x2", which is not what we want.
238
239       xpart (top z2) = ypart (rt z3) = 0;
240       top y2 = head_height/2;
241       rt x3 = head_width/2;
242       z2 = - z4;
243       z3 = - z1;
244
245       if open:
246               draw z1 -- z2 -- z3 -- z4 -- cycle;
247       else:
248               filldraw z1 -- z2 -- z3 -- z4 -- cycle;
249       fi;
250
251       currentpicture := currentpicture shifted (head_width/2, 0);
252
253 enddef;
254
255
256 fet_beginchar("Mensural open head","0mensural","mensuralsemibrevishead")
257         draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
258 fet_endchar;
259
260 fet_beginchar("Mensural open head","1mensural","mensuralminimahead")
261         draw_diamond_head (staff_space#, 0.15, 0.30, 30, true);
262 fet_endchar;
263
264 fet_beginchar("Mensural black head","2mensural","mensuralsemiminimahead")
265         draw_diamond_head (staff_space#, 0.15, 0.30, 30, false);
266 fet_endchar;
267
268
269 %%%%%%%%
270 %
271 %
272 %
273 % EDITIO VATICANA (including solesmes extensions)
274 %
275 %
276 %
277
278 % parameterized punctum
279 def punctum_char (expr verbose_name, internal_name, ly_name,
280                   left_stem, right_stem, linea, cavum,
281                   straight, auctum, direction_up, excentric, up_shift, down_shift, mag) =
282
283         fet_beginchar(verbose_name, internal_name, ly_name)
284                 save b_h, a_w;
285                 a_b := 1.54; % b_h*a_b/a_w = wd/ht
286                 b_h := 0.85;
287                 a_w := 1.09;
288
289                 save a, beta, ht, wd;
290                 ht# = noteheight# * mag;
291                 2beta# = ht# * b_h;
292                 a# = beta# * a_b;
293                 wd# = 2a# / a_w;
294                 black_notehead_width# := wd#;
295
296                 % direction
297                 save direction, direction_sign;
298                 pair direction;
299                 if direction_up:
300                         direction = up;
301                         direction_sign# = 1;
302                 else:
303                         direction = down;
304                         direction_sign# = -1;
305                 fi;
306
307                 % convexity and excentricity
308                 save u_convexity, u_excentricity;
309                 if straight:
310                         u_convexity# = -0.01ht#;
311                         u_excentricity# = 0.0ht#; % dummy
312                 elseif auctum:
313                         u_convexity# = -0.03ht#;
314                         u_excentricity# = +0.25ht#;
315                 else:
316                         u_convexity# = -0.05ht#;
317                         u_excentricity# = 0.0ht#; % dummy
318                 fi;
319                 save convexity, excentricity;
320                 convexity# = direction_sign# * u_convexity#;
321                 excentricity# = direction_sign# * u_excentricity#;
322
323                 % y shift offset
324                 save yoffs;
325                 if up_shift:
326                         yoffs# = 0.08ht#;
327                 elseif down_shift:
328                         yoffs# = -0.11ht#;
329                 else:
330                         yoffs# = 0.00ht#;
331                 fi
332
333                 define_pixels(convexity, excentricity, yoffs, ht, wd);
334                 pickup pencircle scaled stafflinethickness;
335
336                 path p;
337                 save height, yoffs_bt;
338                 define_pixels (height, yoffs_bt);
339                 height# = 0.47ht#;
340                 yoffs_bt# = yoffs# - 0.5*height# - 0.25*convexity#;
341                 xpart z1a = xpart z1b;
342                 xpart z2a = xpart z2b;
343                 xpart z3a = xpart z3b;
344                 ypart z1a + height = ypart z1b;
345                 ypart z2a + height = ypart z2b;
346                 ypart z3a + height = ypart z3b;
347
348                 save box_top, box_bt;
349
350                 if auctum:
351                         z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
352                         z2a = (0.21wd, yoffs_bt + 1.0*convexity);
353                         z3a = (0.42wd - stafflinethickness/2,
354                                yoffs_bt + 1.0*excentricity);
355                         box_top# = height# + yoffs_bt# +
356                                 max(0, 1.0*convexity#, 1.0*excentricity#);
357                         box_bt# = yoffs_bt# +
358                                 min(0, 1.0*convexity#, 1.0*excentricity#);
359                         p = z1a .. {right}z2a .. {direction}z3a --
360                             z3b{-direction} .. z2b{left} .. z1b -- cycle;
361                 elseif excentric:
362                         z1a = (0.00wd + stafflinethickness/2,
363                                yoffs_bt - 1.0*convexity);
364                         z2a = (0.08wd, yoffs_bt + 1.4*convexity);
365                         z3a = (0.42wd - stafflinethickness/2,
366                                yoffs_bt - 1.0*convexity);
367                         box_top# = height# + yoffs_bt# +
368                                 max(-1.0*convexity#, 1.4*convexity#, 0);
369                         box_bt# = yoffs_bt# +
370                                 min(-1.0*convexity#, 1.4*convexity#, 0);
371                         p = z1a{direction} .. z2a{right} .. z3a --
372                             z3b .. {left}z2b .. {-direction}z1b -- cycle;
373                 else:
374                         z1a = (0.00wd + stafflinethickness/2, yoffs_bt);
375                         z2a = (0.21wd, yoffs_bt + 1.0*convexity);
376                         z3a = (0.42wd - stafflinethickness/2, yoffs_bt);
377                         box_top# = height# + yoffs_bt# +
378                                 max(0, 1.0*convexity#);
379                         box_bt# = yoffs_bt# +
380                                 min(0, 1.0*convexity#);
381                         p = z1a .. z2a .. z3a --
382                             z3b .. z2b .. z1b -- cycle;
383                 fi;
384
385                 if cavum:
386                         draw p;
387                 else:
388                         filldraw p;
389                 fi;
390
391                 pickup pencircle scaled 0.6stafflinethickness;
392
393                 save stem_bt;
394
395                 if left_stem:
396                         z5=(0.00wd + 0.6stafflinethickness/2, yoffs);
397                         z6=(0.00wd + 0.6stafflinethickness/2, yoffs - 1.1ht);
398                         draw z5 -- z6;
399                         stem_bt# = yoffs# - 1.1ht#;
400                 elseif right_stem:
401                         z5=(0.42wd - 0.6stafflinethickness/2, yoffs);
402                         z6=(0.42wd - 0.6stafflinethickness/2, yoffs - 1.5ht);
403                         draw z5 -- z6;
404                         stem_bt# = yoffs# - 1.5ht#;
405                 else:
406                         stem_bt# = 0;
407                 fi;
408
409                 set_char_box(0.00wd#, 0.42wd#,
410                              max(0, -box_bt#, -stem_bt#) + stafflinethickness#/2,
411                              max(0, box_top#) + stafflinethickness#/2);
412
413                 if linea:
414                         save linea_width, linea_height;
415                         linea_width# = 0.6 stafflinethickness#;
416                         linea_height# = 0.7 ht#;
417                         define_pixels (linea_width, linea_height);
418                         draw_block ((-0.10wd - linea_width/2,
419                                      -linea_height/2),
420                                     (-0.10wd + linea_width/2,
421                                      +linea_height/2));
422                         draw_block ((+0.52wd - linea_width/2,
423                                      -linea_height/2),
424                                     (+0.52wd + linea_width/2,
425                                      +linea_height/2));
426                         set_char_box(0,
427                                      0.62wd# + linea_width#,
428                                      linea_height#/2,
429                                      linea_height#/2);
430                         currentpicture := currentpicture
431                                 shifted (0.10wd + linea_width/2, 0);
432                 fi;
433         fet_endchar;
434 enddef;
435
436 % parameterized punctum inclinatum
437 def inclinatum_char(expr verbose_name, internal_name, ly_name,
438                     small, stropha, auctum) =
439
440         fet_beginchar(verbose_name, internal_name, ly_name)
441                 save ht, alpha;
442                 alpha# = 35;
443                 if small:
444                         ht# = 0.50 noteheight#;
445                 else:
446                         ht# = 0.80 noteheight#;
447                 fi;
448
449                 draw_diamond_head (ht#, 0, 0, alpha#, false);
450
451                 if stropha:
452                         pickup pencircle
453                                 xscaled (0.25*head_height)
454                                 yscaled (0.55*head_height)
455                                 rotated alpha#;
456                         save za, off_angle; pair za;
457                         off_angle := 15;
458                         za = (0, -0.25*head_height)
459                                 rotated -(alpha# + off_angle)
460                                 shifted (0.48 head_width, -0.02 head_width);
461                         undraw za;
462                 fi;
463
464                 if auctum:
465                         pickup pencircle scaled stafflinethickness;
466                         save za, zb, zc;
467                         pair za, zb, zc;
468                         za = (0, -0.5 head_height + stafflinethickness);
469                         zb = 0.6 (za + zc);
470                         zc = za + (0.52 head_width, 0);
471                         draw za{(0,-1) rotated alpha#} .. {right}zb{right} ..
472                              {(0,1) rotated -alpha#}zc;
473                 fi;
474         fet_endchar;
475 enddef;
476
477 % punctum
478 punctum_char("Ed. Vat. punctum", "vaticana_punctum", "vatpunctumhead",
479              false, false, false, false, false,
480              false, false, false, false, false, 1.0);
481
482 % punctum cavum (for OpusTeX compatibility)
483 punctum_char("Ed. Vat. punctum cavum", "vaticana_punctum_cavum",
484              "vatpunctumcavumhead",
485              false, false, false, true, false,
486              false, false, false, false, false, 1.0);
487
488 % linea punctum (for OpusTeX compatibility)
489 punctum_char("Ed. Vat. linea punctum", "vaticana_linea_punctum",
490              "vatlineapunctumhead",
491              false, false, true, false, false,
492              false, false, false, false, false, 1.0);
493
494 % linea punctum cavum (for OpusTeX compatibility)
495 punctum_char("Ed. Vat. linea punctum cavum", "vaticana_linea_punctum_cavum",
496              "vatlineapunctumcavumhead",
497              false, false, true, true, false,
498              false, false, false, false, false, 1.0);
499
500 % punctum inclinatum
501 inclinatum_char("Ed. Vat. inclinatum", "vaticana_inclinatum",
502                 "vatinclinatumhead",
503                 false, false, false);
504
505 % pes lower punctum
506 punctum_char("Ed. Vat. pes lower punctum", "vaticana_lpes", "vatlpeshead",
507              false, false, false, false, true,
508              false, true, false, false, false, 1.0);
509
510 % pes lower punctum
511 punctum_char("Ed. Vat. pes var lower punctum", "vaticana_vlpes", "vatvlpeshead",
512              false, false, false, false, true,
513              false, true, false, false, true, 1.0);
514
515 % pes upper punctum
516 punctum_char("Ed. Vat. pes upper punctum", "vaticana_upes", "vatupeshead",
517              false, false, false, false, true,
518              false, false, false, false, false, 1.0);
519
520 % pes upper punctum (shifted variation)
521 %
522 % This note head is used instead of the regular pes upper punctum to
523 % avoid collision with the lower punctum note of the pes when the upper
524 % punctum sits directly on top of the lower punctum.
525 %
526 punctum_char("Ed. Vat. var pes upper punctum", "vaticana_vupes",
527              "vatvupeshead",
528              false, false, false, false, true,
529              false, false, false, true, false, 1.0);
530
531 % small punctum as used in epiphonus
532 punctum_char("Ed. Vat. plica", "vaticana_plica", "vatplicahead",
533              false, false, false, false, false,
534              false, false, false, false, false, 0.6);
535
536 % excentric punctum as used in epiphonus
537 punctum_char("Ed. Vat. epiphonus", "vaticana_epiphonus", "vatepiphonushead",
538              false, false, false, false, false,
539              false, true, true, false, false, 1.0);
540
541 % excentric punctum as used in epiphonus (shifted variation)
542 %
543 % This note head is used instead of the regular epiphonus punctum to
544 % avoid collision with the plica head when the plica sits directly on
545 % top of the lower head.
546 %
547 punctum_char("Ed. Vat. var epiphonus", "vaticana_vepiphonus", "vatvepiphonushead",
548              false, false, false, false, false,
549              false, true, true, false, true, 1.0);
550
551 % small punctum as used in cephalicus
552 punctum_char("Ed. Vat. rev. plica", "vaticana_reverse_plica", "vatrplicahead",
553              false, false, false, false, false,
554              false, true, false, false, false, 0.6);
555
556 % excentric punctum as used in cephalicus; without left stem
557 punctum_char("Ed. Vat. cephalicus", "vaticana_inner_cephalicus",
558              "vatinnercephalicushead",
559              false, false, false, false, false,
560              false, false, true, false, false, 1.0);
561
562 % excentric punctum as used in cephalicus; with left stem
563 punctum_char("Ed. Vat. cephalicus", "vaticana_cephalicus",
564              "vatcephalicushead",
565              true, false, false, false, false,
566              false, false, true, false, false, 1.0);
567
568 % quilisma
569 fet_beginchar("Ed. Vat. quilisma", "vaticana_quilisma", "vatquilismahead")
570         save b_h,a_w;
571         a_b:=1.54; % b_h*a_b/a_w = wd/ht
572         b_h:=0.85;
573         a_w:=1.09;
574
575         save a, beta, ht, wd;
576         ht# = noteheight#;
577         2beta# = ht#*b_h;
578         a# = beta#*a_b;
579         wd# = 2a# / a_w;
580         set_char_box(0, 0.42wd#, 0.28 ht#, 0.36 ht#);
581         black_notehead_width# := wd#;
582
583         define_pixels(ht, wd);
584         pickup pencircle xscaled stafflinethickness yscaled 0.44ht;
585         lft x1 = 0.00wd; bot y1 = -0.28ht;
586         x2 = 0.11wd;     y2 = -0.14ht;
587         x3 = 0.12wd;     y3 = +0.03ht;
588         x4 = 0.25wd;     y4 = -0.09ht;
589         x5 = 0.26wd;     y5 = +0.08ht;
590         x6 = 0.40wd;     y6 = -0.04ht;
591         rt x7 = 0.42wd;  top y7 = +0.36ht;
592         draw z1 .. z2 -- z3 .. z4 -- z5 .. z6 -- z7;
593 fet_endchar;
594
595 % solesmes punctum inclinatum parvum
596 inclinatum_char("Solesmes punctum inclinatum parvum", "solesmes_incl_parvum",
597                 "solinclparvumhead",
598                 true, false, false);
599
600 % solesmes punctum auctum ascendens
601 punctum_char("Solesmes punctum auctum ascendens", "solesmes_auct_asc",
602              "solauctaschead",
603              false, false, false, false, false,
604              true, true, false, false, false, 1.0);
605
606 % solesmes punctum auctum descendens
607 punctum_char("Solesmes punctum auctum descendens", "solesmes_auct_desc",
608              "solauctdeschead",
609              false, false, false, false, false,
610              true, false, false, false, false, 1.0);
611
612 % solesmes punctum inclinatum auctum
613 inclinatum_char("Solesmes punctum incl. auctum", "solesmes_incl_auctum",
614                 "solpunctuminclinatumauctumhead",
615                 false, false, true);
616
617 % solesmes stropha
618 inclinatum_char("Solesmes stropha", "solesmes_stropha",
619                 "solstrophahead",
620                 false, true, false);
621
622 % solesmes stropha aucta
623 inclinatum_char("Solesmes stropha aucta", "solesmes_stropha_aucta",
624                 "solstrophaauctahead",
625                 false, true, true);
626
627 % solesmes oriscus
628 fet_beginchar("Solesmes oriscus", "solesmes_oriscus",
629         "soloriscushead")
630         save b_h, a_w;
631         a_b := 1.54; % b_h*a_b/a_w = wd/ht
632         b_h := 0.85;
633         a_w := 1.09;
634
635         save a, beta, ht, wd;
636         ht# = noteheight#;
637         2beta# = ht# * b_h;
638         a# = beta# * a_b;
639         wd# = 2a# / a_w;
640         black_notehead_width# := wd#;
641
642         save convexity;
643         convexity# = +0.05ht#;
644
645         define_pixels(ht, wd, convexity);
646         pickup pencircle xscaled blot_diameter yscaled 0.50ht;
647         lft x1 = 0.00wd; y1 = -convexity;
648         x2 = 0.16wd;     y2 = +convexity;
649         x3 = 0.33wd;     y3 = -convexity;
650         rt x4 = 0.50wd;  y4 = +convexity;
651         draw z1 .. z2 .. z3 .. z4;
652         set_char_box(0.00wd#, 0.50wd#,
653                      0.25ht# + convexity#, 0.25ht# + convexity#);
654 fet_endchar;
655
656 %%%%%%%%
657 %
658 %
659 %
660 % EDITIO MEDICAEA
661 %
662 %
663 %
664
665 % inclinatum
666 fet_beginchar("Ed. Med. inclinatum", "medicaea_inclinatum",
667         "medinclinatumhead")
668         draw_diamond_head (1.2staff_space#, 0, 0, 35, false);
669 fet_endchar;
670
671 % parametrized punctum
672 def punctum_char (expr verbose_name, internal_name, ly_name,
673         left_up_stem, left_down_stem) =
674
675         fet_beginchar(verbose_name, internal_name, ly_name)
676
677                 save a, beta, ht, wd;
678                 ht# = 2 staff_space#;
679                 wd# = ht#;
680                 black_notehead_width# := wd#;
681
682                 define_pixels(ht, wd);
683                 pickup pencircle
684                         xscaled blot_diameter
685                         yscaled 0.50ht;
686                 z1 = (0.00wd + blot_diameter/2, 0);
687                 z2 = (0.4wd - blot_diameter/2, 0);
688                 draw z1 .. z2;
689
690                 pickup pencircle
691                         xscaled stafflinethickness
692                         yscaled blot_diameter;
693
694                 if left_down_stem:
695                         z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
696                         z5=(0.00wd + stafflinethickness/2, - 1.25ht);
697                         draw z4 .. z5;
698                         set_char_box(0.0, 0.4wd#, 1.25ht#, 0.25ht#);
699                 elseif left_up_stem:
700                         z4=(0.00wd + stafflinethickness/2, blot_diameter/2);
701                         z5=(0.00wd + stafflinethickness/2, + 1.25ht);
702                         draw z4 .. z5;
703                         set_char_box(0.0, 0.4wd#, 0.25ht#, 1.25ht#);
704                 else:
705                         set_char_box(0.0, 0.4wd#, 0.25ht#, 0.25ht#);
706                 fi;
707
708         fet_endchar;
709 enddef;
710
711 % punctum
712 punctum_char("Ed. Med. punctum", "medicaea_punctum", "medpunctumhead",
713         false, false);
714
715 % left up-stemmed punctum
716 punctum_char("Ed. Med. reverse virga", "medicaea_rvirga", "medrvirgahead",
717         true, false);
718
719 % virga (i.e. left down-stemmed punctum)
720 punctum_char("Ed. Med. virga", "medicaea_virga", "medvirgahead",
721         false, true);
722
723 %%%%%%%%
724 %
725 %
726 %
727 % HUFNAGEL
728 %
729 %
730 %
731
732 % punctum
733 % parametrized punctum
734 def punctum_char (expr verbose_name, internal_name, ly_name,
735         down_stem) =
736         fet_beginchar(verbose_name, internal_name, ly_name)
737                 save alpha;
738                 alpha# = 55;
739                 draw_diamond_head (staff_space#, 0, 0, alpha#, false);
740                 if down_stem:
741                         pickup pencircle
742                                 xscaled blot_diameter
743                                 yscaled (0.7*staff_space)
744                                 rotated -alpha#;
745                         save za, zb; pair za, zb;
746                         za = (head_width/2, 0);
747                         bot zb = (head_width/2, -1.5staff_space);
748                         draw za -- zb;
749                         set_char_box (0, head_width#,
750                                       1.5staff_space#, head_height#/2);
751                 fi;
752         fet_endchar;
753 enddef;
754
755 % punctum
756 punctum_char("Hufnagel punctum", "hufnagel_punctum", "hufpunctumhead", false)
757
758 % virga
759 punctum_char("Hufnagel virga", "hufnagel_virga", "hufvirgahead", true)
760
761 % pes lower punctum
762 fet_beginchar("Hufnagel pes lower punctum", "hufnagel_lpes", "huflpeshead")
763         save width, height, alpha;
764         width# = 2*staff_space#;
765         height# = 0.7*staff_space#;
766         alpha# = 35;
767
768         set_char_box(0, width#, height#/2, height#/2);
769
770         pickup pencircle scaled stafflinethickness;
771         define_pixels(width, height);
772
773         rt x3 = -lft x1 = width/2;
774         y2 = y3 = height/2;
775         y1 = y4 = -height/2;
776         tand(alpha#) * (y2 - y1) = x2 - x1 = x3 - x4;
777
778         filldraw z1 -- z2 -- z3 -- z4 -- cycle;
779
780         currentpicture := currentpicture shifted (width/2, 0);
781 fet_endchar;
782
783 fet_endgroup ("noteheads")