]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-bolletjes.mf
release: 1.5.6
[lilypond.git] / mf / feta-bolletjes.mf
1 %  -*-Fundamental-*-
2 % feta-bolletjes.mf --  implement noteheads
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 1997--2001 Jan Nieuwenhuizen <janneke@gnu.org>
7 % & Han-Wen Nienhuys <hanwen@cs.uu.nl>
8
9
10
11 % most beautiful noteheads are pronounced, not circular, 
12 % and not even symmetric.
13 % These examples are inspired by [Wanske], see literature list
14
15
16 save black_notehead_width;
17 numeric black_notehead_width;
18
19 fet_begingroup("noteheads");
20
21 noteheight#:=staff_space#+ (1 + overdone_heads) *stafflinethickness#;
22 define_pixels(noteheight);
23
24
25 %%%%%%%%
26 %
27 %
28 %
29 % MENSURAL NOTATION
30 %
31 %
32 %
33 brevis_wid# := 2 staff_space#;
34
35 def draw_brevis(expr brevwid) =
36         save beamheight, head_width;
37         save holeheight, stem_width;
38         save serif_size, serif_protrude;
39
40         head_width# = brevwid;
41         holeheight = 3 stafflinethickness;
42         stem_width = 1.4 stafflinethickness;
43
44
45         define_pixels(head_width);
46         set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
47         
48         2 beamheight + holeheight = noteheight;
49         serif_size = (holeheight - stafflinethickness)/2;
50         serif_protrude = 1.5 serif_size;
51         penpos1(stem_width, 0);
52         penpos2(stem_width, 0);
53         penpos3(beamheight, 90);
54         penpos4(beamheight, 90);
55         penpos5(stem_width, 180);
56
57         z1l = (0, 0);
58         z2l = (0, -stafflinethickness/2);
59         z3r = z2r + serif_size *(1,-1);
60         y4r = y3r;
61         x4r = head_width/2;
62         z5l = z3l + (-serif_size, -serif_protrude);
63
64         penlabels(1,2,3,4, 5);
65         fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
66                 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
67
68         addto currentpicture also currentpicture yscaled -1;
69         show z4r; show z4l;
70         addto currentpicture also currentpicture 
71                 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
72
73 enddef;
74
75
76 %
77 % Some sources (eg Musix/OpusTeX think that the appendage should be on
78 % the left, some say right. Right wins democratically.
79 %
80 def draw_longa (expr wid) =
81         draw_brevis(wid);
82         save theta;
83
84         x7r = head_width;
85         y7 = y5;
86 %       z7 = z5;
87         z6 - z7 = (stem_width/2, -staff_space);
88         theta = angle(z6-z7)+ 90;
89         penpos7(stem_width, theta);
90         penpos6(1.2 stem_width, theta);
91         
92         fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
93         penlabels(6,7);
94 enddef;
95
96 %
97 % En wij presenteren U: de opvolgster van Emily
98 %
99 % (ze is wel breed)
100
101 fet_beginchar("Maxima notehead", "-3mensural", "mensuralmaximahead");
102         draw_longa (1.3 brevis_wid#)
103 fet_endchar;
104
105 fet_beginchar("Longa notehead", "-2mensural", "mensurallongahead");
106         draw_longa (brevis_wid#)
107 fet_endchar;
108
109 fet_beginchar("Brevis notehead", "-1mensural", "mensuralbrevishead")
110         draw_brevis(brevis_wid#);
111 fet_endchar;
112
113 def draw_neo_mensural_black_head (expr wid) =
114         save head_width;
115         head_width# = wid;
116         set_char_box (0, head_width#, noteheight#/2, noteheight#/2);
117
118
119         y3 = y1 =0;
120         x2 = x4 = (x1 + x3) /2;
121         define_pixels (head_width);
122         pickup pencircle scaled blot_diameter;
123         top y2 = h;
124         bot y4 = -d;
125         lft x1 = 0;
126         rt x3 = w;
127
128         filldraw z1 -- z2 -- z3 -- z4 -- cycle;
129 enddef;
130
131 def draw_neo_mensural_open_head (expr wid)=
132         draw_neo_mensural_black_head (wid);
133         save diamNW, diamSW;
134         diamNW = length (z2 - z1) + blot_diameter;
135         diamSW = length (z4 - z1) + blot_diameter;
136         
137         save hole_widthNW, hole_widthSW;
138         hole_widthNW = 0.34 diamNW ;
139         hole_widthSW + 2.6 stafflinethickness = diamSW;
140
141         (z7 + z5)/2 = (w/2, 0);
142         (z8 + z6)/2 = (w/2, 0);
143         (z6 - z5) = hole_widthNW * unitvector (z2 - z1);
144         (z7 - z6) = hole_widthSW * unitvector (z4 - z1);
145
146         labels (1,2,3,4,5,6,7,8);
147
148         unfill z5 -- z6 -- z7 -- z8 --cycle;
149 enddef;
150
151 fet_beginchar("Neo-mensural open head","0neo_mensural","neomensuralminimhead")
152       draw_neo_mensural_open_head (staff_space#);
153 fet_endchar;
154
155 fet_beginchar("Neo-mensural open head","1neo_mensural","neomensuralsemiminimhead")
156       draw_neo_mensural_open_head (staff_space#);
157 fet_endchar;
158
159 fet_beginchar("Neo-mensural black head","2neo_mensural","neofusahead")
160       draw_neo_mensural_black_head (staff_space#);
161 fet_endchar;
162
163
164 def draw_mensural_head (expr wid, open) =
165       save head_width;
166       head_width# = wid;
167       set_char_box (0, head_width#,
168                     noteheight#/2, noteheight#/2);
169
170       define_pixels(head_width, noteheight);
171
172       x2 = head_width/2;
173       y2 = 1.1 noteheight/2;
174       y1 = 0;
175       (x2 - x1) / (y2 - y1) = tand(30);
176       z3 = (2x2 - x1, y1);
177       z4 = z3 + z1 - z2;
178
179       pickup pencircle
180              xscaled 0.18 head_width
181              yscaled 0.36 head_width
182              rotated -30;
183
184       if open:
185               draw z1 -- z2 -- z3 -- z4 -- cycle;
186       else:
187               filldraw z1 -- z2 -- z3 -- z4 -- cycle;
188       fi;
189 enddef;
190
191
192 fet_beginchar("Mensural open head","0mensural","mensuralminimhead")
193         draw_mensural_head (staff_space#, true);
194 fet_endchar;
195
196 fet_beginchar("Mensural open head","1mensural","mensuralsemiminimhead")
197         draw_mensural_head (staff_space#, true);
198 fet_endchar;
199
200 fet_beginchar("Mensural black head","2mensural","fusahead")
201         draw_mensural_head (staff_space#, false);
202 fet_endchar;
203
204
205 %%%%%%%%%%%%
206 %
207 %
208 % ledger (leger) lines
209 %
210 fet_beginchar("Ledger ending", "ledgerending", "ledgerending")
211 set_char_box (5/2 ledgerlinethickness#, 5/2 ledgerlinethickness#,
212                 ledgerlinethickness#/2,ledgerlinethickness#/2);
213         pickup pencircle scaled 1.3 blot_diameter;
214
215         rt x2 = w;
216         lft x1 = -b;
217         x3 = x2;
218         bot y1 = -d;
219         y2 = y1;
220
221         top y3 = h;
222         y4 = y3;
223         x4 = x1;
224
225         filldraw z1 --- z2 --- z3 --- z4 --- cycle ;
226 fet_endchar;
227
228
229
230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
231 %
232 %
233 %
234 %
235 %
236 % TODO: Document these!
237
238 % setup user vars
239 def setup_notehead_vars =
240         save a_b,err_y_a,tilt,superness;
241         save ai_a,ai_bi,err_y_ai,err_x_bi,inner_tilt,inner_superness;
242         save b_h,a_w;
243         enddef;
244
245 % setup addititional vars and calc them
246 def notehead_calc =
247         save a,beta,ai,bi, ht, wd;
248         ht# =noteheight#;
249         2beta#=ht#*b_h;
250         a# = beta#*a_b;
251         wd# = 2a# / a_w;
252         ai# = a# * ai_a;
253         bi# = ai#/ai_bi;
254         define_pixels(a,beta);
255         define_pixels(ai,bi);
256         set_char_box(0, wd#, .5 ht#, .5 ht#);
257         enddef;
258
259
260 % draw the outer and inner ellipse.
261 def notehead_draw =
262         path black,white;
263         black=distorted_ellipse(a,beta,a*err_y_a,0,superness);
264         white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,inner_superness);
265 if test>1: %fixme
266                 save x;
267                 x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
268                 penlabels(1,2,3,4);
269                 test_grid;
270 else:
271                 black:=black rotated tilt;
272                 black:=black shifted (w/2,0);
273                 white:=white rotated inner_tilt;
274                 white:=white shifted (w/2,0);
275 fi
276                 fill black;
277                 unfill white;
278
279                 
280         enddef;
281
282 def draw_whole_head =
283         setup_notehead_vars;
284         
285         a_b:=1.80;
286         err_y_a:=0; % no slant
287         tilt:=0;
288         superness:=0.707;
289         ai_a:=0.508;
290         % ai_bi:=1.23;
291         ai_bi:=1.30; % jcn
292         % err_y_ai:=0.0938;
293         % err_x_bi:=0;
294         err_y_ai:=0;
295         err_x_bi:=0.115;
296         % inner_tilt:=135;
297         inner_tilt:=125; % jcn
298         % inner_superness:=0.69;
299         inner_superness:=0.68; % jcn
300         b_h:=1; %no rotate-> no height correction
301         a_w:=1; % no rotate-> no width correction
302
303         notehead_calc;
304         whole_notehead_width# := wd#;
305         notehead_draw;
306 enddef;
307
308
309 %
310 % dimensions aren't entirely right.
311 %
312 fet_beginchar ("Brevis notehead", "-1", "brevishead");
313         save stemthick, fudge;
314         define_pixels (stemthick);
315         fudge = blot_diameter /2;
316         stemthick# = 2 stafflinethickness#;
317
318         draw_whole_head;
319
320         pickup pencircle scaled stemthick;
321
322         bot y1 = -d;
323         top y2 = h;
324         rt x1 - fudge = 0;
325         x1 = x2;
326
327         fudge + lft x3 = w;
328         x4 = x3;
329         y4 = y2;
330         y3 = y1;
331
332         draw z1 -- z2;
333         draw z3 -- z4;
334 fet_endchar;
335
336 % whole note
337 % Wanske, p.38
338 fet_beginchar("Whole notehead", "0", "wholehead")
339         draw_whole_head;
340 fet_endchar;
341
342
343
344 % half note
345 % Wanske, p.39
346 fet_beginchar("Half notehead", "1", 
347         "halfhead")
348         setup_notehead_vars;
349                 % a_b:=1.49; % after text
350         a_b:=1.50; % after drawing
351         err_y_a:=0.157;
352         tilt:=34;
353         % superness:=0.66;
354         superness:=0.67; % jcn
355         % ai_a:=0.863;
356         ai_a:=0.850; % jcn
357         % ai_bi:=3.14;
358         ai_bi:=3.30; % jcn
359         err_y_ai:=0;
360         err_x_bi:=-0.12;
361         inner_tilt:=tilt;
362         inner_superness:=0.80;
363         b_h:=0.935;
364         a_w:=1.12;
365
366         notehead_calc;
367         half_notehead_width# := wd#;
368         notehead_draw;
369 fet_endchar;
370
371
372
373 % quarter note
374 % Wanske p.38
375 fet_beginchar("Quart notehead", "2", "quarthead")
376         setup_notehead_vars;
377         % a_b:=1.57; % after text
378         a_b:=1.54; % after drawing
379         err_y_a:=0.044;
380         tilt:=32;
381         superness:=0.707;
382         ai_a:=0;
383         ai_bi:=1;
384         err_y_ai:=0;
385         err_x_bi:=0;
386         inner_tilt:=0;
387         inner_superness:=0.707;
388         b_h:=0.85;
389         a_w:=1.09;
390
391         notehead_calc;
392         black_notehead_width# := wd#;
393         notehead_draw;
394 fet_endchar;
395
396
397 % whole note
398 % Wanske, p.38
399 fet_beginchar("Whole diamondhead", "0diamond", "wholediamondhead")
400         setup_notehead_vars;
401         
402         a_b:=1.80;
403         err_y_a:=0; % no slant
404         tilt:=0;
405         superness:=0.495;
406         ai_a:=0.350;
407         % ai_bi:=1.23;
408         ai_bi:=1.30; % jcn
409         % err_y_ai:=0.0938;
410         % err_x_bi:=0;
411         err_y_ai:=0;
412         err_x_bi:=0.115;
413         % inner_tilt:=135;
414         inner_tilt:=125; % jcn
415         % inner_superness:=0.69;
416         inner_superness:=0.6; % jcn
417         b_h:=1; %no rotate-> no height correction
418         a_w:=1; % no rotate-> no width correction
419
420         notehead_calc;
421         whole_notehead_width# := wd#;
422         notehead_draw;
423 fet_endchar;
424
425
426 % half note
427 % Wanske, p.39
428 fet_beginchar("Half diamondhead", "1diamond", 
429         "halfdiamondhead")
430         setup_notehead_vars;
431
432         a_b := 1.50; % after drawing
433         err_y_a:=0.157;
434
435         tilt:=34;
436         superness:=0.49; % jcn
437         ai_a:=0.550; % jcn
438         ai_bi:=3.30; % jcn
439
440         err_y_ai:=0;
441         err_x_bi:=-0.12;
442         inner_tilt:=tilt;
443         inner_superness:=0.80;
444
445         b_h:= 1.03;
446         a_w:= 1.2;
447
448         notehead_calc;
449         half_notehead_width# := wd#;
450         notehead_draw;
451 fet_endchar;
452
453
454 % quarter note
455 % Wanske p.38
456 fet_beginchar("Quart diamondhead", "2diamond", "diamondhead")
457         set_char_box(0, black_notehead_width#, noteheight#/2, noteheight#/2);
458         save a_b,err_y_a,tilt,superness;
459         save b_h,a_w;
460         save a,beta,ai,bi, ht, wd;
461
462         a_b:= 1.8;
463         err_y_a:=-0.044;
464         b_h:=0.90;
465         a_w:=1.1;
466         tilt:=35;
467         superness:=0.495;
468
469         ht# =noteheight#;
470         2beta#=ht#*b_h;
471         a# = beta#*a_b;
472
473         define_pixels(a,beta);
474
475         black := distorted_ellipse(.72 noteheight, .45 noteheight, -.2 noteheight ,   0, superness)
476                                 
477 %                       beta,a*err_y_a,0,superness);
478
479         black:=black rotated tilt;
480         black:=black shifted (w/2,0);
481         fill black;
482 fet_endchar;
483
484 save triangle; path triangle;
485 triangle = (-sqrt3/4,-1/2) -- (0,1) -- (sqrt3/4,-1/2) -- cycle;
486
487 fet_beginchar("Whole trianglehead", "0triangle", "wholetrianglehead")
488         set_char_box(0, 2(noteheight#+stafflinethickness#)/sqrt3*7/8,
489           (noteheight#+stafflinethickness#)/2,(noteheight#+stafflinethickness#)/2);
490         fill triangle scaled (7h/6) shifted (w/2,-h/6);
491         unfill triangle scaled 0.72h shifted (w/2,-h/6);
492 fet_endchar;
493 fet_beginchar("Half trianglehead", "1triangle", "halftrianglehead")
494         thick := 1.2stafflinethickness;
495         set_char_box(0, 2noteheight#/sqrt3*7/8,noteheight#/2,noteheight#/2);
496         fill triangle scaled (7h/6) shifted (w/2,-h/6);
497         unfill triangle scaled 0.7h shifted (w/2,-h/6);
498 fet_endchar;
499 fet_beginchar("Quart trianglehead", "2triangle", "trianglehead")
500         thick := 1.2stafflinethickness;
501         set_char_box(0, 2noteheight#/sqrt3*7/8,noteheight#/2,noteheight#/2);
502         fill triangle scaled (7h/6) shifted (w/2,-h/6);
503 fet_endchar;
504
505 %%% Editable values:
506 slope := 1.7; % slope of slash. From scm/grob-description.scm. How to auto-copy?
507 slt := 2/3*0.48staff_space; % thickness of lines. quarter notes get 1.5slt width.
508 slh := 2staff_space; % height of char.
509
510 %%% Calculated values:
511 sxa := 0; % how much the char exceeds the boundingbox horizontally:
512 slxt := sqrt(slt*slt+(slt/slope)*(slt/slope)); % Width of hor. pen - with thanks to Pythagoras
513 slw := slh/slope; % width of sloping part of slash:
514
515 % is this really nessesary? -rz
516 fac# := staff_space#/staff_space;
517 slt# := fac#*slt;
518 slh# := fac#*slh;
519 sxa# := fac#*sxa;
520 slxt# := fac#*slxt;
521 slw# := fac#*slw;
522
523 def draw_slash(expr hwid) =
524         wid# := slw#+2slxt#+hwid*fac#;
525         set_char_box(0,wid#-2sxa#,slh#/2,slh#/2);
526         define_pixels (wid#);
527         pickup penrazor scaled slxt;
528         draw (-b+slxt/2-sxa,-d) -- (-b+slxt/2+slw-sxa,h);
529         draw (w-slxt/2-slw+sxa,-d) -- (w-slxt/2+sxa,h);
530         pickup penrazor scaled slt rotated 90;
531         draw (-b+slxt-sxa,-d+slt/2) -- (w-slw+sxa,-d+slt/2);
532         draw (-b+slw-sxa,h-slt/2) -- (w-slxt+sxa,h-slt/2);
533 enddef;
534
535 fet_beginchar("Whole slashhead","0slash","wholeslashhead")
536         draw_slash(staff_space);
537 fet_endchar;
538
539 fet_beginchar("Half slashhead","1slash","halfslashhead")
540         draw_slash(0.6staff_space);
541 fet_endchar;
542
543 fet_beginchar("Quart slashhead","2slash","quartslashhead")
544         draw_slash(-slxt/2);
545 fet_endchar;
546
547 % thick is the distance between the two parallel lines in the cross (distance between centres of lines)
548 def draw_cross(expr thick) =
549         pent := 1.2stafflinethickness;
550         pickup pencircle scaled pent;
551         % alfa is the slant of the lines (i.e. 1 means 45 degrees)
552         alfa := (2h-pent)/(w-pent);
553         % llen is the length of the little outer lines
554         % llen = thick / sin(2atan(alfa))
555         llen := thick/(ypart(dir(2angle(1,alfa))));
556         xa := llen/sqrt(1+alfa**2);
557         ya := xa*alfa;
558         xl := w/2-xa-pent/2;
559         yl := h-ya-pent/2;
560         save crz; path crz;
561         crz = (xa,0) -- (xa+xl,yl) -- (xl,yl+ya) -- (0,ya);
562         draw crz shifted(w/2,0);
563         draw crz xscaled -1 shifted(w/2,0);
564         draw crz yscaled -1 shifted(w/2,0);
565         draw crz scaled -1 shifted(w/2,0);
566 enddef;
567
568 fet_beginchar("Whole Crossed notehead", "0cross", "wholecrossedhead")
569         wid# := black_notehead_width#+4stafflinethickness#;
570         hei# := noteheight#+stafflinethickness#;
571         set_char_box(0, wid#,hei#/2,hei#/2);
572         draw_cross(3.75stafflinethickness);
573 fet_endchar;
574
575 fet_beginchar("Half Crossed notehead", "1cross", "halfcrossedhead")
576         wid# := black_notehead_width#+2stafflinethickness#;
577         hei# := noteheight#+stafflinethickness#/2;
578         set_char_box(0, wid#,hei#/2,hei#/2);
579         draw_cross(3stafflinethickness);
580 fet_endchar;
581
582 fet_beginchar("Crossed notehead", "2cross", "crossedhead")
583         wid# := black_notehead_width#;
584         hei# := noteheight#;
585         set_char_box(0, wid#,hei#/2,hei#/2);
586         draw_cross(stafflinethickness/4);
587 fet_endchar;
588
589 fet_beginchar("X-Circled notehead", "2xcircle", "xcircledhead")
590         wid# := black_notehead_width#;
591         hei# := noteheight#+stafflinethickness#;
592         set_char_box(0, wid#,hei#/2,hei#/2);
593         cthick := 1.2stafflinethickness;
594         cxr := w/2-cthick/2;
595         cyr := h-cthick/2;
596         pickup pencircle scaled cthick;
597         draw fullcircle xscaled 2cxr yscaled 2cyr shifted (w/2,0);
598         xpos := cxr/sqrt2;
599         ypos := cyr/sqrt2;
600         draw (-xpos+w/2,-ypos) -- (xpos+w/2,ypos);
601         draw (-xpos+w/2,ypos) -- (xpos+w/2,-ypos);
602 fet_endchar;
603
604 %%%%%%%%
605 %
606 %
607 %
608 % EDITIO VATICANA
609 %
610 %
611 %
612
613 % subbipunctum
614 fet_beginchar("Ed. Vat. subbipunctum", "0vaticana_subbipunctum",
615         "vatsubbipunctumhead")
616         save b_h, a_w;
617         a_b := 1.54; % b_h*a_b/a_w = wd/ht
618         b_h := 0.85;
619         a_w := 1.09;
620
621         save a, beta, ht, wd;
622         ht# = noteheight#;
623         2beta# = ht# * b_h;
624         a# = beta# * a_b;
625         wd# = 2a# / a_w;
626         set_char_box(0.3wd#, 0.3wd#, 0.5 ht#, 0.5 ht#);
627         black_notehead_width# := wd#;
628
629         save za, alpha, size;
630         pair za;
631         define_pixels(ht, wd);
632         alpha = 35;
633         size = 0.45ht;
634         pickup pencircle
635                 xscaled 0
636                 yscaled size rotated -alpha;
637         za = (0, size) / 2 rotated alpha;
638         draw -za .. za;
639
640 fet_endchar;
641
642
643 % parametrized punctum
644 def punctum_char (expr verbose_name, internal_name, mudela_name,
645         left_stem, right_stem,
646         straight, reverse_convexity, excentric, up_shift, mag) =
647
648         fet_beginchar(verbose_name, internal_name, mudela_name)
649                 save b_h, a_w;
650                 a_b := 1.54; % b_h*a_b/a_w = wd/ht
651                 b_h := 0.85;
652                 a_w := 1.09;
653
654                 save a, beta, ht, wd;
655                 ht# = noteheight# * mag;
656                 2beta# = ht# * b_h;
657                 a# = beta# * a_b;
658                 wd# = 2a# / a_w;
659                 set_char_box(0.25wd#, 0.25wd#, 0.5ht#, 0.5ht#);
660                 black_notehead_width# := wd#;
661
662                 save convexity;
663                 if straight:
664                         if reverse_convexity:
665                                 convexity# = -0.02ht#;
666                         else:
667                                 convexity# = +0.02ht#;
668                         fi;
669                 else:
670                         if reverse_convexity:
671                                 convexity# = -0.05ht#;
672                         else:
673                                 convexity# = +0.05ht#;
674                         fi;
675                 fi;
676
677                 save yoffs;
678                 if up_shift:
679                         yoffs# = 0.08ht#;
680                 else:
681                         yoffs# = 0.00ht#;
682                 fi
683
684                 define_pixels(ht, wd, convexity, yoffs);
685                 pickup pencircle scaled stafflinethickness;
686
687                 if excentric:
688                         z1 = (0.00wd, yoffs - 1.0convexity);
689                         z2 = (0.08wd, yoffs + 1.4convexity);
690                         z3 = (0.40wd, yoffs);
691                         penpos1(0.50ht, 90);
692                         penpos2(0.50ht, 90);
693                         penpos3(0.50ht, 90);
694                         if reverse_convexity:
695                                 penstroke z1e{up} .. z2e{right} .. z3e;
696                         else:
697                                 penstroke z1e{down} .. z2e{right} ..z3e;
698                         fi;
699                 else:
700                         z1 = (0.00wd, yoffs);
701                         z2 = (0.20wd, yoffs + convexity);
702                         z3 = (0.40wd, yoffs);
703                         penpos1(0.50ht, 90);
704                         penpos2(0.50ht, 90);
705                         penpos3(0.50ht, 90);
706                         penstroke z1e .. z2e .. z3e;
707                 fi;
708
709                 if left_stem:
710                         z5=(0.00wd + 0.5 stafflinethickness, yoffs);
711                         z6=(0.00wd + 0.5 stafflinethickness, yoffs - 1.5ht);
712                         draw z5 -- z6;
713                 elseif right_stem:
714                         z5=(0.40wd - 0.25 stafflinethickness, yoffs);
715                         z6=(0.40wd - 0.25 stafflinethickness, yoffs - 1.5ht);
716                         draw z5 -- z6;
717                 fi;
718
719         fet_endchar;
720 enddef;
721
722
723 % punctum
724 punctum_char("Ed. Vat. punctum", "0vaticana_punctum", "vatpunctumhead",
725         false, false, false, false, false, false, 1.0);
726
727 % virga (i.e. right stemmed punctum)
728 punctum_char("Ed. Vat. virga", "0vaticana_virga", "vatvirgahead",
729         false, true, false, false, false, false, 1.0);
730
731 % left stemmed punctum as used in clivis (flexa) ligature
732 punctum_char("Ed. Vat. reverse virga", "0vaticana_rvirga", "vatrvirgahead",
733         true, false, false, false, false, false, 1.0);
734
735 % pes lower punctum
736 punctum_char("Ed. Vat. pes lower punctum", "0vaticana_lpes", "vatlpeshead",
737         false, false, true, true, false, false, 1.0);
738
739 % pes upper punctum
740 punctum_char("Ed. Vat. pes upper punctum", "0vaticana_upes", "vatupeshead",
741         false, false, true, false, false, false, 1.0);
742
743 % pes upper punctum (shifted variation)
744 %
745 % Note: This note head is used instead of the regular pes upper
746 % punctum to avoid collision with the lower punctum note of the pes when
747 % the upper punctum sits directly on top of the lower punctum.
748 punctum_char("Ed. Vat. var pes upper punctum", "0vaticana_vupes",
749         "vatvupeshead",
750         false, false, true, false, false, true, 1.0);
751
752 % small punctum as used in epiphonus/cephalicus
753 punctum_char("Ed. Vat. plica", "0vaticana_plica", "vatplicahead",
754         false, false, true, false, false, false, 0.5);
755
756 % excentric punctum as used in epiphonus
757 punctum_char("Ed. Vat. epiphonus", "0vaticana_epiphonus", "vatepiphonushead",
758         false, false, false, true, true, false, 1.0);
759
760 % excentric punctum as used in cephalicus
761 punctum_char("Ed. Vat. cephalicus", "0vaticana_cephalicus",
762         "vatcephalicushead",
763         false, false, false, false, true, false, 1.0);
764
765 % quilisma
766 fet_beginchar("Ed. Vat. quilisma", "0vaticana_quilisma", "vatquilismahead")
767         save b_h,a_w;
768         a_b:=1.54; % b_h*a_b/a_w = wd/ht
769         b_h:=0.85;
770         a_w:=1.09;
771
772         save a, beta, ht, wd;
773         ht# =noteheight#;
774         2beta#=ht#*b_h;
775         a# = beta#*a_b;
776         wd# = 2a# / a_w;
777         set_char_box(0.1wd#, 0.4wd#, 0.5 ht#, 0.5 ht#);
778         black_notehead_width# := wd#;
779
780         define_pixels(ht, wd);
781         pickup pencircle xscaled stafflinethickness yscaled 0.4ht;
782         z1=(0.00wd,-0.10ht);
783         z2=(0.00wd,+0.05ht);
784         z3=(0.15wd,-0.05ht);
785         z4=(0.15wd,+0.10ht);
786         z5=(0.30wd,+0.00ht);
787         z6=(0.30wd,+0.15ht);
788         draw z1 -- z2 -- z3 -- z4 -- z5 -- z6;
789
790 fet_endchar;
791
792 %%%%%%%%
793 %
794 %
795 %
796 % EDITIO MEDICAEA
797 %
798 %
799 %
800
801 % subbipunctum
802 fet_beginchar("Ed. Med. subbipunctum", "0medicaea_subbipunctum",
803         "medsubbipunctumhead")
804         save b_h, a_w;
805         a_b := 1.54; % b_h*a_b/a_w = wd/ht
806         b_h := 0.85;
807         a_w := 1.09;
808
809         save a, beta, ht, wd;
810         ht# = noteheight#;
811         2beta# = ht# * b_h;
812         a# = beta# * a_b;
813         wd# = 2a# / a_w;
814         set_char_box(wd#/2, wd#/2, 0.5 ht#, 0.5 ht#);
815         black_notehead_width# := wd#;
816
817         save za, alpha, size;
818         pair za;
819         define_pixels(ht, wd);
820         alpha = 35;
821         size = 0.7ht;
822         pickup pencircle
823                 xscaled 0
824                 yscaled size rotated -alpha;
825         za = (0, size) / 2 rotated alpha;
826         draw -za .. za;
827
828 fet_endchar;
829
830 % parametrized punctum
831 def punctum_char (expr verbose_name, internal_name, mudela_name,
832         left_up_stem, left_down_stem) =
833
834         fet_beginchar(verbose_name, internal_name, mudela_name)
835
836                 save a, beta, ht, wd;
837                 ht# = 2 staff_space#;
838                 wd# = ht#;
839                 set_char_box(0.0, 0.4wd#, 0.5ht#, 0.5ht#);
840                 black_notehead_width# := wd#;
841
842                 define_pixels(ht, wd);
843                 pickup pencircle scaled stafflinethickness;
844
845                         z1 = (0.00wd, 0);
846                         z2 = (0.20wd, 0);
847                         z3 = (0.40wd, 0);
848                         penpos1(0.50ht, 90);
849                         penpos2(0.50ht, 90);
850                         penpos3(0.50ht, 90);
851                         penstroke z1e .. z2e .. z3e;
852
853                 if left_down_stem:
854                         z5=(0.00wd + 0.5 stafflinethickness, 0);
855                         z6=(0.00wd + 0.5 stafflinethickness, - 1.25ht);
856                         draw z5 -- z6;
857                 elseif left_up_stem:
858                         z5=(0.00wd + 0.5 stafflinethickness, 0);
859                         z6=(0.00wd + 0.5 stafflinethickness, + 1.25ht);
860                         draw z5 -- z6;
861                 fi;
862
863         fet_endchar;
864 enddef;
865
866 % punctum
867 punctum_char("Ed. Med. punctum", "0medicaea_punctum", "medpunctumhead",
868         false, false);
869
870 % left up-stemmed punctum
871 punctum_char("Ed. Med. reverse virga", "0medicaea_rvirga", "medrvirgahead",
872         true, false);
873
874 % virga (i.e. left down-stemmed punctum)
875 punctum_char("Ed. Med. virga", "0medicaea_virga", "medvirgahead",
876         false, true);
877
878 %%%%%%%%
879 %
880 %
881 %
882 % HUFNAGEL
883 %
884 %
885 %
886
887 % punctum
888 % parametrized punctum
889 def punctum_char (expr verbose_name, internal_name, mudela_name,
890         down_stem) =
891
892         fet_beginchar(verbose_name, internal_name, mudela_name)
893                 save b_h, a_w;
894                 a_b := 1.54; % b_h*a_b/a_w = wd/ht
895                 b_h := 0.85;
896                 a_w := 1.09;
897
898                 save a, beta, ht, wd;
899                 ht# = noteheight#;
900                 2beta# = ht# * b_h;
901                 a# = beta# * a_b;
902                 wd# = 2a# / a_w;
903                 set_char_box(wd#/2, wd#/2, 0.5 ht#, 0.5 ht#);
904                 black_notehead_width# := wd#;
905
906                 save za, zb, zc, alpha, size;
907                 pair za, zb, zc;
908                 define_pixels(ht, wd);
909                 alpha = 55;
910                 size = 0.7ht;
911                 pickup pencircle
912                         xscaled 0
913                         yscaled size rotated -alpha;
914                 za = (0, size) / 2 rotated alpha;
915                 draw -za .. za;
916
917                 if down_stem:
918                         zb = (0.00wd, 0);
919                         zc = (0.00wd, - 1.25ht);
920                         draw zb -- zc;
921                 fi;
922         fet_endchar;
923 enddef;
924
925 % punctum
926 punctum_char("Hufnagel punctum", "0hufnagel_punctum", "hufpunctumhead", false)
927
928 % virga
929 punctum_char("Hufnagel virga", "0hufnagel_virga", "hufvirgahead", true)
930
931 % pes lower punctum
932 fet_beginchar("Hufnagel pes lower punctum", "0hufnagel_lpes", "huflpeshead")
933         save b_h, a_w;
934         a_b := 1.54; % b_h*a_b/a_w = wd/ht
935         b_h := 0.85;
936         a_w := 1.09;
937
938         save a, beta, ht, wd;
939         ht# = noteheight#;
940         2beta# = ht# * b_h;
941         a# = beta# * a_b;
942         wd# = 2a# / a_w;
943         set_char_box(wd#, wd#, 0.7 ht#, 0.7 ht#);
944         black_notehead_width# := wd#;
945
946         save za, alpha, size;
947         pair za;
948         define_pixels(ht, wd);
949         alpha = 35;
950         size = 0.7ht;
951         pickup pencircle
952                 xscaled 0
953                 yscaled size rotated -alpha;
954         za = (size, 0);
955         draw -za .. za;
956 fet_endchar;
957
958 fet_endgroup("noteheads");
959 define_pixels(black_notehead_width);