]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-toevallig.mf
release: 1.5.38
[lilypond.git] / mf / feta-toevallig.mf
1
2 % feta-toevallig.mf --  implement Accidentals
3
4 % source file of the Feta (Font-En-Tja) music font
5
6 % (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7
8
9
10 %
11 % Accidentals from various sources, notably
12 %
13 %   Baerenreiter edition of Schuberts `Auf dem Strom' (sharp, natural)
14 %   F Hofmeister edition of Muellers `Etueden fuer Horn'  (double sharp, flat)
15 %
16
17
18 %tracingall;
19 %proofing := 2;
20 %\tracingequations:= tracingonline := 1;
21
22 fet_begingroup("accidentals");
23
24 %
25 % The beams of most sharps have horizontal endings (as if drawn with 
26 % a square pen).  [Wanske] does not mention this, so we'll just ignore 
27 % this fact
28 %
29 fet_beginchar("Sharp" , "1", "sharp");
30         set_char_box(0, 1.1 staff_space#, 1.5 staff_space#, 
31                 1.5 staff_space#);
32
33         save interbeam, interstem, beamheight, beamwidth, 
34                 stemwidth;
35
36         interbeam := 1.05 staff_space;
37         interstem := 7/16 ;
38         beamheight := 4 stafflinethickness;
39         beamwidth := w;
40         stemwidth := 1.3 stafflinethickness;
41         roundness := 2blot_diameter;
42         pair center;
43         center := (.5 w, 0);
44         
45         roundness + 2 spanwidth = beamwidth;
46         roundness + 2 spanheight = beamheight;
47
48         2 horizontal_protrusion  + interstem * beamwidth + stemwidth
49                 = beamwidth;
50         
51 % wanske: whole beamheight; or ca 18 degrees
52 %       z2 - z1 = (beamwidth - roundness, beamheight/2);
53         z2 - z1 = (beamwidth - roundness, beamheight);
54         z1 + z2 = 2*center;
55         beamslope = (y2-y1)/(x2-x1);
56
57         pair hspan, vspan;
58         hspan = (spanwidth, beamslope * spanwidth);
59         vspan = (0, spanheight);
60
61         
62         path beam;
63         beam := (hspan + vspan -- -hspan 
64                 +  vspan -- -hspan -vspan -- hspan - vspan -- cycle )
65                 shifted center;
66
67         pickup pencircle scaled roundness;
68         filldraw (beam shifted (0,-interbeam/2));
69
70         pickup pencircle scaled stemwidth;
71         x3 = x4 = xpart center;
72         bot y3 = -1.5 staff_space + ypart center;
73         top y4 = 1.5 staff_space + ypart center;
74
75         numeric xs;
76         xs := interstem* beamwidth / 2;
77         draw_gridline (z3-(xs,xs* beamslope),z4-(xs,xs*beamslope),stemwidth);
78         addto currentpicture also currentpicture rotated 180 shifted (w,0);
79         labels(1,2,3,4);
80         fet_endchar;
81
82
83 %
84 % The stems of the natural are brushed (at least, in Barenreiter SCS )
85 %
86 %
87
88 fet_beginchar( "Natural", "0", "natural")
89         save height;    
90         save interbeam, interstem, beamheight, beamwidth, 
91         stemwidth;
92         save top_stem_thick;
93
94         beamheight# = 4.0 stafflinethickness#;
95         height# = 1.5 staff_space#;
96         set_char_box(0, 2/3 staff_space#, height#, height#);
97
98         define_pixels(height);
99         define_blacker_pixels(beamheight);
100
101         % perhaps we should have a lowres fix?
102         top_stem_thick = 1.9 stafflinethickness;
103
104         interstem + stemwidth =  w;
105         stemwidth = 1.3 stafflinethickness;
106
107         z2 -z1 = (interstem, slope * interstem);
108         xpart .5 [z2,z1] = xcenter ;
109         xcenter = w/2;
110
111
112         pickup penrazor scaled beamheight rotated 90;
113         top y2 = staff_space - 3/2 stafflinethickness ;
114         slope =  stafflinethickness / interstem;
115         
116         draw z1 .. z2;
117         draw (xpart z1, -y2) .. (xpart z2, -y1);
118         beamtop = top y2;
119
120         pickup pencircle scaled stemwidth;
121         x3 := round (xpart z1);
122         x4 := round (xpart z2);
123
124         penpos3(top_stem_thick, 0);
125         penpos5(top_stem_thick, 0);     
126         penpos4(stemwidth, 0);
127         penpos6(stemwidth, 0);  
128         
129         y3 = height;
130         top y4 = beamtop;
131
132         x5 = x4;
133         x6 = x3;
134         bot y6 = -beamtop;
135         y5 = - height;
136
137         fill simple_serif (z3l, z3r, -30) -- simple_serif(z6r, z6l, -90) -- cycle;
138         fill simple_serif (z5l, z5r, 30) -- simple_serif(z4r, z4l, 90) -- cycle;
139
140
141
142         penlabels(3,4,5,6);
143
144         labels(1,2);
145         fet_endchar;
146
147
148 %
149 % Dedicated to my mom.    (3/10/97)
150 %
151 % Mamma, ik hou van je; kom je alsjeblieft terug? 
152 %    -- HW
153 %
154
155 % TODO: remove crook_fatness
156 def draw_meta_flat(expr xcenter, w, crook_fatness) =
157         clearxy;
158         save crook_thinness;
159         save top_stem_thick, bottom_stem_thick, hair;
160         save center;
161         pair center;
162         center = (xcenter, 0);
163
164         crook_thinness = 1.25 stafflinethickness;
165         top_stem_thick = 2 stafflinethickness;
166         bottom_stem_thick = 1.2 stafflinethickness;
167
168
169         z1 = (0, 2 staff_space) + center;
170         z2 = (0, - 1/2 staff_space)+  center;
171
172         penpos1(top_stem_thick, 0);
173         penpos2(bottom_stem_thick, 0); 
174
175         fill simple_serif(z1r, z1l, 30) -- z2l -- z2r -- cycle;
176
177
178         y3l = (staff_space - stafflinethickness)/2 + ypart center;
179         z3l = whatever [z2r,z1r];
180
181         z3r = .26 [z2r, z1r];
182
183
184         z4 = (3/8 staff_space, staff_space/2) + center;
185         penpos4(whatever, 53);
186         y4l - y4r = 2 crook_thinness ;
187 %       y4l - y4r = 6/20[crook_thinness, crook_fatness] ;
188
189         y5r = 1/4 staff_space + ypart center;
190         x5l = w + xpart center;
191         penpos5(crook_fatness, -175);
192
193         z8 = (0, - staff_space/2 - stafflinethickness/2) + center;
194
195         z9 = (x5,0);
196
197         save ne_angle;
198         ne_angle = angle(z9 - z8);
199
200         z7 = 8/33 [z8,z9];
201         z6l = 18/33 [z8,z9] + .5 crook_thinness *dir(ne_angle -90);
202   
203         penpos7(crook_thinness, ne_angle + 90);
204
205         z6r = .3 (z9-z8) + z7r;
206
207 %       penpos7(crook_thinness, angle(dir(z8-center) -180);
208
209         penpos8(whatever, ne_angle + 90);
210         x8r =  xpart center - bottom_stem_thick/2;
211         penlabels(range 0 thru 10);
212
213         y10 = -1/5 staff_space;
214         z10 = whatever [z2r, z1r];
215
216         unfill z3r .. z4r{right} .. tension .9 
217                 .. z6r ---
218                 z7r{left}
219                 .. z10  -- cycle;
220         fill z8r{down}
221                 .. tension 0.8 ..z8l{(z9-z8)}
222                 .. z7l
223                 .. z6l
224                 .. z5l{up}
225                 .. z4l{left} .. z3l -- cycle;
226                 
227         labels(10);
228 enddef;
229
230         
231 %
232 % unfortunately, 600dpi is not enough to show the brush of the stem.
233 %
234 fet_beginchar("Flat", "-1", "flat")
235         set_char_box(1.2 stafflinethickness#, .8 staff_space#, .5 staff_space#, 2 staff_space#);
236         draw_meta_flat(0, w, 1/3 staff_space);
237         fet_endchar;
238
239
240 fet_beginchar("Double Flat", "-2", "flatflat")
241         save left_wid, overlap, right_wid;
242         left_wid = .7;
243         right_wid = .8;
244         overlap = .05;
245         set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .5 staff_space#, 2 staff_space#);
246         draw_meta_flat(0, left_wid*  staff_space, 1/3 staff_space);
247         draw_meta_flat((left_wid - overlap) *staff_space,  
248                 right_wid *staff_space, 1/3 staff_space);
249         fet_endchar;
250
251 fet_beginchar("Double Sharp", "2", "sharpsharp")
252         set_char_box(0, staff_space#, .5 staff_space#, .5 staff_space#);
253         save klaverblad, klaversteel;
254
255         klaversteel = 1/15 staff_space;
256         klaverblad = .35 staff_space;
257
258         z1 = (klaversteel, 0);
259         z2 = (w/2 - klaverblad / 10, h - klaverblad);
260         z3 = (w/2, h);
261         z4 = z2 reflectedabout((0,0), (1,1));
262         z5 = z1 reflectedabout((0,0), (1,1));
263
264         labels(1,2,3,4,5);
265         pickup pencircle scaled 1/20 staff_space;
266         filldraw  
267                 z1{dir 45} .. {right}z2 -- z3 -- 
268                 z4{down} .. {dir 225}z5 .. cycle;
269         
270
271         addto currentpicture also currentpicture yscaled (-d/h);
272         addto currentpicture also currentpicture xscaled (-1);
273
274         % ugh
275         currentpicture := currentpicture  shifted (w/2,0);
276
277
278
279 fet_endchar;
280
281
282 def draw_paren =
283         save leftindent;
284         leftindent# := .2 staff_space#;
285         define_pixels(leftindent);
286         set_char_box(0, .5 staff_space#+stafflinethickness#,
287           staff_space#, staff_space#);
288         z1 = (leftindent,h);
289         z2 = (w-stafflinethickness,0);
290         z3 = (leftindent,-d);
291
292         penpos1(stafflinethickness, 35);
293         penpos2(2 stafflinethickness, 0);
294         penpos3(stafflinethickness, -35);
295
296         penlabels(1,2,3);
297         fill z2l{down} .. simple_serif(z3l, z3r, 90) .. z2r{up}
298         .. simple_serif(z1r, z1l, 90) .. z2l{down} -- cycle;
299 enddef;
300   
301 fet_beginchar("Right Parenthesis", ")", "rightparen")
302         draw_paren;
303 fet_endchar;
304
305 fet_beginchar("Left Parenthesis", "(", "leftparen")
306         draw_paren;
307         currentpicture := currentpicture xscaled -1;
308         set_char_box(charwd, charbp, chardp, charht);
309 fet_endchar;
310
311 fet_endgroup("accidentals");
312