]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-slag.mf
Run `make grand-replace'.
[lilypond.git] / mf / feta-slag.mf
1 % -*- Fundamental -*-  (emacs-20 mf mode sucks)
2 % feta-slag.mf --  implement trill symbols
3 %
4 % source file of the Feta (definitely not an abbreviation for Font-En-Tja)
5 % music font
6 %
7 % (c) 1998--2008 Jan Nieuwenhuizen <janneke@gnu.org>
8 %
9
10 % this file is included by feta-scripts.mf
11
12 trill_thin# = 0.1 staff_space# + 0.6 stafflinethickness#;
13 trill_stemwidth# = trill_thin#;
14 define_pixels (trill_thin);
15 define_whole_blacker_pixels (trill_stemwidth);
16
17 trill_thick = 1/2 staff_space;
18 trill_overlap = 1/6 staff_space;
19
20 trill_width# = 5/6 staff_space#;
21 trill_height# = 1/2 staff_space#;
22 define_pixels (trill_height);
23 define_whole_pixels (trill_width);
24
25 pair trill_ne;
26 trill_ne := unitvector ((2, 3));
27
28
29 %
30 % The trill element sticks out on both the left and right side
31 % of the normal bbox, so you can glue them together easily.
32 %
33 % `ending' is either 0 for none, 1 for left, or 2 for right.
34 %
35
36 def draw_trillelement (expr offset, ending) =
37         clearxy;
38
39 begingroup;
40         save nw, pat, nw_dist, ne_dist;
41         pair nw, nw_dist, ne_dist;
42         path pat;
43
44         pickup pencircle scaled trill_thin;
45
46         x1 = -.5 trill_width;
47         y1 = 0;
48         z3 = whatever * trill_ne + z1;
49         top y3 = vround trill_height;
50         z2 = z3 - (trill_thick - trill_thin) * trill_ne;
51
52         bot z3' = (top z3) scaled -1;
53
54         nw = unitvector (z2 - z3');
55         ne_dist = (nw rotated -90) * 0.5 trill_thin;
56         nw_dist = (trill_ne rotated 90) * 0.5 trill_thin;
57
58         z5 = whatever * trill_ne + (z1 - nw_dist);
59         z5 = whatever * nw + (z3' - ne_dist);
60
61         pat := z5
62                -- (z1 - nw_dist){-trill_ne}
63                -- (z1 + nw_dist){trill_ne}
64                -- (z3 + nw_dist){trill_ne}
65                .. top z3{right}
66                .. (z3 + ne_dist){-nw};
67         pat := pat
68                -- pat scaled -1 shifted (-feta_eps, -feta_eps)
69                -- cycle;
70         pat := pat shifted (offset, 0);
71         fill pat;
72
73         z4 = z1 - trill_ne * trill_overlap;
74         x4 := hround (x4 + 0.5 trill_thin) - 0.5 trill_thin;
75
76         pat := (z4 - nw_dist){-trill_ne}
77                .. bot z4{left}
78                .. lft z4{up}
79                .. (z4 + nw_dist){trill_ne}
80                -- (z1 + nw_dist){trill_ne}
81                -- (z1 - nw_dist){-trill_ne}
82                -- cycle;
83
84         if ending = 1:
85                 fill pat shifted (offset, 0);
86         elseif ending = 2:
87                 pat := pat scaled -1 shifted (-feta_eps, -feta_eps);
88                 fill pat shifted (offset, 0);
89         fi;
90 endgroup;
91 enddef;
92
93
94 fet_beginchar ("trilelement", "trilelement");
95         set_char_box (.5 trill_width#, .5 trill_width#,
96                       trill_height#, trill_height#);
97
98         draw_trillelement (0, 0);
99         labels (1, 2, 3, 3', 4, 5, 5');
100 fet_endchar;
101
102
103 fet_beginchar ("prall", "prall");
104         set_char_box (trill_width#, trill_width#,
105                       trill_height#, trill_height#);
106
107         draw_trillelement (-hround (.5 trill_width), 1);
108         draw_trillelement (-hround (.5 trill_width) + trill_width, 2);
109 fet_endchar;
110
111
112 fet_beginchar ("mordent", "mordent");
113         set_char_box (trill_width#, trill_width#,
114                       4/3 trill_height#, 4/3 trill_height#);
115
116         draw_trillelement (-hround (.5 trill_width), 1);
117         draw_trillelement (-hround (.5 trill_width) + trill_width, 2);
118
119         clearxy;
120
121         pickup pencircle scaled trill_stemwidth;
122
123         top y1 = h;
124         bot y2 = -d;
125         x1 = x2;
126         x2 = 0;
127
128         draw_gridline (z2, z1, trill_stemwidth);
129
130         labels (1, 2);
131 fet_endchar;
132
133
134 fet_beginchar ("prallprall", "prallprall");
135         set_char_box (1.5 trill_width#, 1.5 trill_width#,
136                       trill_height#, trill_height#);
137
138         draw_trillelement (-trill_width, 1);
139         draw_trillelement (0, 0);
140         draw_trillelement (trill_width, 2);
141 fet_endchar;
142
143
144 fet_beginchar ("prallmordent", "prallmordent");
145         set_char_box (1.5 trill_width#, 1.5 trill_width#,
146                       4/3 trill_height#, 4/3 trill_height#);
147
148         draw_trillelement (-trill_width, 1);
149         draw_trillelement (0, 0);
150         draw_trillelement (trill_width, 2);
151
152         clearxy;
153
154         pickup pencircle scaled trill_stemwidth;
155
156         top y1 = h;
157         bot y2 = -d;
158         x1 = x2 ;
159         x2 = good.x (.5 trill_width);
160
161         draw_gridline (z2, z1, trill_stemwidth);
162
163         labels (1, 2);
164 fet_endchar;
165
166
167 save remember_pic;
168 picture remember_pic;
169
170
171 fet_beginchar ("upprall", "upprall");
172         set_char_box (1.5 trill_width#, 1.5 trill_width#,
173                       trill_height#, trill_height#);
174
175         draw_trillelement (-trill_width, 1);
176         draw_trillelement (0, 0);
177         draw_trillelement (trill_width, 2);
178
179         z11 = z4 shifted (-trill_width, 0);
180         z12 = z11 + (0, -2 trill_height);
181
182         penpos11 (trill_thin, angle (trill_ne) - 90);
183         penpos12 (trill_thin, angle (trill_ne yscaled -1) + 90);
184         penlabels (11, 12);
185
186         pickup pencircle scaled trill_stemwidth;
187
188         fill z11l{-trill_ne}
189              .. z12l{trill_ne yscaled -1}
190              .. bot z12
191              .. rt z12
192              .. z12r{-trill_ne yscaled -1}
193              .. z11r{trill_ne}
194              -- cycle;
195
196         remember_pic := currentpicture;
197 fet_endchar;
198
199
200 fet_beginchar ("upmordent", "upmordent");
201         set_char_box (1.5 trill_width#, 1.5 trill_width#,
202                       4/3 trill_height#, 4/3 trill_height#);
203
204         currentpicture := remember_pic;
205
206         clearxy;
207
208         pickup pencircle scaled trill_stemwidth;
209
210         top y1 = h;
211         bot y2 = -d;
212         x1 = x2;
213         x2 = good.x (.5 trill_width);
214
215         draw_gridline (z2, z1, trill_stemwidth);
216
217         labels (1, 2);
218 fet_endchar;
219
220
221 fet_beginchar ("pralldown", "pralldown");
222         set_char_box (1.5 trill_width#, 1.5 trill_width#,
223                       trill_height#, trill_height#);
224
225         currentpicture := remember_pic xscaled -1;
226 fet_endchar;
227
228
229 fet_beginchar ("downprall", "downprall");
230         set_char_box (1.5 trill_width#, 1.5 trill_width#,
231                       trill_height#, trill_height#);
232
233         draw_trillelement (-trill_width, 1);
234         draw_trillelement (0, 0);
235         draw_trillelement (trill_width, 2);
236
237         z11 = z4 shifted (-trill_width, 0);
238         z12 = z11 + (0, 2 trill_height);
239
240         penpos11 (trill_thin, angle (trill_ne xscaled -1) - 90);
241         penpos12 (trill_thin, angle (trill_ne) - 90);
242         penlabels (11, 12);
243
244         pickup pencircle scaled trill_stemwidth;
245
246         fill z11l{trill_ne xscaled -1}
247              .. z12l{trill_ne}
248              .. top z12
249              .. rt z12
250              .. z12r{-trill_ne}
251              .. z11r{-trill_ne xscaled -1}
252              -- cycle;
253
254         remember_pic := currentpicture;
255 fet_endchar;
256
257
258 fet_beginchar ("downmordent", "downmordent");
259         set_char_box (1.5 trill_width#, 1.5 trill_width#,
260                       4/3 trill_height#, 4/3 trill_height#);
261
262         currentpicture := remember_pic;
263
264         clearxy;
265
266         pickup pencircle scaled trill_stemwidth;
267
268         top y1 = h;
269         bot y2 = -d;
270         x1 = x2;
271         x2 = good.x (.5 trill_width);
272
273         draw_gridline (z2, z1, trill_stemwidth);
274
275         labels (1, 2);
276 fet_endchar;
277
278
279 fet_beginchar ("prallup", "prallup");
280         set_char_box (1.5 trill_width#, 1.5 trill_width#,
281                       trill_height#, trill_height#);
282
283         currentpicture := remember_pic xscaled -1;
284 fet_endchar;
285
286
287 fet_beginchar ("lineprall", "lineprall");
288         set_char_box (1.5 trill_width#, 1.5 trill_width#,
289                       trill_height#, 4 trill_height#);
290
291         draw_trillelement (-trill_width, 1);
292
293         labels (1, 2, 3, 3', 4, 5, 5');
294
295         pickup pencircle scaled trill_stemwidth;
296
297         penpos10 (trill_stemwidth, 0);
298         penpos11 (trill_stemwidth, 0);
299
300         x10l = x4 - .5 trill_thin - trill_width;
301         y10 = y4;
302         z11 = z10 + (0, h);
303
304         penlabels (10, 11);
305
306         fill z11l
307              .. top z11
308              .. z11r
309              -- z10r
310              -- z10l
311              -- cycle;
312
313         draw_trillelement (0, 0);
314         draw_trillelement (trill_width, 2);
315 fet_endchar;