2 % feta-bolletjes.mf -- implement noteheads
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 1997 Jan Nieuwenhuizen <janneke@gnu.org>
7 % & Han-Wen Nienhuys <hanwen@stack.nl>
11 % most beautiful noteheads are pronounced, not circular,
12 % and not even symmetric.
13 % These examples are inspired by [Wanske], see literature list
16 save black_notehead_width;
17 numeric black_notehead_width;
19 fet_begingroup("balls");
21 noteheight#:=interline#+ (1 + overdone_heads) *stafflinethickness#;
22 define_pixels(noteheight);
23 brevis_wid# := 2 interline#;
25 def draw_brevis(expr brevwid) =
26 save beamheight, head_width;
27 save holeheight, stem_width;
28 save serif_size, serif_protrude;
30 head_width# = brevwid;
31 holeheight = 3 stafflinethickness;
32 stem_width = 1.4 stafflinethickness;
35 define_pixels(head_width);
36 set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
38 2 beamheight + holeheight = noteheight;
39 serif_size = (holeheight - stafflinethickness)/2;
40 serif_protrude = 1.5 serif_size;
41 penpos1(stem_width, 0);
42 penpos2(stem_width, 0);
43 penpos3(beamheight, 90);
44 penpos4(beamheight, 90);
45 penpos5(stem_width, 180);
48 z2l = (0, -stafflinethickness/2);
49 z3r = z2r + serif_size *(1,-1);
52 z5l = z3l + (-serif_size, -serif_protrude);
54 penlabels(1,2,3,4, 5);
55 fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
56 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
58 addto currentpicture also currentpicture yscaled -1;
60 addto currentpicture also currentpicture
61 shifted (-x4r,0) xscaled -1 shifted (x4l,0);
67 def draw_ledger(expr wid)=
68 set_char_box(uitsteek * wid, (1+ uitsteek)*wid,
69 ledgerlinethickness#/2,ledgerlinethickness#/2);
70 pickup pencircle scaled ledgerlinethickness;
77 fet_beginchar("Brevis notehead", "-1", "brevisball")
78 draw_brevis(brevis_wid#);
80 fet_beginchar("Brevis ledger", "-1l", "brevisledger")
81 draw_ledger(brevis_wid#);
85 % Some sources (eg Musix/OpusTeX think that the appendage should be on
86 % the right, my only other ref [Willemze], shows an appendage to the left
88 fet_beginchar("Longa notehead", "-2", "longaball");
89 draw_brevis(brevis_wid#);
92 z6 - z7 = (-stem_width/2, -interline);
93 theta = angle(z6-z7)+ 90;
94 penpos7(stem_width, theta);
95 penpos6(1.2 stem_width, theta);
97 fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
100 fet_beginchar("Longa ledger", "-2l", "longaledger")
101 draw_ledger(brevis_wid#);
106 def setup_notehead_vars =
107 save a_b,err_y_a,tilt,superness;
108 save ai_a,ai_bi,err_y_ai,err_x_bi,inner_tilt,inner_superness;
112 % setup addititional vars and calc them
114 save a,beta,ai,bi, ht, wd;
121 define_pixels(a,beta);
122 define_pixels(ai,bi);
123 set_char_box(0, wd#, .5 ht#, .5 ht#);
127 % draw the outer and inner ellipse.
130 black=distorted_ellipse(a,beta,a*err_y_a,0,superness);
131 white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,inner_superness);
134 x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
138 black:=black rotated tilt;
139 black:=black shifted (w/2,0);
140 white:=white rotated inner_tilt;
141 white:=white shifted (w/2,0);
151 fet_beginchar("Whole notehead", "0", "wholeball")
155 err_y_a:=0; % no slant
166 inner_tilt:=125; % jcn
167 % inner_superness:=0.69;
168 inner_superness:=0.68; % jcn
169 b_h:=1; %no rotate-> no height correction
170 a_w:=1; % no rotate-> no width correction
173 whole_notehead_width# := wd#;
178 fet_beginchar("Whole ledger line", "0l", "wholeledger")
179 draw_ledger(whole_notehead_width#);
184 fet_beginchar("Half notehead", "1",
187 % a_b:=1.49; % after text
188 a_b:=1.50; % after drawing
192 superness:=0.67; % jcn
200 inner_superness:=0.80;
205 half_notehead_width# := wd#;
210 fet_beginchar("Half ledger", "1l", "halfledger")
211 draw_ledger(half_notehead_width#);
216 fet_beginchar("Quart notehead", "2", "quartball")
218 % a_b:=1.57; % after text
219 a_b:=1.54; % after drawing
228 inner_superness:=0.707;
233 black_notehead_width# := wd#;
238 fet_beginchar("Quart ledger", "2l", "quartledger")
239 draw_ledger(black_notehead_width#);
242 fet_endgroup("balls");
244 define_pixels(black_notehead_width);