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