]> git.donarmstrong.com Git - lilypond.git/blob - ps/lily.ps
patch::: 1.3.133.jcn3
[lilypond.git] / ps / lily.ps
1 %!PS-Adobe-1.0: lily.ps 
2 %
3 %
4
5 % round cappings 
6 1 setlinecap
7
8 /draw_beam % width slope thick 
9
10         2 div /beam_thick exch def 
11         /beam_slope exch def 
12         /beam_wd exch def 
13         beam_slope beam_wd mul /beam_ht exch def 
14         0 beam_thick neg moveto  
15         beam_wd beam_ht rlineto  
16         0 beam_thick 2 mul rlineto 
17         0 beam_thick lineto 
18         closepath fill 
19 } bind def 
20
21 /draw_decrescendo %  width height cons thick 
22
23         setlinewidth 
24         /cresc_cont exch def 
25         /cresc_ht exch def 
26         /cresc_wd exch def 
27
28         cresc_wd cresc_cont moveto 
29         0 cresc_ht lineto 
30         stroke 
31         cresc_wd cresc_cont neg moveto 
32         0 cresc_ht neg lineto 
33         stroke 
34 } bind def 
35
36 /draw_crescendo % width height cons thick 
37
38         setlinewidth 
39         /cresc_cont exch def 
40         /cresc_ht exch def 
41         /cresc_wd exch def 
42
43         0 cresc_cont moveto 
44         cresc_wd cresc_ht lineto 
45         stroke 
46         0 cresc_cont neg moveto 
47         cresc_wd cresc_ht neg lineto 
48         stroke 
49 } bind def 
50
51 /lily_distance  
52
53         1 copy mul exch 1 copy mul add sqrt 
54 } bind def 
55
56 /draw_tuplet % height gap dx dy thick dir 
57
58         /dir exch def 
59         setlinewidth 
60         1 setlinecap 
61         1 setlinejoin 
62         /tuplet_dy exch def 
63         /tuplet_dx exch def 
64         /tuplet_gapx exch def 
65         /tuplet_h exch def 
66         tuplet_dy tuplet_dx div tuplet_gapx mul /tuplet_gapy exch def 
67
68
69         0 0 moveto 
70         0 tuplet_h dir mul lineto  
71         tuplet_dx tuplet_gapx sub 2 div  
72                 tuplet_dy tuplet_gapy sub 2 div tuplet_h dir mul add lineto 
73         tuplet_dx tuplet_gapx add 2 div  
74                 tuplet_dy tuplet_gapy add 2 div tuplet_h dir mul add moveto 
75         tuplet_dx tuplet_dy tuplet_h dir mul add lineto 
76         tuplet_dx tuplet_dy lineto 
77         stroke 
78 } bind def 
79
80 /difficult_draw_ez_ball % ch letter_col ball_col font
81 {
82         % font
83         findfont 0.7 scalefont setfont 
84         0.1 setlinewidth
85         0 0 moveto
86         0 setgray
87         0.5 0 0.5 0 360 arc closepath fill stroke
88         % ball_col
89         1 eq {
90                 0.01 setlinewidth
91                 1 setgray
92                 0.5 0 0.4 0 360 arc closepath
93                 fill stroke
94         } if 
95         % letter_col
96         setgray
97         % 0.25 is empiric centering. Change to taste
98         0.25 -0.25 moveto
99         % ch
100         show
101 } bind def
102
103 % simple, but does it work everywhere?
104 /draw_ez_ball % ch letter_col ball_col font
105 {
106         % font
107         findfont 0.85 scalefont setfont
108         /origin { 0.45 0 } def
109         0 setgray
110         1.1 setlinewidth
111         origin moveto
112         origin lineto stroke
113         % ball_col
114         setgray
115         0.9 setlinewidth
116         origin moveto
117         origin lineto stroke
118         % letter_col
119         setgray
120         % 0.25 is empiric centering. Change to taste
121         origin moveto
122         -0.28 -0.30 rmoveto
123         % ch
124         show
125 } bind def
126
127 /draw_volta % h w thick vert_start vert_end 
128
129         /vert_end exch def 
130         /vert_start exch def 
131         setlinewidth 
132         /volta_w exch def 
133         /volta_h exch def 
134         1 setlinecap 
135         1 setlinejoin 
136         vert_start 0 eq { 
137                 0 0 moveto 
138                 0 volta_h lineto 
139         } if 
140         0 volta_h moveto 
141         volta_w volta_h lineto 
142         vert_end 0 eq { 
143                 volta_w 0 lineto 
144         } if 
145         stroke 
146 } bind def 
147
148 % this is for drawing slurs. 
149 /draw_bezier_sandwich  % thickness controls 
150
151         setlinewidth 
152         moveto 
153         curveto 
154         lineto 
155         curveto 
156         gsave 
157         fill 
158         grestore 
159         stroke 
160 } bind def 
161
162 /draw_dashed_line % dash thickness dx dy
163
164         1 setlinecap 
165         1 setlinejoin 
166         setdash 
167         setlinewidth 
168         0 0 moveto
169         lineto
170         stroke 
171 } bind def 
172
173 /draw_dashed_slur % dash thickness controls
174
175         1 setlinecap 
176         1 setlinejoin 
177         setdash 
178         setlinewidth 
179         8 -2 roll 
180         moveto 
181         curveto 
182         stroke 
183 } bind def 
184
185
186
187 /bracket_traject 
188
189         /traject_ds exch def 
190         /traject_alpha exch def 
191         traject_ds traject_alpha sin mul add 
192         exch 
193         traject_ds traject_alpha cos mul add 
194         exch 
195 } bind def 
196
197
198
199 /half_bracket
200
201 %6 
202         0 0 
203 %5a 
204         bracket_thick arch_height add half_height arch_thick sub arch_width add 
205         arch_angle arch_height -0.15 mul bracket_traject 
206 %5b 
207         bracket_thick 0.5 mul half_height 
208         0 arch_height 0.5 mul bracket_traject 
209 %5c 
210         0 half_height 
211 %4a 
212         bracket_thick half_height arch_thick sub 
213         0 arch_height 0.4 mul bracket_traject 
214 %4b 
215         bracket_thick arch_height add half_height arch_thick sub arch_width add 
216         arch_angle arch_height -0.25 mul bracket_traject 
217 %4c 
218         bracket_thick arch_height add half_height arch_thick sub arch_width add 
219 %3 
220         bracket_thick half_height arch_thick sub 
221 %2 
222         bracket_thick 0 
223 %1 
224         0 0 
225 } bind def 
226
227 /draw_half_bracket { 
228         moveto 
229         lineto 
230         lineto 
231         curveto 
232         curveto 
233         lineto 
234         gsave 
235         fill 
236         grestore 
237 } bind def 
238
239 /draw_bracket % arch_angle arch_width arch_height bracket_height arch_thick bracket_thick
240
241         % urg
242
243         /bracket_thick exch def
244         /arch_thick exch def
245         /bracket_height exch def
246         /arch_height exch def
247         /arch_width exch def
248         /arch_angle exch def
249
250         bracket_height 2 div bracket_thick add /half_height exch def 
251         bracket_thick 0.5 mul setlinewidth
252         1 setlinecap 
253         1 setlinejoin 
254         half_bracket 
255         20 copy 
256         1 -1 scale 
257         draw_half_bracket 
258         stroke 
259         1 -1 scale 
260         draw_half_bracket 
261         stroke 
262 } bind def 
263