]> git.donarmstrong.com Git - lilypond.git/blob - mf/toevallig.mf
patch::: 0.1.19.jcn1: tik
[lilypond.git] / mf / 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 def flat_meta_symbol(expr w, d, h, 
119          stemwidth, crook_fatness, crook_thinness,
120         bottom_stem_thick, top_stem_thick)=
121
122         z1 = (0, h);
123         z2 = (0, -d);
124         brush(z1, top_stem_thick , z2, bottom_stem_thick);
125         
126         z3 = (0, 7/16 interline);
127         z4 = z3 + whatever * (dir 30);
128         y4 = 1/2 interline ;
129         y5 = 4/16 interline;
130         x5 + crook_fatness/2 = w;
131         z6 = z2 + (0,-1) * (bottom_stem_thick - crook_thinness);
132
133         penpos3(crook_thinness, 90);
134         penpos4(crook_thinness, 90);
135         penpos5(crook_fatness, 0);
136         penpos6(crook_thinness, -90);
137         labels(1,2,3,4,5,6);
138         penstroke z3e{dir 32} .. z4e{dir 30} .. z5e{down} .. {dir 220}z6e;
139         enddef;
140         
141 def flat_symbol (expr w, d, h)=
142         save stemwidth, bottom_stem_thick, top_stem_thick, 
143                 crook_thinness, crook_fatness;
144         stemwidth = stafflinethickness;
145         crook_fatness = 1/4 interline;
146         crook_thinness =  stemwidth;
147         bottom_stem_thick =  5/4 stemwidth;
148         top_stem_thick = 2 stemwidth;
149         flat_meta_symbol(w,d,h, stemwidth, crook_fatness, crook_thinness, 
150                 bottom_stem_thick, top_stem_thick);
151         enddef;
152
153 %
154 % unfortunately, 600dpi is not enough to show the brush of the stem.
155 %
156 fet_beginchar("Flat", "-1", "flat")
157         set_char_box(0, 9/12 interline#, .5 interline#, 2 interline#);
158         flat_symbol (w, d, h);
159         fet_endchar;
160
161 fet_beginchar("Double flat", "-2", "flatflat")
162         set_char_box(0, 18/12 interline#, .5 interline#, 2 interline#);
163         flat_symbol(w/2, d, h);
164         addto currentpicture also currentpicture
165                 shifted (w/2 - stafflinethickness/2,0);
166         fet_endchar;
167         
168
169 fet_beginchar("Double sharp", "2", "sharpsharp")
170         set_char_box(0, interline#, .5 interline#, .5 interline#);
171         save klaverblad, klaversteel;
172
173         klaversteel = 1/12 interline;
174         klaverblad = 1/3 interline;
175
176         z1 = (klaversteel, 0);
177         z2 = (w/2 - klaverblad / 10, h - klaverblad);
178         z3 = (w/2, h);
179         z4 = z2 reflectedabout((0,0), (1,1));
180         z5 = z1 reflectedabout((0,0), (1,1));
181
182         draw_rounded_path(  
183                 z1{dir 45} .. {right}z2 -- z3 -- z4{down} .. {dir 225}z5 .. cycle,
184         1/20 interline);
185
186
187         addto currentpicture also currentpicture rotated 90;
188         addto currentpicture also currentpicture yscaled (-d/h);
189
190         currentpicture := currentpicture  shifted (w/2,0);
191         fet_endchar;
192
193
194 fet_endgroup("accidentals");
195