]> git.donarmstrong.com Git - lilypond.git/blob - mf/bolletjes.mf
release: 0.1.19
[lilypond.git] / mf / 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 %noteheight#:=interline#;
9
10 % even more pronounced (almost overdone), just like the original
11 noteheight#:=interline#+1.5stafflinethickness#;
12
13
14 % setup user vars
15 def setup_notehead_vars =
16         save a_b,err_y_a,tilt,superness;
17         save ai_a,ai_bi,err_y_ai,err_x_bi,inner_tilt,inner_superness;
18         save b_h,a_w;
19         enddef;
20
21 % setup addititional vars and calc them
22 def notehead_calc =
23         save a,beta,ai,bi, ht, wd;
24         ht# =noteheight#;
25         2beta#=ht#*b_h;
26         a# = beta#*a_b;
27         wd# = 2a# / a_w;
28         ai# = a# * ai_a;
29         bi# = ai#/ai_bi;
30         define_pixels(a,beta);
31         define_pixels(ai,bi);
32         set_char_box(0, wd#, .5 ht#, .5 ht#);
33         enddef;
34
35
36 % draw the outer and inner ellipse.
37 def notehead_draw =
38         path black,white;
39         black=distorted_ellipse(a,beta,a*err_y_a,0,superness);
40         white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,inner_superness);
41 if test>1: %fixme
42                 save x;
43                 x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
44                 penlabels(1,2,3,4);
45                 test_grid;
46 else:
47                 black:=black rotated tilt;
48                 black:=black shifted (w/2,0);
49                 white:=white rotated inner_tilt;
50                 white:=white shifted (w/2,0);
51 fi
52                 fill black;
53                 unfill white;
54
55                 
56         enddef;
57
58
59 fet_begingroup("balls");
60
61 % whole note
62 % Wanske, p.38
63 fet_beginchar("Whole notehead", "0", "wholeball")
64         setup_notehead_vars;
65         
66         a_b:=1.80;
67         err_y_a:=0; % no slant
68         tilt:=0;
69         superness:=0.707;
70         ai_a:=0.508;
71         % ai_bi:=1.23;
72         ai_bi:=1.30; % jcn
73         % err_y_ai:=0.0938;
74         % err_x_bi:=0;
75         err_y_ai:=0;
76         err_x_bi:=0.115;
77         % inner_tilt:=135;
78         inner_tilt:=125; % jcn
79         % inner_superness:=0.69;
80         inner_superness:=0.68; % jcn
81         b_h:=1; %no rotate-> no height correction
82         a_w:=1; % no rotate-> no width correction
83
84         notehead_calc;
85         notehead_draw;
86 fet_endchar;
87
88
89 % half note
90 % Wanske, p.39
91 fet_beginchar("Half notehead", "1", 
92         "halfball")
93         setup_notehead_vars;
94                 % a_b:=1.49; % after text
95         a_b:=1.50; % after drawing
96         err_y_a:=0.157;
97         tilt:=34;
98         % superness:=0.66;
99         superness:=0.67; % jcn
100         % ai_a:=0.863;
101         ai_a:=0.850; % jcn
102         % ai_bi:=3.14;
103         ai_bi:=3.30; % jcn
104         err_y_ai:=0;
105         err_x_bi:=-0.12;
106         inner_tilt:=tilt;
107         inner_superness:=0.80;
108         b_h:=0.935;
109         a_w:=1.12;
110
111         notehead_calc;
112         notehead_draw;
113 fet_endchar;
114
115
116 % quarter note
117 % Wanske p.38
118 fet_beginchar("Quart notehead", "2", "quartball")
119         setup_notehead_vars;
120         % a_b:=1.57; % after text
121         a_b:=1.54; % after drawing
122         err_y_a:=0.044;
123         tilt:=32;
124         superness:=0.707;
125         ai_a:=0;
126         ai_bi:=1;
127         err_y_ai:=0;
128         err_x_bi:=0;
129         inner_tilt:=0;
130         inner_superness:=0.707;
131         b_h:=0.85;
132         a_w:=1.09;
133
134         notehead_calc;
135         notehead_draw;
136 fet_endchar;
137
138
139
140 % from MO*gen.mf; (pass the barfbag?)
141 def add_mirror (expr pone, ptwo) =
142   addto currentpicture also currentpicture
143         reflectedabout (round(pone), round(ptwo))
144 enddef;
145
146 def fill_square (expr xwidth, ywidth, zshift) =
147   fill unitsquare xscaled xwidth yscaled ywidth shifted zshift
148 enddef;
149
150 % ugh
151 nhh#:=interline#;
152 nhw#:=6/5interline#;
153 define_pixels(nhh,nhw);
154
155 fet_beginchar("Brevis notehead","-1","breveball"); 
156         set_char_box(0, 2interline#,.5 interline#, .5interline#);
157         fill_square (5/4nhw, .25nhh, (0,.25nhh));
158         add_mirror (origin, right);
159         x1=x2=0; x3=x4=5/4nhw; y1=-y2=y3=-y4=.7nhh;
160         pickup pencircle scaled stafflinethickness;
161         draw z1--z2; draw z3--z4;
162         push_picture(currentpicture);
163 fet_endchar;
164
165 fet_beginchar("Longa notehead","-2","longaball");
166         set_char_box(0, 2 interline#,.5interline#, .5interline# );
167         currentpicture := pop_picture;
168         pickup pencircle scaled stafflinethickness;
169         draw (5/4nhw,-.7nhh)--(5/4nhw,-1.7nhh);
170 fet_endchar;
171
172 % fet_endgroup("noteheads");
173 fet_endgroup("balls");
174