lilypond-1.1.63
[lilypond.git] / mf / toevallig.mf
blob69cb6e1e074dfecf5477dbb0dec6396820b94cd2
2 % Accidentals from various sources, notably
4 %   Baerenreiter edition of Schuberts `Auf dem Strom' (sharp, natural, flat)
5 %   F Hofmeister edition of Muellers `Etueden fuer Horn'  (double sharp)
9 %tracingall;
10 %proofing := 2;
11 %\tracingequations:= tracingonline := 1;
13 fet_begingroup("accidentals");
15 fet_beginchar("Sharp" , "1", "sharp");
16         set_char_box(0, 1.1 interline#, 1.5 interline#, 
17                 1.5 interline#);
19         save interbeam, interstem, beamheight, beamwidth, 
20                 stemwidth;
22         interbeam := 1.1 interline;
23         interstem := 7/16 ;
24         beamheight := 4 stafflinethickness;
25         beamwidth := w;
26         stemwidth := 1.3 stafflinethickness;
27         roundness := blot_diameter;
28         pair center;
29         center := (.5 w, 0);
30         
31         roundness + 2 spanwidth = beamwidth;
32         roundness + 2 spanheight = beamheight;
34         2 horizontal_protrusion  + interstem * beamwidth + stemwidth
35                 = beamwidth;
36         
37         z2 - z1 = (beamwidth - roundness, beamheight/2);
38         z1 + z2 = 2*center;
39         beamslope = (y2-y1)/(x2-x1);
41         pair hspan, vspan;
42         hspan = (spanwidth, beamslope * spanwidth);
43         vspan = (0, spanheight);
45         
46         path beam;
47         beam := (hspan + vspan -- -hspan 
48                 +  vspan -- -hspan -vspan -- hspan - vspan -- cycle )
49                 shifted center;
51         draw_rounded_path((beam shifted (0,-interbeam/2)), roundness);
52         draw_rounded_path((beam shifted (0,interbeam/2)), roundness);
54         pickup pencircle scaled stemwidth;
55         x3 = x4 = xpart center;
56         bot y3 = -1.5 interline + ypart center;
57         top y4 = 1.5 interline + ypart center;
59         path stem;
60         stem := z3 .. z4;
61         numeric xs;
62         xs := interstem* beamwidth / 2;
63         draw stem shifted (- xs, - xs* beamslope);
64         draw stem shifted (xs , xs *beamslope);
65         labels(1,2,3,4);
66         fet_endchar;
68 fet_beginchar( "Natural", "0", "natural")
69         set_char_box(0, 8/12 interline#, 1.5 interline#, 1.5 interline#);
71         save interbeam, interstem, beamheight, beamwidth, 
72                 stemwidth;
74         beamheight = 4.5 stafflinethickness;
75         interstem + stemwidth =  w;
76         stemwidth = 1.3 stafflinethickness;
78         z2 -z1 = (interstem, slope * interstem);
79         xpart .5 [z2,z1] = xcenter ;
80         xcenter = w/2;
83         pickup penrazor scaled beamheight rotated 90;
84         top y2 = interline - 3/2 stafflinethickness ;
85         slope =  stafflinethickness / interstem;
86         
87         draw z1 .. z2;
88         draw (xpart z1, -y2) .. (xpart z2, -y1);
89         beamtop = top y2;
90         
91         pickup pencircle scaled stemwidth;
92         xpart z3 = xpart z1;
93         xpart z4 = xpart z2;
94         top y3 = 1.5 interline;
95         top y4 = beamtop;
97         draw (xpart z1, -y4) .. z3;
98         draw (xpart z2, -y3) .. z4;
100         labels(1,2,3,4);
101         fet_endchar;
104 % Dedicated to my mom.    (3/10/97)
106 % Mamma, ik hou van je; kom je alsjeblieft terug? 
107 %    -- HW
111 % FIXME more metaness
112 % FIXME distribution of the crooks' thickness
114 % FIXME probably doesn't look quite right. 
116 def flat_meta_symbol(expr w, d, h, 
117          stemwidth, crook_fatness, crook_thinness,
118         bottom_stem_thick, top_stem_thick)=
120         z1 = (0, h);
121         z2 = (0, -d);
122         brush(z1, top_stem_thick , z2, bottom_stem_thick);
123         
124         z3 = (0, 7/16 interline);
125         z4 = z3 + whatever * (dir 30);
126         y4 = 1/2 interline ;
127         y5 = 4/16 interline;
128         x5 + crook_fatness/2 = w;
129         z6 = z2 + (0,-1) * (bottom_stem_thick - crook_thinness);
131         penpos3(crook_thinness, 90);
132         penpos4(crook_thinness, 90);
133         penpos5(crook_fatness, 0);
134         penpos6(crook_thinness, -90);
135         labels(1,2,3,4,5,6);
136         penstroke z3e{dir 32} .. z4e{dir 30} .. z5e{down} .. {dir 220}z6e;
137         enddef;
138         
139 def flat_symbol (expr w, d, h)=
140         save stemwidth, bottom_stem_thick, top_stem_thick, 
141                 crook_thinness, crook_fatness;
142         stemwidth = stafflinethickness;
143         crook_fatness = 1/4 interline;
144         crook_thinness =  stemwidth;
145         bottom_stem_thick =  5/4 stemwidth;
146         top_stem_thick = 2 stemwidth;
147         flat_meta_symbol(w,d,h, stemwidth, crook_fatness, crook_thinness, 
148                 bottom_stem_thick, top_stem_thick);
149         enddef;
152 % unfortunately, 600dpi is not enough to show the brush of the stem.
154 fet_beginchar("Flat", "-1", "flat")
155         set_char_box(0, 9/12 interline#, .5 interline#, 2 interline#);
156         flat_symbol (w, d, h);
157         fet_endchar;
159 fet_beginchar("Double flat", "-2", "flatflat")
160         set_char_box(0, 18/12 interline#, .5 interline#, 2 interline#);
161         flat_symbol(w/2, d, h);
162         addto currentpicture also currentpicture
163                 shifted (w/2 - stafflinethickness/2,0);
164         fet_endchar;
165         
167 fet_beginchar("Double sharp", "2", "sharpsharp")
168         set_char_box(0, interline#, .5 interline#, .5 interline#);
169         save klaverblad, klaversteel;
171         klaversteel = 1/12 interline;
172         klaverblad = 1/3 interline;
174         z1 = (klaversteel, 0);
175         z2 = (w/2 - klaverblad / 10, h - klaverblad);
176         z3 = (w/2, h);
177         z4 = z2 reflectedabout((0,0), (1,1));
178         z5 = z1 reflectedabout((0,0), (1,1));
180         draw_rounded_path(  
181                 z1{dir 45} .. {right}z2 -- z3 -- z4{down} .. {dir 225}z5 .. cycle,
182         1/20 interline);
185         addto currentpicture also currentpicture rotated 90;
186         addto currentpicture also currentpicture yscaled (-d/h);
188         currentpicture := currentpicture  shifted (w/2,0);
189         fet_endchar;
192 fet_endgroup("accidentals");