]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-accordion.mf
patch::: 1.3.43.jcn1
[lilypond.git] / mf / feta-accordion.mf
1 % -*- Fundamental -*-
2
3 fet_begingroup("accordion")
4
5 accreg_dot_size# := .5staff_space#;
6 accreg_linethickness# := 1.3stafflinethickness#;
7
8 % This dimention is the same on all registersymbols.
9 % The different symbols should calculate their other
10 % dimensions from this and accreg_dot_size
11 accreg_lh# := 1.0staff_space#;
12
13 define_pixels(accreg_dot_size, accreg_linethickness, accreg_lh);
14 pen accreg_pen;
15 accreg_pen := pencircle xscaled accreg_linethickness yscaled 0.7accreg_linethickness;
16
17 fet_beginchar("accDiscant", "accDiscant", "accDiscant")
18         save r, sx;
19         r# = 3/2accreg_lh#;
20         define_pixels(r);
21 %       set_char_box(r#, r#, 2r#, 0);
22         set_char_box(r#, r#, 0r#, 2r#); %% arg3 = under linjen, arg4 = over
23         pickup accreg_pen;
24         draw fullcircle scaled 2r;
25         sx = cosd(19.471221);
26         draw (-sx*r, r/3)--(sx*r, r/3);
27         draw (-sx*r, -r/3)--(sx*r, -r/3);
28         currentpicture := currentpicture shifted (0, r);
29 fet_endchar;
30
31 fet_beginchar("accDot", "accDot", "accDot")
32         set_char_box(accreg_dot_size#, accreg_dot_size#, 0, 0);
33         pickup pencircle scaled accreg_dot_size;
34         draw(0, 0);
35 fet_endchar;
36
37 fet_beginchar("accFreebase", "accFreebase", "accFreebase")
38         save r;
39         r#= accreg_lh#;
40         define_pixels(r);
41         set_char_box(r#, r#, 0, 2r#);
42         pickup accreg_pen;
43         draw fullcircle scaled 2r;
44         draw (-r, 0)--(r, 0);
45         currentpicture := currentpicture shifted (0, r);
46 fet_endchar;
47
48 fet_beginchar("accStdbase", "accStdbase", "accStdbase")
49         save r, sx;
50         r# = 2accreg_lh#;
51         define_pixels(r);
52         sx = cosd 30 ;
53         set_char_box(r#, r#, 0, 2r#);
54         pickup accreg_pen;
55         draw fullcircle scaled 2r;
56         draw (-r, 0)--(r, 0);
57         draw (-sx*r, r/2)--(sx*r, r/2);
58         draw (-sx*r, -r/2)--(sx*r, -r/2);
59         currentpicture := currentpicture shifted (0, r);
60 fet_endchar;
61
62 %%% strange turning path.
63 fet_beginchar("accBayanbase", "accBayanbase", "accBayanbase")
64         save lh;
65         lh = accreg_lh;
66 %       set_char_box(accreg_lh#, accreg_lh#, 3accreg_lh#, 0);
67         set_char_box(accreg_lh#, accreg_lh#, 0, 3accreg_lh#);
68         pickup pencircle scaled accreg_linethickness;
69         %draw (0, 0)--(2w, 0)--(2w, 3accreg_lh)--(0, 3accreg_lh)--(0, 0);
70         draw (0, 0)--(2w, 0)--(2w, 3accreg_lh)--(0, 3accreg_lh)--cycle;
71         draw (0, accreg_lh)--(2w, accreg_lh);
72         draw (0, 2accreg_lh)--(2w, 2accreg_lh);
73         currentpicture := currentpicture shifted (-w, 0);% -3lh);
74 fet_endchar;
75
76 def def_B(expr w, h) = 
77         % huh?
78         % pickup pencircle scaled 0.1pt;
79         pickup pencircle scaled 0.15stafflinethickness;
80         penpos10(thin, -90);
81         penpos11(thin, -90);
82         penpos12(thick, 0);
83         penpos13(thin, 90);
84         penpos14(thin, 90);
85
86         penpos15(thick, 180);
87         penpos16(thin, -90);
88         penpos17(thin, -90);
89         penpos18(thick, 0);
90         penpos19(thick, 0);
91         z10 = (0, 0);
92         z11 = (cOne*w, 0);
93         z12 = (w, .5mb*h);
94         z13 = (cTwo*w, mb*h);
95         z14 = (2thick, mb*h);
96         z15 = (.94w, h-.5mt*h);
97         z16 = z13 + (0, mt*h);
98         z17 = (0, h);
99         z18 = (1.5thick, 0);
100         z19 = (1.5thick, h);
101 enddef;
102
103 def def_S(expr w, h) =
104         % huh?
105         %pickup pencircle scaled 0.02pt;
106         pickup pencircle scaled 0.03stafflinethickness;
107         penpos1(thin, 180);
108         penpos2(thin, -90);
109         penpos3(thick, 0);
110         penpos4(.5thick, 90);
111         penpos5(thick, 0);
112         penpos6(thin, -90);
113         penpos7(thin, 180);
114         penpos8(thin, 180);
115         penpos9(thin, 0);
116         z1 = (0, hs);
117         z2 = (w/2, 0);
118         z3 = (w-.5thick, .5mb*h);
119         z4 = (w/2, mb*h);
120         z5 = (.5thick, h-.5mt*h);
121         z6 = (w/2, h);
122         z7 = (w, h-hs);
123         z8 = (0, y2r);
124         z9 = (w, y6l);
125         path bue, bueoverst;
126         bue=z2{left}..z1{up};
127         numeric t;
128         t:=xpart(bue intersectiontimes(z8l--z7l));
129         show t;
130         bueoverst=z6{right}..z7{down};
131 enddef;
132
133 def def_some_vars =
134         save hs, mb, mt, thin, thick, height, width, cOne, cTwo;
135         width = .8staffsize;
136         height = 2.4staff_space;
137         % URG.  smaller sizes should be wider and fatter
138         %thin = 0.05staff_space;
139         %thick = 0.2staff_space;
140         save bx,hx; 4hx+bx=1.15; 10hx+bx=1;
141         fatten:=designsize*hx+bx*1.2;
142         thick:= 0.2staff_space*fatten;
143         % urg: mustn't ever go thinner than blot!
144         thin#:= blot_diameter#;
145         define_pixels (thin);
146
147         hs = 0.4staff_space;
148         mb = .53;
149         mt = .47;       
150         cOne = 0.65;
151         cTwo = 0.60;
152 enddef;
153
154 def print_penpos (suffix $)=
155         message "z"&str $ &"l = ("&decimal x.$.l&", "&decimal y.$.l&"); z"&str $ &"r = ("&decimal x.$.r&", "&decimal y.$.r&");";
156 enddef;
157
158 %fet_beginchar("accTEST", "accTEST", "accTEST")
159 %       set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
160 %       def_some_vars;
161 %       penlabels(10, 11, 12, 13, 14);
162 %       penstroke z10e--z11e{right}..z12e..z13e{left}--z14e;
163 %fet_endchar;
164
165 fet_beginchar("accSB", "accSB", "accSB")
166         set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
167         def_some_vars;
168         def_B(.35width, .7height);
169
170         %print_penpos (10);
171         %print_penpos (11);
172         %print_penpos (12);
173         %print_penpos (13);
174         %print_penpos (14);
175         penlabels(10, 11, 12, 13, 14);
176         penstroke z10e--z11e{right}..z12e..z13e{left}--z14e;
177
178         penstroke z13e{right}..z15e{up}..z16e{left}--z17e;
179         penstroke z18e--z19e;
180         pickup pencircle scaled .5thick;
181         drawdot (.37width, .10thick);
182         currentpicture := currentpicture shifted(.40width, 0);
183
184         def_S(.35width, .7height);
185         penlabels(1, 2, 3, 4, 5, 6, 7, 8, 9);
186         filldraw z1r--z8r--z8l--subpath(t, 1) of bue--cycle;
187         filldraw subpath(t, 1) of bueoverst--z7l--z9r--z9l--cycle;
188         penstroke z1e{down}..z2e{right}..z3e
189                 ..z4e
190                 ..z5e..z6e{right}...z7e{down};
191         pickup pencircle scaled .5thick;
192         drawdot (.37width, .10thick);
193         currentpicture := currentpicture shifted (-.40width, -.85height);
194         draw (-.5width, 0)--(.5width, 0)--(.5width, -height)
195                 --(-.5width, -height)--(-.5width, 0);
196         currentpicture := currentpicture shifted (0, 2.4staff_space);
197 fet_endchar;
198
199 fet_beginchar("accBB", "accBB", "accBB")
200         set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
201         def_some_vars;
202         def_B(.35width, .7height);
203
204         penstroke z10e--z11e{right}..z12e{up}..z13e{left}--z14e;
205
206         penstroke z13e{right}..z15e{up}..z16e{left}--z17e;
207         penstroke z18e--z19e;
208         penlabels(1, 2, 3, 4, 5, 6, 7, 8, 9);
209         pickup pencircle scaled .5thick;
210         drawdot(.37width, .10thick);
211         currentpicture := currentpicture shifted (.40width, 0);
212         penstroke z10e--z11e{right}..z12e{up}..z13e{left}--z14e;
213         penstroke z13e{right}..z15e{up}..z16e{left}--z17e;
214         penstroke z18e--z19e;
215         drawdot(.37width, .10thick);
216         currentpicture := currentpicture shifted(-.40width, -.85height);
217         draw (-.5width, 0)--(.5width, 0)--(.5width, -height)
218                 --(-.5width, -height)--(-.5width, 0);
219         penlabels(10, 11, 12, 13, 14, 15, 16, 17, 18, 19 );
220         currentpicture := currentpicture shifted (0, 2.4staff_space);
221 fet_endchar;
222
223
224 %%% strange turning path.
225 fet_beginchar("accOldEE", "accOldEE", "accOldEE")
226         set_char_box(staff_space#, staff_space#, 0, 2staff_space#);
227         show w;
228         show h;
229         r = staff_space;
230         lr = .3staff_space;
231         ir = .6staff_space;
232         pickup accreg_pen;
233         draw fullcircle scaled 2r;
234         pickup penrazor;
235         filldraw fullcircle scaled lr;
236         z1 = (ir, 0);
237         z2 = (0, 0) + ir*(dir 45);
238         z3 = (0, ir);
239         numeric pp;
240         for pp := 0 step 45 until 360:
241                 filldraw fullcircle scaled lr shifted (ir*(dir pp));
242         endfor;
243         for pp := 0 step 45 until 360:
244                 filldraw ((0, 0)--(.2lr, ir)--(-.2lr, ir)--cycle) rotated pp;
245         endfor
246         currentpicture := currentpicture shifted (0, r);
247 fet_endchar;
248
249 fet_beginchar("accOldEES", "accOldEES", "accOldEES")
250         set_char_box(staff_space#, staff_space#, 0, 2staff_space#);
251         save r, shy;
252         r = staff_space;
253         shy = .3;
254         pickup accreg_pen;
255         draw fullcircle scaled 2r;
256         currentpicture := currentpicture shifted (w/2, shy*h);
257         save thin, thick, sw, ch, cw, mb, mt;
258         ch = .6h;
259         cw = .8w;
260         % URG.  smaller sizes should be wider and fatter
261         %thin = .05cw;
262         %thick = .17w;
263         save bx,hx; 4hx+bx=1.15; 10hx+bx=1;
264         fatten:=designsize*hx+bx*1.2;
265         thick:= .17w*fatten;
266
267         % urg: mustn't ever go thinner than blot!
268         %thin = 0.05staff_space;
269         %blot#:=.4pt#;
270         thin#:= blot_diameter#;
271         define_pixels (thin);
272
273
274         hs = 0.4staff_space;
275
276         mb = .53; mt = .47;
277         sw = .8thick;
278         z1 = (0, ch-.5thin); penpos1 (thin, -90);
279         z2 = (.7cw, y1); penpos2 (thin, -90);
280         z3 = (cw, (mb+.5mt)*ch); penpos3(thick, -180);
281         z4 = (.65cw, mb*ch); penpos4(thin, 90);
282         z5 = (sw+thick, mb*ch); penpos5(thin, 90);
283         z6 = (.9cw, .5mb*ch); penpos6(thick, 0);
284         z7 = (1.2cw, 0); penpos7(thin, 90);
285         z8 = (1.3cw, .2mb*ch); penpos8(thin, 180);
286         penlabels(1, 2, 3, 4, 5, 6, 7, 8);
287
288         %%AAARG
289         pickup pencircle scaled 0.001pt;
290         filldraw (0, 0)--(0, thin)--(sw, thin)--(sw, ch-thin)
291                 --(sw+thick, ch-thin)--(sw+thick, thin)
292                 --(2sw+thick, thin)--(2sw+thick, 0)--cycle;
293
294         penstroke z1e--z2e{right}..z3e..z4e{left}--z5e;
295
296         penstroke z4e{right}..z6e{down}..z7e{right}..z8e{up};
297         currentpicture := currentpicture shifted (-w/2, -shy*h);
298         currentpicture := currentpicture shifted (0, r);
299 fet_endchar;
300
301 fet_endgroup("accordion")