]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-bolletjes.mf
release: 0.1.24
[lilypond.git] / mf / feta-bolletjes.mf
1 % bolletjes.mf
2 % part of LilyPond's pretty-but-neat music font
3
4 % most beautiful noteheads are pronounced, not circular, 
5 % and not even symmetric.
6 % These examples are inspired by [Wanske], see literature list
7
8
9 save black_notehead_width;
10 numeric black_notehead_width;
11
12 fet_begingroup("balls");
13
14 noteheight#:=interline#+ (1 + overdone_heads) *stafflinethickness#;
15 define_pixels(noteheight);
16
17 def draw_brevis =
18         save beamheight, head_width;
19         save holeheight, stem_width;
20         save serif_size, serif_protrude;
21
22         head_width# = 2 interline#;
23         holeheight = 3 stafflinethickness;
24         stem_width = 1.4 stafflinethickness;
25
26
27         define_pixels(head_width);
28         set_char_box(0, head_width#, noteheight#/2, noteheight#/2);
29         
30         2 beamheight + holeheight = noteheight;
31         serif_size = (holeheight - stafflinethickness)/2;
32         serif_protrude = 1.5 serif_size;
33         penpos1(stem_width, 0);
34         penpos2(stem_width, 0);
35         penpos3(beamheight, 90);
36         penpos4(beamheight, 90);
37         penpos5(stem_width, 180);
38
39         z1l = (0, 0);
40         z2l = (0, -stafflinethickness/2);
41         z3r = z2r + serif_size *(1,-1);
42         y4r = y3r;
43         x4r = head_width/2;
44         z5l = z3l + (-serif_size, -serif_protrude);
45
46         penlabels(1,2,3,4, 5);
47         fill z1r -- z1l -- z5r{down} .. z5l{up} .. z3l{right}
48                 -- z4l -- z4r -- z3r{left} .. z2r{up} -- cycle;
49
50         addto currentpicture also currentpicture yscaled -1;
51         addto currentpicture also currentpicture reflectedabout(z4r, z4l);
52 enddef;
53
54 fet_beginchar("Brevis notehead", "-1", "brevisball")
55         draw_brevis;
56 fet_endchar;
57
58
59 %
60 % Some sources (eg Musix/OpusTeX think that the appendage should be on
61 % the right, my only other ref [Willemze], shows an appendage to the left
62 %
63 fet_beginchar("Longa notehead", "-2", "longaball");
64         draw_brevis;
65         save theta;
66         z7 = z5;
67         z6 - z7 = (-stem_width/2, -interline);
68         theta = angle(z6-z7)+ 90;
69         penpos7(stem_width, theta);
70         penpos6(1.2 stem_width, theta);
71         
72         fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
73         penlabels(6,7);
74 fet_endchar;
75
76 % setup user vars
77 def setup_notehead_vars =
78         save a_b,err_y_a,tilt,superness;
79         save ai_a,ai_bi,err_y_ai,err_x_bi,inner_tilt,inner_superness;
80         save b_h,a_w;
81         enddef;
82
83 % setup addititional vars and calc them
84 def notehead_calc =
85         save a,beta,ai,bi, ht, wd;
86         ht# =noteheight#;
87         2beta#=ht#*b_h;
88         a# = beta#*a_b;
89         wd# = 2a# / a_w;
90         ai# = a# * ai_a;
91         bi# = ai#/ai_bi;
92         define_pixels(a,beta);
93         define_pixels(ai,bi);
94         set_char_box(0, wd#, .5 ht#, .5 ht#);
95         enddef;
96
97
98 % draw the outer and inner ellipse.
99 def notehead_draw =
100         path black,white;
101         black=distorted_ellipse(a,beta,a*err_y_a,0,superness);
102         white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,inner_superness);
103 if test>1: %fixme
104                 save x;
105                 x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
106                 penlabels(1,2,3,4);
107                 test_grid;
108 else:
109                 black:=black rotated tilt;
110                 black:=black shifted (w/2,0);
111                 white:=white rotated inner_tilt;
112                 white:=white shifted (w/2,0);
113 fi
114                 fill black;
115                 unfill white;
116
117                 
118         enddef;
119
120 % whole note
121 % Wanske, p.38
122 fet_beginchar("Whole notehead", "0", "wholeball")
123         setup_notehead_vars;
124         
125         a_b:=1.80;
126         err_y_a:=0; % no slant
127         tilt:=0;
128         superness:=0.707;
129         ai_a:=0.508;
130         % ai_bi:=1.23;
131         ai_bi:=1.30; % jcn
132         % err_y_ai:=0.0938;
133         % err_x_bi:=0;
134         err_y_ai:=0;
135         err_x_bi:=0.115;
136         % inner_tilt:=135;
137         inner_tilt:=125; % jcn
138         % inner_superness:=0.69;
139         inner_superness:=0.68; % jcn
140         b_h:=1; %no rotate-> no height correction
141         a_w:=1; % no rotate-> no width correction
142
143         notehead_calc;
144         notehead_draw;
145 fet_endchar;
146
147
148 % half note
149 % Wanske, p.39
150 fet_beginchar("Half notehead", "1", 
151         "halfball")
152         setup_notehead_vars;
153                 % a_b:=1.49; % after text
154         a_b:=1.50; % after drawing
155         err_y_a:=0.157;
156         tilt:=34;
157         % superness:=0.66;
158         superness:=0.67; % jcn
159         % ai_a:=0.863;
160         ai_a:=0.850; % jcn
161         % ai_bi:=3.14;
162         ai_bi:=3.30; % jcn
163         err_y_ai:=0;
164         err_x_bi:=-0.12;
165         inner_tilt:=tilt;
166         inner_superness:=0.80;
167         b_h:=0.935;
168         a_w:=1.12;
169
170         notehead_calc;
171         notehead_draw;
172 fet_endchar;
173
174
175 % quarter note
176 % Wanske p.38
177 fet_beginchar("Quart notehead", "2", "quartball")
178         setup_notehead_vars;
179         % a_b:=1.57; % after text
180         a_b:=1.54; % after drawing
181         err_y_a:=0.044;
182         tilt:=32;
183         superness:=0.707;
184         ai_a:=0;
185         ai_bi:=1;
186         err_y_ai:=0;
187         err_x_bi:=0;
188         inner_tilt:=0;
189         inner_superness:=0.707;
190         b_h:=0.85;
191         a_w:=1.09;
192
193         notehead_calc;
194         black_notehead_width# := wd#;
195         notehead_draw;
196 fet_endchar;
197
198
199
200
201 fet_endgroup("balls");
202
203 define_pixels(black_notehead_width);