-/draw_dashed_line % dash thickness dx dy
-{
- 1 setlinecap
- 1 setlinejoin
- setdash
- setlinewidth
- 0 0 moveto
- lineto
- stroke
-} bind def
-
-/draw_dashed_slur % dash thickness controls
-{
- 1 setlinecap
- 1 setlinejoin
- setdash
- setlinewidth
- 8 -2 roll
- moveto
- curveto
- stroke
-} bind def
-
-
-% a b c d subvec == a-c b-d
-/subvec {
- 3 2 roll exch sub
- 3 1 roll
- sub exch
+/draw_partial_ellipse % filled connect x-radius y-radius startangle endangle thickness draw_partial_ellipse
+% Note that filled is not boolean to permit for different graylevels (ie for trill keys)
+{
+ gsave
+ currentpoint translate
+ /thickness exch def
+ /endangle exch def
+ /startangle exch def
+ /y_radius exch def
+ /x_radius exch def
+ /endrad x_radius y_radius mul
+ x_radius x_radius mul
+ endangle cos endangle cos mul mul
+ y_radius y_radius mul
+ endangle sin endangle sin mul mul add sqrt div def
+ /endangle endangle sin endrad mul y_radius div
+ endangle cos endrad mul x_radius div atan def
+ /startrad x_radius y_radius mul
+ x_radius x_radius mul
+ startangle cos startangle cos mul mul
+ y_radius y_radius mul
+ startangle sin startangle sin mul mul add sqrt div def
+ /startangle startangle sin startrad mul y_radius div
+ startangle cos startrad mul x_radius div atan def
+ /connect exch def
+ /filled exch def
+ /savematrix matrix currentmatrix def
+ thickness setlinewidth
+ x_radius y_radius scale
+ startangle cos startangle sin moveto
+ 0 0 1 startangle
+ startangle endangle eq { endangle 360 add } { endangle } ifelse
+ arc
+ connect {
+ startangle cos startangle sin moveto endangle cos endangle sin lineto }
+ if
+ savematrix setmatrix filled { stroke_and_fill } { stroke } ifelse
+ grestore