-/draw_repeat_slash % width slope thick
-{
- 1 setlinecap
- 1 setlinejoin
-
- /beamthick exch def
- /slope exch def
- /width exch def
- beamthick beamthick slope div euclidean_length
- /xwid exch def
- 0 0 moveto
- xwid 0 rlineto
- width slope width mul rlineto
- xwid neg 0 rlineto
- % width neg width angle sin mul neg rlineto
- closepath fill
-} bind def
-
-
-/draw_white_text % text scale font
-{
- %font
- findfont
- %scale
- exch scalefont setfont
- 1 setgray
- 0 0 moveto
- %-0.05 -0.05 moveto
- % text
- show
-} bind def
-
-/draw_ez_ball % ch letter_col ball_col font
-{
- % font
- findfont 0.7 scalefont setfont
- 0.1 setlinewidth
- 0 0 moveto
- 0 setgray
- 0.5 0 0.5 0 360 arc closepath fill stroke
- % ball_col
- 1 eq {
- 0.01 setlinewidth
- 1 setgray
- 0.5 0 0.4 0 360 arc closepath
- fill stroke
- } if
- % letter_col
- setgray
- % 0.25 is empiric centering. Change to taste
- 0.25 -0.25 moveto
- % ch
- show
-} bind def
-
-% Simple, but does it work everywhere?
-% Han-Wen reports that one printer (brand?) at cs.uu.nl chokes on this,
-% reverted for now -- jcn
-%
-% The filled circles are drawn by setting the linewidth
-% to 2*radius and drawing a point.
-/simple_draw_ez_ball % ch letter_col ball_col font
-{
- % font
- findfont 0.85 scalefont setfont
- /origin { 0.45 0 } def
- 0 setgray
- 1.1 setlinewidth
- origin moveto
- origin lineto stroke
- % ball_col
- setgray
- 0.9 setlinewidth
- origin moveto
- origin lineto stroke
- % letter_col
- setgray
- % 0.25 is empiric centering. Change to taste
- origin moveto
- -0.28 -0.30 rmoveto
- % ch
- show
-} bind def
-
-% this is for drawing slurs.
-/draw_bezier_sandwich % thickness controls
-{
- % round ending and round beginning
- 1 setlinejoin 1 setlinecap
- setlinewidth
- moveto
- curveto
- lineto
- curveto
- closepath
- gsave
- fill
- grestore
- stroke
-} bind def
-
-/draw_dot % x1 y2 R
-{
-% 0 360 arc fill stroke
- 0 360 arc closepath fill stroke
-} bind def
-
-/draw_white_dot % x1 y2 R
-{
-% 0 360 arc fill stroke
- 0 360 arc closepath % fill stroke
-gsave
- 1 setgray fill
-grestore
-% 0 360 arc closepath % fill stroke
- 0.05 setlinewidth 0 setgray stroke
-} bind def
-
-/draw_dashed_line % dash thickness dx dy
-{
+/draw_circle % filled? radius thickness draw_circle
+{
+ setlinewidth % f? r
+ currentpoint % f? r x0 y0
+ 3 2 roll % f? x0 y0 r
+ dup 0 rmoveto
+ 0 360 arc closepath
+ { stroke_and_fill }
+ { stroke }
+ ifelse
+} bind def
+
+/draw_ellipse % filled? x-radius y-radius thickness draw_ellipse
+{
+ setlinewidth % f? x-r y-r
+ /savematrix matrix currentmatrix def
+ scale % f?
+ currentpoint
+ 1 0 rmoveto
+ 1 0 360 arc closepath
+ savematrix setmatrix
+ { stroke_and_fill}
+ { stroke }
+ ifelse
+} bind def
+
+/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
+} bind def
+
+/draw_line % dx dy x1 y1 thickness draw_line
+{
+ setlinewidth % dx dy x1 y1