]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-slag.mf
*** empty log message ***
[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--2005 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
34 def draw_trillelement (expr offset) =
35         clearxy;
36
37 begingroup;
38         save nw, pat, nw_dist, ne_dist;
39         pair nw, nw_dist, ne_dist;
40         path pat;
41
42         pickup pencircle scaled trill_thin;
43
44         x1 = -.5 trill_width;
45         y1 = 0;
46         z3 = whatever * trill_ne + z1;
47         top y3 = vround trill_height;
48         z2 = z3 - (trill_thick - trill_thin) * trill_ne;
49
50         z4 = z1 - trill_ne * trill_overlap;
51         x4 := hround x4;
52
53         bot z3' = (top z3) scaled -1;
54
55         nw = unitvector (z2 - z3');
56         ne_dist = (nw rotated -90) * 0.5 trill_thin;
57         nw_dist = (trill_ne rotated 90) * 0.5 trill_thin;
58
59         z5 = whatever * trill_ne + (z4 - nw_dist);
60         z5 = whatever * nw + (z3' - ne_dist);
61
62         pat := z5
63                -- (z4 - nw_dist){-trill_ne}
64                .. bot z4{left}
65                .. lft z4{up}
66                .. (z4 + nw_dist){trill_ne}
67                -- (z3 + nw_dist){trill_ne}
68                .. top z3{right}
69                .. (z3 + ne_dist){-nw};
70         pat := pat
71                -- pat scaled -1 shifted (-feta_eps, -feta_eps)
72                -- cycle;
73         pat := pat shifted (offset, 0);
74         fill pat;
75 endgroup;
76 enddef;
77
78
79 fet_beginchar ("trilelement", "trilelement");
80         set_char_box (.5 trill_width#, .5 trill_width#,
81                       trill_height#, trill_height#);
82
83         draw_trillelement (0);
84         labels (1, 2, 3, 3', 4, 5, 5');
85 fet_endchar;
86
87
88 fet_beginchar ("prall", "prall");
89         set_char_box (trill_width#, trill_width#,
90                       trill_height#, trill_height#);
91
92         draw_trillelement (-hround (.5 trill_width));
93         draw_trillelement (-hround (.5 trill_width) + trill_width);
94 fet_endchar;
95
96
97 fet_beginchar ("mordent", "mordent");
98         set_char_box (trill_width#, trill_width#,
99                       4/3 trill_height#, 4/3 trill_height#);
100
101         draw_trillelement (-hround (.5 trill_width));
102         draw_trillelement (-hround (.5 trill_width) + trill_width);
103
104         clearxy;
105
106         pickup pencircle scaled trill_stemwidth;
107
108         top y1 = h;
109         bot y2 = -d;
110         x1 = x2;
111         x2 = 0;
112
113         draw_gridline (z2, z1, trill_stemwidth);
114
115         labels (1, 2);
116 fet_endchar;
117
118
119 fet_beginchar ("prallprall", "prallprall");
120         set_char_box (1.5 trill_width#, 1.5 trill_width#,
121                       trill_height#, trill_height#);
122
123         draw_trillelement (-trill_width);
124         draw_trillelement (0);
125         draw_trillelement (trill_width);
126 fet_endchar;
127
128
129 fet_beginchar ("prallmordent", "prallmordent");
130         set_char_box (1.5 trill_width#, 1.5 trill_width#,
131                       4/3 trill_height#, 4/3 trill_height#);
132
133         draw_trillelement (-trill_width);
134         draw_trillelement (0);
135         draw_trillelement (trill_width);
136
137         clearxy;
138
139         pickup pencircle scaled trill_stemwidth;
140
141         top y1 = h;
142         bot y2 = -d;
143         x1 = x2 ;
144         x2 = good.x (.5 trill_width);
145
146         draw_gridline (z2, z1, trill_stemwidth);
147
148         labels (1, 2);
149 fet_endchar;
150
151
152 save remember_pic;
153 picture remember_pic;
154
155
156 fet_beginchar ("upprall", "upprall");
157         set_char_box (1.5 trill_width#, 1.5 trill_width#,
158                       trill_height#, trill_height#);
159
160         draw_trillelement (-trill_width);
161         draw_trillelement (0);
162         draw_trillelement (trill_width);
163
164         z11 = z4 shifted (-trill_width, 0);
165         z12 = z11 + (0, -2 trill_height);
166
167         penpos11 (trill_thin, angle (trill_ne) - 90);
168         penpos12 (trill_thin, angle (trill_ne yscaled -1) + 90);
169         penlabels (11, 12);
170
171         pickup pencircle scaled trill_stemwidth;
172
173         fill z11l{-trill_ne}
174              .. z12l{trill_ne yscaled -1}
175              .. bot z12
176              .. rt z12
177              .. z12r{-trill_ne yscaled -1}
178              .. z11r{trill_ne}
179              -- cycle;
180
181         remember_pic := currentpicture;
182 fet_endchar;
183
184
185 fet_beginchar ("upmordent", "upmordent");
186         set_char_box (1.5 trill_width#, 1.5 trill_width#,
187                       4/3 trill_height#, 4/3 trill_height#);
188
189         currentpicture := remember_pic;
190
191         clearxy;
192
193         pickup pencircle scaled trill_stemwidth;
194
195         top y1 = h;
196         bot y2 = -d;
197         x1 = x2;
198         x2 = good.x (.5 trill_width);
199
200         draw_gridline (z2, z1, trill_stemwidth);
201
202         labels (1, 2);
203 fet_endchar;
204
205
206 fet_beginchar ("pralldown", "pralldown");
207         set_char_box (1.5 trill_width#, 1.5 trill_width#,
208                       trill_height#, trill_height#);
209
210         currentpicture := remember_pic xscaled -1;
211 fet_endchar;
212
213
214 fet_beginchar ("downprall", "downprall");
215         set_char_box (1.5 trill_width#, 1.5 trill_width#,
216                       trill_height#, trill_height#);
217
218         draw_trillelement (-trill_width);
219         draw_trillelement (0);
220         draw_trillelement (trill_width);
221
222         z11 = z4 shifted (-trill_width, 0);
223         z12 = z11 + (0, 2 trill_height);
224
225         penpos11 (trill_thin, angle (trill_ne xscaled -1) - 90);
226         penpos12 (trill_thin, angle (trill_ne) - 90);
227         penlabels (11, 12);
228
229         pickup pencircle scaled trill_stemwidth;
230
231         fill z11l{trill_ne xscaled -1}
232              .. z12l{trill_ne}
233              .. top z12
234              .. rt z12
235              .. z12r{-trill_ne}
236              .. z11r{-trill_ne xscaled -1}
237              -- cycle;
238
239         remember_pic := currentpicture;
240 fet_endchar;
241
242
243 fet_beginchar ("downmordent", "downmordent");
244         set_char_box (1.5 trill_width#, 1.5 trill_width#,
245                       4/3 trill_height#, 4/3 trill_height#);
246
247         currentpicture := remember_pic;
248
249         clearxy;
250
251         pickup pencircle scaled trill_stemwidth;
252
253         top y1 = h;
254         bot y2 = -d;
255         x1 = x2;
256         x2 = good.x (.5 trill_width);
257
258         draw_gridline (z2, z1, trill_stemwidth);
259
260         labels (1, 2);
261 fet_endchar;
262
263
264 fet_beginchar ("prallup", "prallup");
265         set_char_box (1.5 trill_width#, 1.5 trill_width#,
266                       trill_height#, trill_height#);
267
268         currentpicture := remember_pic xscaled -1;
269 fet_endchar;
270
271
272 fet_beginchar ("lineprall", "lineprall");
273         set_char_box (1.5 trill_width#, 1.5 trill_width#,
274                       trill_height#, 4 trill_height#);
275
276         draw_trillelement (-trill_width);
277
278         labels (1, 2, 3, 3', 4, 5, 5');
279
280         pickup pencircle scaled trill_stemwidth;
281
282         lft x10 = x4 - .5 trill_thin - trill_width;
283         y10 = y4;
284         z11 = z10 + (0, h);
285
286         labels (10, 11);
287
288         draw_gridline (z10, z11, trill_stemwidth);
289
290         draw_trillelement (0);
291         draw_trillelement (trill_width);
292 fet_endchar;