]> git.donarmstrong.com Git - lilypond.git/blob - mf/bolletjes.mf
patch::: 0.1.17.jcn1: pats
[lilypond.git] / mf / bolletjes.mf
1 % bolletjes.mf
2 % part of LilyPond's pretty-but-neat music font
3 % third try at bolletjes
4 % most beautiful bolletjes are pronounced, not circular, 
5 % and not even symmetric.
6
7 interline#:=staffsize#/(stafflines-1);
8 %noteheight#:=interline#;
9 % even more pronounced (almost overdone), just like the original
10 noteheight#:=interline#+2stafflinethickness#;
11
12 def test_grid =
13 if test>1:
14         proofrulethickness 1pt#;
15         makegrid(0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor)
16                 (0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor);
17         proofrulethickness .1pt#;
18         makegrid(0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor)
19                 (0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor);
20 fi
21         enddef;
22
23 % a: x diameter
24 % b: y diameter
25 % err_x: drift of y axis at top
26 % err_y: drift of x axis at right
27 def distorted_ellipse(expr a,b,err_y,err_x,super) =
28         superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
29         enddef;
30
31 def begin_notehead =
32         begingroup;
33         save a_b,err_y_a,alpha,super;
34         save ai_a,ai_bi,err_y_ai,err_x_bi,alphai,superi;
35         save b_h,a_w;
36         enddef;
37
38 def end_notehead(expr code,height,name,id,texstr) =
39         save a,b,h,w,ai,bi;
40         h#=height;
41         2b#=h#*b_h;
42         a#=b#*a_b;
43         w#=2a#/a_w;
44         ai#=a#*ai_a;
45         bi#=ai#/ai_bi;
46         define_pixels(a,b);
47         define_pixels(w,h);
48         define_pixels(ai,bi);
49         fet_beginchar(code,w#,h#,0,name,id,texstr);
50                 path black,white;
51                 black=distorted_ellipse(a,b,a*err_y_a,0,super);
52                 white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,superi);
53 if test>0:
54                 save x;
55                 x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
56                 penlabels(1,2,3,4);
57                 test_grid;
58 else:
59                 black:=black rotated alpha;
60 %               black:=black shifted (w/2,h/2);
61                 black:=black shifted (w/2,0);
62                 white:=white rotated alphai;
63 %               white:=white shifted (w/2,h/2);
64                 white:=white shifted (w/2,0);
65 fi
66                 fill black;
67                 unfill white;
68                 endchar;
69                 endgroup;
70         enddef;
71                 
72 % fet_begingroup("noteheads");
73 fet_begingroup("balls");
74 % whole note
75 % Wanske, p.38
76 % begin_notehead(incr code,interline#,"Whole notehead");
77 begin_notehead;
78         a_b:=1.80;
79         err_y_a:=0; % no slant
80         alpha:=0;
81         super:=0.707;
82         ai_a:=0.508;
83         % ai_bi:=1.23;
84         ai_bi:=1.30; % jcn
85         % err_y_ai:=0.0938;
86         % err_x_bi:=0;
87         err_y_ai:=0;
88         err_x_bi:=0.115;
89         % alphai:=135;
90         alphai:=125; % jcn
91         % superi:=0.69;
92         superi:=0.68; % jcn
93         b_h:=1; %no rotate-> no height correction
94         a_w:=1; % no rotate-> no width correction
95         end_notehead(incr code,noteheight#,"Whole notehead","0","wholeball");
96
97 % half note
98 % Wanske, p.39
99 begin_notehead;
100         % a_b:=1.49; % after text
101         a_b:=1.50; % after drawing
102         err_y_a:=0.157;
103         alpha:=34;
104         % super:=0.66;
105         super:=0.67; % jcn
106         % ai_a:=0.863;
107         ai_a:=0.850; % jcn
108         % ai_bi:=3.14;
109         ai_bi:=3.30; % jcn
110         err_y_ai:=0;
111         err_x_bi:=-0.12;
112         alphai:=alpha;
113         superi:=0.80;
114         b_h:=0.935;
115         a_w:=1.12;
116         end_notehead(incr code,noteheight#,"Half notehead","1","halfball");
117
118 % quarter note
119 % Wanske p.38
120 begin_notehead;
121         % a_b:=1.57; % after text
122         a_b:=1.54; % after drawing
123         err_y_a:=0.044;
124         alpha:=32;
125         super:=0.707;
126         ai_a:=0;
127         ai_bi:=1;
128         err_y_ai:=0;
129         err_x_bi:=0;
130         alphai:=0;
131         superi:=0.707;
132         b_h:=0.85;
133         a_w:=1.09;
134         end_notehead(incr code,noteheight#,"Quarter notehead","2","quartball");
135
136 % from MO*gen.mf
137 lthick:=.4pt;
138 pen line_pen;
139 line_pen:= pencircle scaled lthick;
140
141 picture save_pic;
142 def callpic = currentpicture:= save_pic enddef;
143 def savepic = save_pic:= currentpicture enddef;
144
145 def add_mirror (expr pone, ptwo) =
146   addto currentpicture also currentpicture
147         reflectedabout (round(pone), round(ptwo))
148 enddef;
149
150 def fill_square (expr xwidth, ywidth, zshift) =
151   fill unitsquare xscaled xwidth yscaled ywidth shifted zshift
152 enddef;
153
154 % ugh
155 nhh#:=interline#;
156 nhw#:=6/5interline#;
157 define_pixels(nhh,nhw);
158
159 fet_beginchar(incr code,2interline#,interline#,0,"Brevis notehead","-1","breveball");
160         fill_square (5/4nhw, .25nhh, (0,.25nhh));
161         add_mirror (origin, right);
162         x1=x2=0; x3=x4=5/4nhw; y1=-y2=y3=-y4=.7nhh;
163         pickup line_pen;
164         draw z1--z2; draw z3--z4;
165         savepic;
166         endchar;
167
168 fet_beginchar(incr code,2interline#,interline#,0,"Longa notehead","-2","longaball");
169         callpic;
170         pickup line_pen;
171         draw (5/4nhw,-.7nhh)--(5/4nhw,-1.7nhh);
172         endchar;
173
174 % fet_endgroup("noteheads");
175 fet_endgroup("balls");
176