lilypond-0.1.16
[lilypond.git] / mf / bolletjes.mf
blob9980b05be674b47f432e1188e5079ad42649bd75
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.
6 interline#:=staffsize#/(stafflines-1)+stafflinethickness#;
8 def ugh_grid =
9         makegrid(-5pt,-4pt,-3pt,-2pt,-1pt,0pt,1pt,2pt,3pt,4pt,5pt)
10                 (-5pt,-4pt,-3pt,-2pt,-1pt,0pt,1pt,2pt,3pt,4pt,5pt);
11         makegrid(-4.8pt,-4.6pt,-4.4pt,-4.2pt,-4.0pt,
12                  -3.8pt,-3.6pt,-3.4pt,-3.2pt,-3.0pt,
13                  -2.8pt,-2.6pt,-2.4pt,-2.2pt,-2.0pt,
14                  -1.8pt,-1.6pt,-1.4pt,-1.2pt,-1.0pt,
15                  -0.8pt,-0.6pt,-0.4pt,-0.2pt,-0.0pt,
16                  0.0pt,0.2pt,0.4pt,0.6pt,0.8pt,
17                  1.0pt,1.2pt,1.4pt,1.6pt,1.8pt,
18                  2.0pt,2.2pt,2.4pt,2.6pt,2.8pt,
19                  3.0pt,3.2pt,3.4pt,3.6pt,3.8pt,
20                  4.0pt,4.2pt,4.4pt,4.6pt,4.8pt)
21                 (-4.8pt,-4.6pt,-4.4pt,-4.2pt,-4.0pt,
22                  -3.8pt,-3.6pt,-3.4pt,-3.2pt,-3.0pt,
23                  -2.8pt,-2.6pt,-2.4pt,-2.2pt,-2.0pt,
24                  -1.8pt,-1.6pt,-1.4pt,-1.2pt,-1.0pt,
25                  -0.8pt,-0.6pt,-0.4pt,-0.2pt,-0.0pt,
26                  0.0pt,0.2pt,0.4pt,0.6pt,0.8pt,
27                  1.0pt,1.2pt,1.4pt,1.6pt,1.8pt,
28                  2.0pt,2.2pt,2.4pt,2.6pt,2.8pt,
29                  3.0pt,3.2pt,3.4pt,3.6pt,3.8pt,
30                  4.0pt,4.2pt,4.4pt,4.6pt,4.8pt);
31         enddef;
34 % a: x diameter
35 % b: y diameter
36 % err_x: drift of y axis at top
37 % err_y: drift of x axis at right
38 def distorted_ellipse(expr a,b,err_y,err_x,super) =
39         superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
40         enddef;
42 % brr.
43 % def notehead(expr code,il,hdb,adb,adw,xda,s,alpha,cda,ddb,r) =
44 def notehead(expr code,interline,name) =
45         save a,b,h,w,ai,bi;
46         h#=interline;
47         2b#=h#*b_h;
48         a#=b#*a_b;
49         w#=2a#/a_w;
50         ai#=a#*ai_a;
51         bi#=ai#/ai_bi;
52         define_pixels(a,b);
53         define_pixels(w,h);
54         define_pixels(ai,bi);
55 %       save x;
56 %       x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
57 %       penlabels(1,2,3,4);
58 if test>0:
59         beginchar(code,w#,h#,0); name;
60                 fill distorted_ellipse(a,b,a*err_y_a,0,super);
61                 unfill distorted_ellipse(ai,bi,ai*err_y_ai,0,superi);
62 if test=1:
63                 pickup pencircle;
64                 draw (0,0)--(a,0) rotated alpha;
65                 draw (0,0)--(-a,0) rotated alphai;
66 else:
67                 ugh_grid;
69 else:
70         beginchar(code,w#,h#,0); name;
71                 path black,white;
72                 black=distorted_ellipse(a,b,a*err_y_a,0,super);
73                 black:=black rotated alpha;
74 %               black:=black shifted (w/2,h/2);
75                 black:=black shifted (w/2,0);
76                 fill black;
77                 white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,superi);
78                 white:=white rotated alphai;
79 %               white:=white shifted (w/2,h/2);
80                 white:=white shifted (w/2,0);
81                 unfill white;
83                 endchar;
84         enddef;
85                 
86 % whole note
87 % a/b=1.7
88 % h/b=1; 
89 % a/w=1; 
90 % x/a=1; 
91 %notehead(incr code,interline#,1,1.7,1,1/20,0.707,0,1/2.2,1/1.3,0.74);
92 %notehead(incr code,interline#,1,1.7,1,1/20,0.707,0,5/11,3/4,0.74);
94 %def notehead(expr code,il,hdb,adb,adw,xda,s,alpha,cda,ddb,r) =
96 % whole note
97 % wanske, p.38
98 save a_b,err_y_a,alpha,super;
99 save ai_a,ai_bi,err_y_ai,err_x_bi,alphai,superi;
100 save b_h,a_w;
101 a_b:=1.80;
102 err_y_a:=0; % no slant
103 alpha:=0;
104 super:=0.707;
105 ai_a:=0.508;
106 ai_bi:=1.23;
107 % err_y_ai:=0.0938;
108 % err_x_bi:=0;
109 err_y_ai:=0;
110 err_x_bi:=0.115;
111 alphai:=135;
112 superi:=0.68;
113 b_h:=1; %no rotate-> no height correction
114 a_w:=1; % no rotate-> no width correction
115 notehead(incr code,interline#,"Whole notehead");
117 % half note
118 % wanske, p.39
119 a_b:=1.49;
120 err_y_a:=0.157;
121 alpha:=34;
122 super:=0.66;
123 ai_a:=0.863;
124 ai_bi:=3.41;
125 err_y_ai:=0;
126 err_x_bi:=-0.12;
127 alphai:=alpha;
128 superi:=0.80;
129 b_h:=0.935;
130 a_w:=1.12;
131 notehead(incr code,interline#,"Half notehead");
133 % quarter note
134 % wanske p.38
135 a_b:=1.57;
136 err_y_a:=0.044;
137 alpha:=32;
138 super:=0.707;
139 ai_a:=0;
140 ai_bi:=1;
141 err_y_ai:=0;
142 err_x_bi:=0;
143 alphai:=0;
144 superi:=0.707;
145 b_h:=0.85;
146 a_w:=1.09;
147 notehead(incr code,interline#,"Quarter notehead");
149 end.