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