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