1 % -*- Fundamental -*- (emacs-20 mf mode sucks)
2 % feta-slag.mf -- implement trill symbols
4 % source file of the Feta (definitely not an abbreviation for Font-En-Tja)
7 % (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
10 % this file is included by feta-scripts.mf
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);
17 trill_thick = 1/2 staff_space;
18 trill_overlap = 1/6 staff_space;
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);
26 trill_ne := unitvector ((2, 3));
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.
33 % `ending' is either 0 for none, 1 for left, or 2 for right.
36 def draw_trillelement (expr offset, ending) =
40 save nw, pat, nw_dist, ne_dist;
41 pair nw, nw_dist, ne_dist;
44 pickup pencircle scaled trill_thin;
48 z3 = whatever * trill_ne + z1;
49 top y3 = vround trill_height;
50 z2 = z3 - (trill_thick - trill_thin) * trill_ne;
52 bot z3' = (top z3) scaled -1;
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;
58 z5 = whatever * trill_ne + (z1 - nw_dist);
59 z5 = whatever * nw + (z3' - ne_dist);
62 -- (z1 - nw_dist){-trill_ne}
63 -- (z1 + nw_dist){trill_ne}
64 -- (z3 + nw_dist){trill_ne}
66 .. (z3 + ne_dist){-nw};
68 -- pat scaled -1 shifted (-feta_eps, -feta_eps)
70 pat := pat shifted (offset, 0);
73 z4 = z1 - trill_ne * trill_overlap;
74 x4 := hround (x4 + 0.5 trill_thin) - 0.5 trill_thin;
76 pat := (z4 - nw_dist){-trill_ne}
79 .. (z4 + nw_dist){trill_ne}
80 -- (z1 + nw_dist){trill_ne}
81 -- (z1 - nw_dist){-trill_ne}
85 fill pat shifted (offset, 0);
87 pat := pat scaled -1 shifted (-feta_eps, -feta_eps);
88 fill pat shifted (offset, 0);
94 fet_beginchar ("trilelement", "trilelement");
95 set_char_box (.5 trill_width#, .5 trill_width#,
96 trill_height#, trill_height#);
98 draw_trillelement (0, 0);
99 labels (1, 2, 3, 3', 4, 5, 5');
103 fet_beginchar ("prall", "prall");
104 set_char_box (trill_width#, trill_width#,
105 trill_height#, trill_height#);
107 draw_trillelement (-hround (.5 trill_width), 1);
108 draw_trillelement (-hround (.5 trill_width) + trill_width, 2);
112 fet_beginchar ("mordent", "mordent");
113 set_char_box (trill_width#, trill_width#,
114 4/3 trill_height#, 4/3 trill_height#);
116 draw_trillelement (-hround (.5 trill_width), 1);
117 draw_trillelement (-hround (.5 trill_width) + trill_width, 2);
121 pickup pencircle scaled trill_stemwidth;
128 draw_gridline (z2, z1, trill_stemwidth);
134 fet_beginchar ("prallprall", "prallprall");
135 set_char_box (1.5 trill_width#, 1.5 trill_width#,
136 trill_height#, trill_height#);
138 draw_trillelement (-trill_width, 1);
139 draw_trillelement (0, 0);
140 draw_trillelement (trill_width, 2);
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#);
148 draw_trillelement (-trill_width, 1);
149 draw_trillelement (0, 0);
150 draw_trillelement (trill_width, 2);
154 pickup pencircle scaled trill_stemwidth;
159 x2 = good.x (.5 trill_width);
161 draw_gridline (z2, z1, trill_stemwidth);
168 picture remember_pic;
171 fet_beginchar ("upprall", "upprall");
172 set_char_box (1.5 trill_width#, 1.5 trill_width#,
173 trill_height#, trill_height#);
175 draw_trillelement (-trill_width, 1);
176 draw_trillelement (0, 0);
177 draw_trillelement (trill_width, 2);
179 z11 = z4 shifted (-trill_width, 0);
180 z12 = z11 + (0, -2 trill_height);
182 penpos11 (trill_thin, angle (trill_ne) - 90);
183 penpos12 (trill_thin, angle (trill_ne yscaled -1) + 90);
186 pickup pencircle scaled trill_stemwidth;
189 .. z12l{trill_ne yscaled -1}
192 .. z12r{-trill_ne yscaled -1}
196 remember_pic := currentpicture;
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#);
204 currentpicture := remember_pic;
208 pickup pencircle scaled trill_stemwidth;
213 x2 = good.x (.5 trill_width);
215 draw_gridline (z2, z1, trill_stemwidth);
221 fet_beginchar ("pralldown", "pralldown");
222 set_char_box (1.5 trill_width#, 1.5 trill_width#,
223 trill_height#, trill_height#);
225 currentpicture := remember_pic xscaled -1;
229 fet_beginchar ("downprall", "downprall");
230 set_char_box (1.5 trill_width#, 1.5 trill_width#,
231 trill_height#, trill_height#);
233 draw_trillelement (-trill_width, 1);
234 draw_trillelement (0, 0);
235 draw_trillelement (trill_width, 2);
237 z11 = z4 shifted (-trill_width, 0);
238 z12 = z11 + (0, 2 trill_height);
240 penpos11 (trill_thin, angle (trill_ne xscaled -1) - 90);
241 penpos12 (trill_thin, angle (trill_ne) - 90);
244 pickup pencircle scaled trill_stemwidth;
246 fill z11l{trill_ne xscaled -1}
251 .. z11r{-trill_ne xscaled -1}
254 remember_pic := currentpicture;
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#);
262 currentpicture := remember_pic;
266 pickup pencircle scaled trill_stemwidth;
271 x2 = good.x (.5 trill_width);
273 draw_gridline (z2, z1, trill_stemwidth);
279 fet_beginchar ("prallup", "prallup");
280 set_char_box (1.5 trill_width#, 1.5 trill_width#,
281 trill_height#, trill_height#);
283 currentpicture := remember_pic xscaled -1;
287 fet_beginchar ("lineprall", "lineprall");
288 set_char_box (1.5 trill_width#, 1.5 trill_width#,
289 trill_height#, 4 trill_height#);
291 draw_trillelement (-trill_width, 1);
293 labels (1, 2, 3, 3', 4, 5, 5');
295 pickup pencircle scaled trill_stemwidth;
297 penpos10 (trill_stemwidth, 0);
298 penpos11 (trill_stemwidth, 0);
300 x10l = x4 - .5 trill_thin - trill_width;
313 draw_trillelement (0, 0);
314 draw_trillelement (trill_width, 2);