]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-slag.mf
Prepare glyph shapes for mf2pt1 conversion.
[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--2004 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_thick# = 1/2 staff_space#;
14 trill_width# = 5/12 staff_space#;
15 trill_height# = 1/2 staff_space#;
16 trill_overlap# = 1/6 staff_space#;
17
18 pair trill_ne;
19 trill_ne := unitvector ((2, 3));
20
21 define_pixels (trill_thick, trill_thin,
22                trill_width, trill_overlap, trill_height);
23
24
25 %
26 % The trill element sticks out on both the left and right side
27 % of the normal bbox, so you can glue them together easily.
28 %
29
30 def draw_trillelement (expr offset) =
31         clearxy;
32
33 begingroup;
34         save nw, p;
35         pair nw;
36         path p;
37
38         pickup pencircle scaled trill_thin;
39
40         x1 = -trill_width;
41         y1 = 0;
42         z3 = whatever * trill_ne + z1;
43         top y3 = trill_height;
44         z2 = z3 - (trill_thick - trill_thin) * trill_ne;
45
46         z4 = z1 - trill_ne * trill_overlap;
47         x5 = x2;
48         y5 = 0;
49
50         z3' = z3 scaled -1;
51         z5' = z5 scaled -1;
52
53         nw := unitvector (z2 - z3');
54
55         path p;
56         p := z5
57              --- (z4 - 0.5 trill_thin * nw)
58              .. bot z4
59              .. lft z4
60              .. (z4 + 0.5 trill_thin * nw)
61              --- (z3 + 0.5 trill_thin * nw)
62              .. top z3
63              .. (z3 + 0.5 trill_thin * trill_ne)
64              --- z5';
65         p := p
66              & p scaled -1
67              & cycle;
68         p := p shifted (offset, 0);
69         fill p;
70 endgroup;
71 enddef;
72
73
74 fet_beginchar ("trilelement", "trilelement")
75         set_char_box (trill_width#, trill_width#,
76                       trill_height#, trill_height#);
77
78         draw_trillelement (0);
79         labels (1, 2, 3, 3', 4, 5, 5');
80 fet_endchar;
81
82
83 fet_beginchar ("prall", "prall")
84         set_char_box (2 trill_width#, 2 trill_width#,
85                       trill_height#, trill_height#);
86
87         draw_trillelement (-trill_width);
88         draw_trillelement (trill_width);
89 fet_endchar;
90
91
92 fet_beginchar ("mordent", "mordent")
93         set_char_box (2 trill_width#, 2 trill_width#,
94                       4/3 trill_height#, 4/3 trill_height#);
95
96         draw_trillelement (-trill_width);
97         draw_trillelement (trill_width);
98
99         clearxy;
100         pickup pencircle scaled trill_thin;
101
102         top y1 = h;
103         bot y2 = -d;
104         x1 = x2;
105         x2 = 0;
106
107         draw_gridline (z2, z1, trill_thin);
108
109         labels (1, 2);
110 fet_endchar;
111
112
113 fet_beginchar ("prallprall", "prallprall")
114         set_char_box (3 trill_width#, 3 trill_width#,
115                       trill_height#, trill_height#);
116
117         draw_trillelement (-2 trill_width);
118         draw_trillelement (0);
119         draw_trillelement (2 trill_width);
120 fet_endchar;
121
122
123 fet_beginchar ("prallmordent", "prallmordent")
124         set_char_box (3 trill_width#, 3 trill_width#,
125                       4/3 trill_height#, 4/3 trill_height#);
126         draw_trillelement (-2 trill_width);
127         draw_trillelement (0);
128         draw_trillelement (2 trill_width);
129
130         clearxy;
131         pickup pencircle scaled trill_thin;
132
133         top y1 = h;
134         bot y2 = -d;
135         x1 = x2 ;
136         x2 = trill_width;
137
138         draw_gridline (z2, z1, trill_thin);
139
140         labels (1, 2);
141 fet_endchar;
142
143
144 save remember_pic;
145 picture remember_pic;
146
147
148 fet_beginchar ("upprall", "upprall")
149         set_char_box (3 trill_width#, 3 trill_width#,
150                       trill_height#, trill_height#);
151         draw_trillelement (-2 trill_width);
152         draw_trillelement (0);
153         draw_trillelement (2 trill_width);
154
155         clearxy;
156
157         z1 = (-b, 0) - trill_overlap * trill_ne;
158         z2 = z1 + (0, -2 trill_height);
159
160         penpos1 (trill_thin, angle (trill_ne) - 90);
161         penpos2 (trill_thin, angle (trill_ne yscaled -1) + 90);
162         penlabels (1, 2);
163
164         pickup pencircle scaled trill_thin;
165
166         fill z1l{-trill_ne}
167              .. z2l{trill_ne yscaled -1}
168              .. bot z2
169              .. rt z2
170              .. z2r{-trill_ne yscaled -1}
171              .. z1r{trill_ne}
172              -- cycle;
173
174         remember_pic := currentpicture;
175 fet_endchar;
176
177
178 fet_beginchar ("upmordent", "upmordent")
179         set_char_box (3 trill_width#, 3 trill_width#,
180                       4/3 trill_height#, 4/3 trill_height#);
181
182         currentpicture := remember_pic;
183
184         clearxy;
185         pickup pencircle scaled trill_thin;
186
187         top y1 = h;
188         bot y2 = -d;
189         x1 = x2 ;
190         x2 = trill_width;
191
192         draw_gridline (z2, z1, trill_thin);
193
194         labels (1, 2);
195 fet_endchar;
196
197
198 fet_beginchar ("pralldown", "pralldown")
199         set_char_box (3 trill_width#, 3 trill_width#,
200                       trill_height#, trill_height#);
201
202         currentpicture := remember_pic xscaled -1;
203 fet_endchar;
204
205
206 fet_beginchar ("downprall", "downprall")
207         set_char_box (3 trill_width#, 3 trill_width#,
208                       trill_height#, trill_height#);
209
210         remember_pic := currentpicture;
211
212         draw_trillelement (-2 trill_width);
213         draw_trillelement (0);
214         draw_trillelement (2 trill_width);
215
216         clearxy;
217         z1 = (-b, 0) - trill_overlap * trill_ne;
218         z2 = z1 + (0, 2 trill_height);
219
220         penpos1 (trill_thin, angle (trill_ne xscaled -1) - 90);
221         penpos2 (trill_thin, angle (trill_ne) - 90);
222         penlabels (1, 2);
223
224         pickup pencircle scaled trill_thin;
225
226         fill z1l{trill_ne xscaled -1}
227              .. z2l{trill_ne}
228              .. top z2
229              .. rt z2
230              .. z2r{-trill_ne}
231              .. z1r{-trill_ne xscaled -1}
232              -- cycle;
233
234         remember_pic := currentpicture;
235 fet_endchar;
236
237
238 fet_beginchar ("downmordent", "downmordent")
239         set_char_box (3 trill_width#, 3 trill_width#,
240                       4/3 trill_height#, 4/3 trill_height#);
241
242         currentpicture := remember_pic;
243
244         clearxy;
245         pickup pencircle scaled trill_thin;
246
247         top y1 = h;
248         bot y2 = -d;
249         x1 = x2 ;
250         x2 = trill_width;
251
252         draw_gridline (z2, z1, trill_thin);
253
254         labels (1, 2);
255 fet_endchar;
256
257
258 fet_beginchar ("prallup", "prallup")
259         set_char_box (3 trill_width#, 3 trill_width#,
260                       trill_height#, trill_height#);
261
262         currentpicture := remember_pic xscaled -1;
263 fet_endchar;
264
265
266 fet_beginchar ("lineprall", "lineprall")
267         set_char_box (3 trill_width#, 3 trill_width#,
268                       trill_height#, 4 trill_height#);
269
270         remember_pic := currentpicture;
271
272         draw_trillelement (-2 trill_width);
273         draw_trillelement (0);
274         draw_trillelement (2 trill_width);
275
276         clearxy;
277         z1 = (-b, 0) - trill_overlap * trill_ne ;
278         z2 = z1 + (0, h);
279
280         labels (1, 2);
281
282         draw_gridline (z1, z2, trill_thin);
283 fet_endchar;