]> git.donarmstrong.com Git - lilypond.git/blob - mf/bolletjes.mf
c5b32625e2c8ef1c76aff2757d502b488a45985a
[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 not circular, and not even symmetric.
5
6 interline#:=staffsize#/(stafflines-1)+stafflinethickness#;
7
8 def test_grid =
9 if test>1:
10         proofrulethickness 1pt#;
11         makegrid(0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor)
12                 (0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor);
13         proofrulethickness .1pt#;
14         makegrid(0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor)
15                 (0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor);
16 fi
17         enddef;
18
19 % a: x diameter
20 % b: y diameter
21 % err_x: drift of y axis at top
22 % err_y: drift of x axis at right
23 def distorted_ellipse(expr a,b,err_y,err_x,super) =
24         superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
25         enddef;
26
27 def begin_notehead =
28         begingroup;
29         save a_b,err_y_a,alpha,super;
30         save ai_a,ai_bi,err_y_ai,err_x_bi,alphai,superi;
31         save b_h,a_w;
32         enddef;
33
34 def end_notehead(expr code,interline,name,id,texstr) =
35         save a,b,h,w,ai,bi;
36         h#=interline;
37         2b#=h#*b_h;
38         a#=b#*a_b;
39         w#=2a#/a_w;
40         ai#=a#*ai_a;
41         bi#=ai#/ai_bi;
42         define_pixels(a,b);
43         define_pixels(w,h);
44         define_pixels(ai,bi);
45         fet_beginchar(code,w#,h#,0,name,id,texstr);
46                 path black,white;
47                 black=distorted_ellipse(a,b,a*err_y_a,0,super);
48                 white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,superi);
49 if test>0:
50                 save x;
51                 x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
52                 penlabels(1,2,3,4);
53                 test_grid;
54 else:
55                 black:=black rotated alpha;
56 %               black:=black shifted (w/2,h/2);
57                 black:=black shifted (w/2,0);
58                 white:=white rotated alphai;
59 %               white:=white shifted (w/2,h/2);
60                 white:=white shifted (w/2,0);
61 fi
62                 fill black;
63                 unfill white;
64                 endchar;
65                 endgroup;
66         enddef;
67                 
68 % fet_begingroup("noteheads");
69 fet_begingroup("balls");
70 % whole note
71 % Wanske, p.38
72 % begin_notehead(incr code,interline#,"Whole notehead");
73 begin_notehead;
74         a_b:=1.80;
75         err_y_a:=0; % no slant
76         alpha:=0;
77         super:=0.707;
78         ai_a:=0.508;
79         ai_bi:=1.23;
80         % err_y_ai:=0.0938;
81         % err_x_bi:=0;
82         err_y_ai:=0;
83         err_x_bi:=0.115;
84         alphai:=135;
85         superi:=0.69;
86         b_h:=1; %no rotate-> no height correction
87         a_w:=1; % no rotate-> no width correction
88         end_notehead(incr code,interline#,"Whole notehead","0","wholeball");
89
90 % half note
91 % Wanske, p.39
92 begin_notehead;
93         a_b:=1.49; % after text
94         % a_b:=1.50; % after drawing
95         err_y_a:=0.157;
96         alpha:=34;
97         super:=0.66;
98         ai_a:=0.863;
99         ai_bi:=3.14;
100         err_y_ai:=0;
101         err_x_bi:=-0.12;
102         alphai:=alpha;
103         superi:=0.80;
104         b_h:=0.935;
105         a_w:=1.12;
106         end_notehead(incr code,interline#,"Half notehead","1","halfball");
107
108 % quarter note
109 % Wanske p.38
110 begin_notehead;
111         a_b:=1.57; % after text
112         % a_b:=1.54; % after drawing
113         err_y_a:=0.044;
114         alpha:=32;
115         super:=0.707;
116         ai_a:=0;
117         ai_bi:=1;
118         err_y_ai:=0;
119         err_x_bi:=0;
120         alphai:=0;
121         superi:=0.707;
122         b_h:=0.85;
123         a_w:=1.09;
124         end_notehead(incr code,interline#,"Quarter notehead","2","quartball");
125
126 % silly tableXX.ly fillers, for now
127 fet_beginchar(incr code,2interline#,interline#,0,"Longa notehead","-2","longaball");
128 endchar;
129 fet_beginchar(incr code,2interline#,interline#,0,"Brevis notehead","-1","breveball");
130 endchar;
131
132 fet_endgroup("noteheads");
133