-def draw_trill_four =
- draw_trillelement;
- currentpicture := currentpicture shifted (-2*twidth+toverlap, 0);
- draw_trillelement;
- currentpicture := currentpicture shifted (-2*twidth+toverlap, 0);
- draw_trillelement;
- currentpicture := currentpicture shifted (-2*twidth+toverlap, 0);
- draw_trillelement;
- currentpicture := currentpicture shifted (3twidth-1.5toverlap, 0);
-enddef;
+pair trill_ne;
+trill_ne := unitvector ((2, 3));
+
+
+%
+% The trill element sticks out on both the left and right side
+% of the normal bbox, so you can glue them together easily.
+%
+% `ending' is either 0 for none, 1 for left, or 2 for right.
+%
+
+def draw_trillelement (expr offset, ending) =
+ clearxy;
+
+begingroup;
+ save nw, pat, nw_dist, ne_dist;
+ pair nw, nw_dist, ne_dist;
+ path pat;
+
+ pickup pencircle scaled trill_thin;
+
+ x1 = -.5 trill_width;
+ y1 = 0;
+ z3 = whatever * trill_ne + z1;
+ top y3 = vround trill_height;
+ z2 = z3 - (trill_thick - trill_thin) * trill_ne;
+
+ bot z3' = (top z3) scaled -1;
+
+ nw = unitvector (z2 - z3');
+ ne_dist = (nw rotated -90) * 0.5 trill_thin;
+ nw_dist = (trill_ne rotated 90) * 0.5 trill_thin;
+
+ z5 = whatever * trill_ne + (z1 - nw_dist);
+ z5 = whatever * nw + (z3' - ne_dist);
+
+ pat := z5
+ -- (z1 - nw_dist){-trill_ne}
+ -- (z1 + nw_dist){trill_ne}
+ -- (z3 + nw_dist){trill_ne}
+ .. top z3{right}
+ .. (z3 + ne_dist){-nw};
+ pat := pat
+ -- pat scaled -1 shifted (-feta_eps, -feta_eps)
+ -- cycle;
+ pat := pat shifted (offset, 0);
+ fill pat;
+
+ z4 = z1 - trill_ne * trill_overlap;
+ x4 := hround (x4 + 0.5 trill_thin) - 0.5 trill_thin;