]> git.donarmstrong.com Git - lilypond.git/blob - ps/lily.ps
patch::: 1.3.133.jcn2
[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 /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 /draw_volta % h w thick vert_start vert_end 
104
105         /vert_end exch def 
106         /vert_start exch def 
107         setlinewidth 
108         /volta_w exch def 
109         /volta_h exch def 
110         1 setlinecap 
111         1 setlinejoin 
112         vert_start 0 eq { 
113                 0 0 moveto 
114                 0 volta_h lineto 
115         } if 
116         0 volta_h moveto 
117         volta_w volta_h lineto 
118         vert_end 0 eq { 
119                 volta_w 0 lineto 
120         } if 
121         stroke 
122 } bind def 
123
124 % this is for drawing slurs. 
125 /draw_bezier_sandwich  % thickness controls 
126
127         setlinewidth 
128         moveto 
129         curveto 
130         lineto 
131         curveto 
132         gsave 
133         fill 
134         grestore 
135         stroke 
136 } bind def 
137
138 /draw_dashed_line % dash thickness dx dy
139
140         1 setlinecap 
141         1 setlinejoin 
142         setdash 
143         setlinewidth 
144         0 0 moveto
145         lineto
146         stroke 
147 } bind def 
148
149 /draw_dashed_slur % dash thickness controls
150
151         1 setlinecap 
152         1 setlinejoin 
153         setdash 
154         setlinewidth 
155         8 -2 roll 
156         moveto 
157         curveto 
158         stroke 
159 } bind def 
160
161
162
163 /bracket_traject 
164
165         /traject_ds exch def 
166         /traject_alpha exch def 
167         traject_ds traject_alpha sin mul add 
168         exch 
169         traject_ds traject_alpha cos mul add 
170         exch 
171 } bind def 
172
173
174
175 /half_bracket
176
177 %6 
178         0 0 
179 %5a 
180         bracket_thick arch_height add half_height arch_thick sub arch_width add 
181         arch_angle arch_height -0.15 mul bracket_traject 
182 %5b 
183         bracket_thick 0.5 mul half_height 
184         0 arch_height 0.5 mul bracket_traject 
185 %5c 
186         0 half_height 
187 %4a 
188         bracket_thick half_height arch_thick sub 
189         0 arch_height 0.4 mul bracket_traject 
190 %4b 
191         bracket_thick arch_height add half_height arch_thick sub arch_width add 
192         arch_angle arch_height -0.25 mul bracket_traject 
193 %4c 
194         bracket_thick arch_height add half_height arch_thick sub arch_width add 
195 %3 
196         bracket_thick half_height arch_thick sub 
197 %2 
198         bracket_thick 0 
199 %1 
200         0 0 
201 } bind def 
202
203 /draw_half_bracket { 
204         moveto 
205         lineto 
206         lineto 
207         curveto 
208         curveto 
209         lineto 
210         gsave 
211         fill 
212         grestore 
213 } bind def 
214
215 /draw_bracket % arch_angle arch_width arch_height bracket_height arch_thick bracket_thick
216
217         % urg
218
219         /bracket_thick exch def
220         /arch_thick exch def
221         /bracket_height exch def
222         /arch_height exch def
223         /arch_width exch def
224         /arch_angle exch def
225
226         bracket_height 2 div bracket_thick add /half_height exch def 
227         bracket_thick 0.5 mul setlinewidth
228         1 setlinecap 
229         1 setlinejoin 
230         half_bracket 
231         20 copy 
232         1 -1 scale 
233         draw_half_bracket 
234         stroke 
235         1 -1 scale 
236         draw_half_bracket 
237         stroke 
238 } bind def 
239