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--2005 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.
34 def draw_trillelement (expr offset) =
38 save nw, pat, nw_dist, ne_dist;
39 pair nw, nw_dist, ne_dist;
42 pickup pencircle scaled trill_thin;
46 z3 = whatever * trill_ne + z1;
47 top y3 = vround trill_height;
48 z2 = z3 - (trill_thick - trill_thin) * trill_ne;
50 z4 = z1 - trill_ne * trill_overlap;
53 bot z3' = (top z3) scaled -1;
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;
59 z5 = whatever * trill_ne + (z4 - nw_dist);
60 z5 = whatever * nw + (z3' - ne_dist);
63 -- (z4 - nw_dist){-trill_ne}
66 .. (z4 + nw_dist){trill_ne}
67 -- (z3 + nw_dist){trill_ne}
69 .. (z3 + ne_dist){-nw};
71 -- pat scaled -1 shifted (-feta_eps, -feta_eps)
73 pat := pat shifted (offset, 0);
79 fet_beginchar ("trilelement", "trilelement");
80 set_char_box (.5 trill_width#, .5 trill_width#,
81 trill_height#, trill_height#);
83 draw_trillelement (0);
84 labels (1, 2, 3, 3', 4, 5, 5');
88 fet_beginchar ("prall", "prall");
89 set_char_box (trill_width#, trill_width#,
90 trill_height#, trill_height#);
92 draw_trillelement (-hround (.5 trill_width));
93 draw_trillelement (-hround (.5 trill_width) + trill_width);
97 fet_beginchar ("mordent", "mordent");
98 set_char_box (trill_width#, trill_width#,
99 4/3 trill_height#, 4/3 trill_height#);
101 draw_trillelement (-hround (.5 trill_width));
102 draw_trillelement (-hround (.5 trill_width) + trill_width);
106 pickup pencircle scaled trill_stemwidth;
113 draw_gridline (z2, z1, trill_stemwidth);
119 fet_beginchar ("prallprall", "prallprall");
120 set_char_box (1.5 trill_width#, 1.5 trill_width#,
121 trill_height#, trill_height#);
123 draw_trillelement (-trill_width);
124 draw_trillelement (0);
125 draw_trillelement (trill_width);
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#);
133 draw_trillelement (-trill_width);
134 draw_trillelement (0);
135 draw_trillelement (trill_width);
139 pickup pencircle scaled trill_stemwidth;
144 x2 = good.x (.5 trill_width);
146 draw_gridline (z2, z1, trill_stemwidth);
153 picture remember_pic;
156 fet_beginchar ("upprall", "upprall");
157 set_char_box (1.5 trill_width#, 1.5 trill_width#,
158 trill_height#, trill_height#);
160 draw_trillelement (-trill_width);
161 draw_trillelement (0);
162 draw_trillelement (trill_width);
164 z11 = z4 shifted (-trill_width, 0);
165 z12 = z11 + (0, -2 trill_height);
167 penpos11 (trill_thin, angle (trill_ne) - 90);
168 penpos12 (trill_thin, angle (trill_ne yscaled -1) + 90);
171 pickup pencircle scaled trill_stemwidth;
174 .. z12l{trill_ne yscaled -1}
177 .. z12r{-trill_ne yscaled -1}
181 remember_pic := currentpicture;
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#);
189 currentpicture := remember_pic;
193 pickup pencircle scaled trill_stemwidth;
198 x2 = good.x (.5 trill_width);
200 draw_gridline (z2, z1, trill_stemwidth);
206 fet_beginchar ("pralldown", "pralldown");
207 set_char_box (1.5 trill_width#, 1.5 trill_width#,
208 trill_height#, trill_height#);
210 currentpicture := remember_pic xscaled -1;
214 fet_beginchar ("downprall", "downprall");
215 set_char_box (1.5 trill_width#, 1.5 trill_width#,
216 trill_height#, trill_height#);
218 draw_trillelement (-trill_width);
219 draw_trillelement (0);
220 draw_trillelement (trill_width);
222 z11 = z4 shifted (-trill_width, 0);
223 z12 = z11 + (0, 2 trill_height);
225 penpos11 (trill_thin, angle (trill_ne xscaled -1) - 90);
226 penpos12 (trill_thin, angle (trill_ne) - 90);
229 pickup pencircle scaled trill_stemwidth;
231 fill z11l{trill_ne xscaled -1}
236 .. z11r{-trill_ne xscaled -1}
239 remember_pic := currentpicture;
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#);
247 currentpicture := remember_pic;
251 pickup pencircle scaled trill_stemwidth;
256 x2 = good.x (.5 trill_width);
258 draw_gridline (z2, z1, trill_stemwidth);
264 fet_beginchar ("prallup", "prallup");
265 set_char_box (1.5 trill_width#, 1.5 trill_width#,
266 trill_height#, trill_height#);
268 currentpicture := remember_pic xscaled -1;
272 fet_beginchar ("lineprall", "lineprall");
273 set_char_box (1.5 trill_width#, 1.5 trill_width#,
274 trill_height#, 4 trill_height#);
276 draw_trillelement (-trill_width);
278 labels (1, 2, 3, 3', 4, 5, 5');
280 pickup pencircle scaled trill_stemwidth;
282 lft x10 = x4 - .5 trill_thin - trill_width;
288 draw_gridline (z10, z11, trill_stemwidth);
290 draw_trillelement (0);
291 draw_trillelement (trill_width);