1 %!PS-Adobe-1.0: music-drawing-routines.ps
3 % Functions for direct and embedded PostScript
5 /blot-diameter { lilypondpaperblotdiameter } bind def
7 % fucking redhat xdvi patch.
8 /skeel { scale } bind def
17 1 copy mul exch 1 copy mul add sqrt
20 /skeel { scale } bind def
21 % FIXME. translate to middle of box.
22 % Nice rectangle with rounded corners
23 /draw_box % breapth width depth height
25 currentdict /testing known {
26 %% real thin lines for testing
29 /blot blot-diameter def
36 blot 2 div sub /h exch def
37 blot 2 div sub /d exch def
38 blot 2 div sub /w exch def
39 blot 2 div sub /b exch def
47 currentdict /testing known {
48 %% outline only, for testing:
51 closepath gsave stroke grestore fill
55 /draw_round_box % breapth width depth height blot
63 blot 2 div sub /h exch def
64 blot 2 div sub /d exch def
65 blot 2 div sub /w exch def
66 blot 2 div sub /b exch def
74 currentdict /testing known {
75 %% outline only, for testing:
78 closepath gsave stroke grestore fill
82 % Nice beam with rounded corners
83 /draw_beam % slope width thick
85 currentdict /testing known {
86 %% real thin lines for testing
89 /blot blot-diameter def
100 blot 2 div t 2 div neg moveto
106 currentdict /testing known {
107 %% outline only, for testing:
110 closepath gsave stroke grestore fill
114 /draw_repeat_slash % width slope thick
122 beamthick beamthick slope div euclidean_length
126 width slope width mul rlineto
128 % width neg width angle sin mul neg rlineto
132 /draw_hairpin % width start_h end_h thick
149 /draw_tuplet % height gap dx dy thick dir
158 /tuplet_gapx exch def
160 tuplet_dy tuplet_dx div tuplet_gapx mul /tuplet_gapy exch def
163 0 tuplet_h neg dir mul moveto
165 tuplet_dx tuplet_gapx sub 2 div
166 tuplet_dy tuplet_gapy sub 2 div lineto
167 tuplet_dx tuplet_gapx add 2 div
168 tuplet_dy tuplet_gapy add 2 div moveto
169 tuplet_dx tuplet_dy lineto
170 tuplet_dx tuplet_dy tuplet_h dir neg mul add lineto
174 /draw_ez_ball % ch letter_col ball_col font
177 findfont 0.7 scalefont setfont
181 0.5 0 0.5 0 360 arc closepath fill stroke
186 0.5 0 0.4 0 360 arc closepath
191 % 0.25 is empiric centering. Change to taste
197 % Simple, but does it work everywhere?
198 % Han-Wen reports that one printer (brand?) at cs.uu.nl chokes on this,
199 % reverted for now -- jcn
201 % The filled circles are drawn by setting the linewidth
202 % to 2*radius and drawing a point.
203 /simple_draw_ez_ball % ch letter_col ball_col font
206 findfont 0.85 scalefont setfont
207 /origin { 0.45 0 } def
219 % 0.25 is empiric centering. Change to taste
226 /draw_volta % h w thick vert_start vert_end
241 volta_w volta_h lineto
248 % this is for drawing slurs.
249 /draw_bezier_sandwich % thickness controls
264 % 0 360 arc fill stroke
265 0 360 arc closepath fill stroke
268 /draw_dashed_line % dash thickness dx dy
279 /draw_dashed_slur % dash thickness controls
296 /traject_alpha exch def
297 traject_ds traject_alpha sin mul add
299 traject_ds traject_alpha cos mul add
310 bracket_thick arch_height add half_height arch_thick sub arch_width add
311 arch_angle arch_height -0.15 mul bracket_traject
313 bracket_thick 0.5 mul half_height
314 0 arch_height 0.5 mul bracket_traject
318 bracket_thick half_height arch_thick sub
319 0 arch_height 0.4 mul bracket_traject
321 bracket_thick arch_height add half_height arch_thick sub arch_width add
322 arch_angle arch_height -0.25 mul bracket_traject
324 bracket_thick arch_height add half_height arch_thick sub arch_width add
326 bracket_thick half_height arch_thick sub
345 /draw_bracket % arch_angle arch_width arch_height bracket_height arch_thick bracket_thick
349 /bracket_thick exch def
351 /bracket_height exch def
352 /arch_height exch def
356 bracket_height 2 div bracket_thick add /half_height exch def
357 bracket_thick 0.5 mul setlinewidth