]> git.donarmstrong.com Git - lilypond.git/blob - ps/lily.ps
release: 1.3.148
[lilypond.git] / ps / lily.ps
1 %!PS-Adobe-1.0: lily.ps 
2 %
3 %
4
5 % round cappings 
6 1 setlinecap
7
8 /euclidean_length  
9
10         1 copy mul exch 1 copy mul add sqrt 
11 } bind def 
12
13 /draw_beam % width slope thick 
14
15         2 div /beam_thick exch def 
16         /beam_slope exch def 
17         /beam_wd exch def 
18         beam_slope beam_wd mul /beam_ht exch def 
19         0 beam_thick neg moveto  
20         beam_wd beam_ht rlineto  
21         0 beam_thick 2 mul rlineto 
22         0 beam_thick lineto 
23         closepath fill 
24 } bind def 
25
26 /draw_repeat_slash % width slope thick
27 {
28   /beamthick exch def
29   /slope exch def
30   /width exch def
31   beamthick beamthick slope div euclidean_length
32     /xwid exch def 
33   0 0 moveto
34   xwid 0  rlineto
35   width slope width mul rlineto
36   xwid neg 0 rlineto
37 %  width neg width angle sin mul neg rlineto
38   closepath fill
39 } bind def
40
41 /draw_hairpin % width start_h end_h thick
42 {
43   setlinewidth
44   /end_h exch def 
45   /start_h exch def
46   /wid exch def
47   0 start_h moveto
48   wid end_h lineto
49   stroke
50   0 start_h neg moveto
51   wid end_h neg lineto
52   stroke
53 } bind def
54
55 /draw_tuplet % height gap dx dy thick dir 
56
57         /dir exch def 
58         setlinewidth 
59         1 setlinecap 
60         1 setlinejoin 
61         /tuplet_dy exch def 
62         /tuplet_dx exch def 
63         /tuplet_gapx exch def 
64         /tuplet_h exch def 
65         tuplet_dy tuplet_dx div tuplet_gapx mul /tuplet_gapy exch def 
66
67
68         0 0 moveto 
69         0 tuplet_h dir mul lineto  
70         tuplet_dx tuplet_gapx sub 2 div  
71                 tuplet_dy tuplet_gapy sub 2 div tuplet_h dir mul add lineto 
72         tuplet_dx tuplet_gapx add 2 div  
73                 tuplet_dy tuplet_gapy add 2 div tuplet_h dir mul add moveto 
74         tuplet_dx tuplet_dy tuplet_h dir mul add lineto 
75         tuplet_dx tuplet_dy lineto 
76         stroke 
77 } bind def 
78
79 /difficult_draw_ez_ball % ch letter_col ball_col font
80 {
81         % font
82         findfont 0.7 scalefont setfont 
83         0.1 setlinewidth
84         0 0 moveto
85         0 setgray
86         0.5 0 0.5 0 360 arc closepath fill stroke
87         % ball_col
88         1 eq {
89                 0.01 setlinewidth
90                 1 setgray
91                 0.5 0 0.4 0 360 arc closepath
92                 fill stroke
93         } if 
94         % letter_col
95         setgray
96         % 0.25 is empiric centering. Change to taste
97         0.25 -0.25 moveto
98         % ch
99         show
100 } bind def
101
102 % simple, but does it work everywhere?
103 % explain ? --hwn
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