1 %!PS-Adobe-1.0: music-drawing-routines.ps
3 % Functions for direct and embedded PostScript
5 % Careful with double % as comment prefix.
6 % Any %%X comment is interpreted as DSC comments.
8 % TODO: use dicts or prefixes to prevent namespace pollution.
10 % Emulation code from Postscript Language Reference.
15 dup type /arraytype eq
28 { /selectfont /*SF load def }
34 {pop} {userdict /pdfmark /cleartomark load put} ifelse
39 % It's possible to eliminate the coordinate variables by doing [ /Rect [ 7 3
40 % roll. That is, however, kind of ugly. It would be nice if this procedure
41 % were only included when PDF marks are enabled.
49 /Rect [ llx lly urx ury ]
64 % from adobe tech note 5002.
66 /b4_Inc_state save def % Save state for cleanup
67 /dict_count countdictstack def % Count objects on dict stack
68 /op_count count 1 sub def % Count objects on operand stack
69 userdict begin % Push userdict on dict stack
70 /showpage { } def % Redefine showpage, { } = null proc
71 0 setgray 0 setlinecap % Prepare graphics state
72 1 setlinewidth 0 setlinejoin
73 10 setmiterlimit [ ] 0 setdash newpath
74 /languagelevel where % If level not equal to 1 then
75 {pop languagelevel % set strokeadjust and
76 1 ne % overprint to their defaults.
77 {false setstrokeadjust false setoverprint
83 count op_count sub {pop} repeat % Clean up stacks
84 countdictstack dict_count sub {end} repeat
89 %<font> <encoding> <name> reencode-font
96 1 index /FID ne {def} {pop
121 /draw_round_box % x y width height blot
127 currentdict /testing known {
128 %% outline only, for testing:
136 /draw_polygon % fill? x(n) y(n) x(n-1) y(n-1) ... x(0) y(0) n blot
138 setlinewidth %set to blot
145 { lineto } repeat % n times
154 /draw_repeat_slash % x-width width height
156 2 index % duplicate x-width
161 0 rlineto % x-width 0
162 rlineto % width height
163 neg 0 rlineto % -x-width 0
167 % this is for drawing slurs.
168 /draw_bezier_sandwich % thickness controls
170 % round ending and round beginning
171 1 setlinejoin 1 setlinecap
183 % 0 360 arc fill stroke
184 0 360 arc closepath stroke_and_fill
199 % JUNKME. use color & circle.
200 /draw_white_dot % x1 y2 R
202 % 0 360 arc fill stroke
203 0 360 arc closepath % fill stroke
207 % 0 360 arc closepath % fill stroke
208 0.05 setlinewidth 0 setgray stroke
213 /draw_white_text % text scale font
224 /draw_dashed_line % dash thickness dx dy
235 /draw_dashed_slur % dash thickness controls
256 %end music-drawing-routines.ps