1 %!PS-Adobe-1.0: music-drawing-routines.ps
3 % Functions for direct and embedded PostScript
6 % FIXME: set with individual symbols
12 1 copy mul exch 1 copy mul add sqrt
15 % FIXME. translate to middle of box.
16 % Nice rectangle with rounded corners
17 % FIXME: linewidth hardcoded. check: too round?
18 /draw_box % breapth width depth height
21 currentdict /testing known {
22 %% real thin lines for testing
32 l 2 div sub /h exch def
33 l 2 div sub /d exch def
36 %% Where does this correction come from?
37 %% Why don't we need this in x direction?
38 h l 2 div sub /h exch def
39 d l 2 div sub /d exch def
41 l 2 div sub /w exch def
42 l 2 div sub /b exch def
50 currentdict /testing known {
51 %% outline only, for testing:
54 closepath gsave stroke grestore fill
58 % Nice beam with rounded corners
59 % FIXME: linewidth hardcoded. check: too round?
60 /draw_beam % slope width thick
63 currentdict /testing known {
64 %% real thin lines for testing
78 l 2 div t 2 div neg moveto
84 currentdict /testing known {
85 %% outline only, for testing:
88 closepath gsave stroke grestore fill
92 /draw_repeat_slash % width slope thick
97 beamthick beamthick slope div euclidean_length
101 width slope width mul rlineto
103 % width neg width angle sin mul neg rlineto
107 /draw_hairpin % width start_h end_h thick
121 /draw_tuplet % height gap dx dy thick dir
129 /tuplet_gapx exch def
131 tuplet_dy tuplet_dx div tuplet_gapx mul /tuplet_gapy exch def
134 0 tuplet_h neg dir mul moveto
136 tuplet_dx tuplet_gapx sub 2 div
137 tuplet_dy tuplet_gapy sub 2 div lineto
138 tuplet_dx tuplet_gapx add 2 div
139 tuplet_dy tuplet_gapy add 2 div moveto
140 tuplet_dx tuplet_dy lineto
141 tuplet_dx tuplet_dy tuplet_h dir neg mul add lineto
145 /draw_ez_ball % ch letter_col ball_col font
148 findfont 0.7 scalefont setfont
152 0.5 0 0.5 0 360 arc closepath fill stroke
157 0.5 0 0.4 0 360 arc closepath
162 % 0.25 is empiric centering. Change to taste
168 % Simple, but does it work everywhere?
169 % Han-Wen reports that one printer (brand?) at cs.uu.nl chokes on this,
170 % reverted for now -- jcn
172 % The filled circles are drawn by setting the linewidth
173 % to 2*radius and drawing a point.
174 /simple_draw_ez_ball % ch letter_col ball_col font
177 findfont 0.85 scalefont setfont
178 /origin { 0.45 0 } def
190 % 0.25 is empiric centering. Change to taste
197 /draw_volta % h w thick vert_start vert_end
211 volta_w volta_h lineto
218 % this is for drawing slurs.
219 /draw_bezier_sandwich % thickness controls
232 /draw_dashed_line % dash thickness dx dy
243 /draw_dashed_slur % dash thickness controls
260 /traject_alpha exch def
261 traject_ds traject_alpha sin mul add
263 traject_ds traject_alpha cos mul add
274 bracket_thick arch_height add half_height arch_thick sub arch_width add
275 arch_angle arch_height -0.15 mul bracket_traject
277 bracket_thick 0.5 mul half_height
278 0 arch_height 0.5 mul bracket_traject
282 bracket_thick half_height arch_thick sub
283 0 arch_height 0.4 mul bracket_traject
285 bracket_thick arch_height add half_height arch_thick sub arch_width add
286 arch_angle arch_height -0.25 mul bracket_traject
288 bracket_thick arch_height add half_height arch_thick sub arch_width add
290 bracket_thick half_height arch_thick sub
309 /draw_bracket % arch_angle arch_width arch_height bracket_height arch_thick bracket_thick
313 /bracket_thick exch def
315 /bracket_height exch def
316 /arch_height exch def
320 bracket_height 2 div bracket_thick add /half_height exch def
321 bracket_thick 0.5 mul setlinewidth