]> git.donarmstrong.com Git - lilypond.git/blob - mf/musixspx.mf
patch::: 0.0.75.jcn6: pats
[lilypond.git] / mf / musixspx.mf
1 font_identifier := "music_special_symbols";
2
3 % Here are two types of pianobrackets available, they are absolute compatible,
4 % so choose this one you prefer (search for '%!!!')
5
6 % free pos: 196-255
7
8 mode_setup;
9
10 font_size 20pt#;
11
12 nhh#:=5pt#;
13 nhw#:=6pt#;
14
15 qqs#=.4pt#; %width of lines
16 qqw#=10pt#; %length of horizontal stroke.
17
18 med#:=1/33designsize;
19 thick#:=1/16designsize;
20
21 thinwidth:=0.125pt;
22
23 define_pixels(qqw,nhh,nhw);
24 define_blacker_pixels(med,thick);
25
26 qqs:=ceiling(qqs#*hppp); % the way rule widths are calculated
27
28 pair sw;
29 sw = down+left;
30
31 path p;
32 picture save_pic;
33
34 pen line_pen;
35 line_pen:= pencircle scaled qqs;
36
37 %%%%%%%
38 message ("<glissandi-elements>");
39 %%%%%%%
40
41 def glissando (expr theta)=
42   x1=-1; y1=0; z2=z1+(.5nhw,0); z3=z1+(nhw+1,0);
43   p:= z1{1.25up+right}..{1.25down+right}z2{1.25down+right}..{1.25up+right}z3;
44   pickup penrazor scaled (.075nhw+thick) rotated (theta+65);
45   draw p rotated theta;
46   labels (1,2,3);
47 enddef;
48
49 for slope=1 upto 8:
50
51   beginchar(slope-1, (cosd(10slope))*nhw#,(sind(10slope))*nhw#, 0);
52   " glissando element slope "&decimal (10slope)&" degree";
53     glissando (10slope);
54     save_pic:= currentpicture;
55   endchar;
56
57   beginchar(8+slope-1, (cosd(10slope))*nhw#, (sind(10slope))*nhw#, 0);
58   " glissando element slope "&decimal (-10slope)&" degree";
59     currentpicture:= save_pic reflectedabout (origin, right);
60   endchar;
61
62 endfor;
63
64 %%%%%%%
65 message ("<guitar chords>");
66 %%%%%%%
67
68 def tabulatur (expr nd)=
69   hwidth:=1/5w;
70   x1=x2=y2=y3=0; x3=w; y1=-nd;
71   fill unitsquare xscaled (w+2thinwidth) yscaled (med+.2pt)
72        shifted(-thinwidth,0);
73   pickup pencircle scaled max(1,.2pt+blacker);
74   for v=1 upto 5 :
75     draw (z2--z3) shifted (0,v*-hwidth);
76   endfor;
77
78   for v=0 upto 5 :
79     draw (z1--z2) shifted (v*hwidth,0);
80   endfor;
81   labels (1,2,3);
82 enddef;
83
84 shift:=.15nhh;
85 def Circle (expr nh)=
86   x1l=.1w; x2=x4=.5w; x3l=.9w;
87   y1=y3=.5nh+shift; y2=.1nh+shift; y4=.9nh+shift;
88   penpos1(med, 0);
89   penpos2(thinwidth,90);
90   penpos3(med,180);
91   penpos4(thinwidth, 270);
92   penstroke z1e..z2e..z3e..z4e..cycle;
93   pickup pencircle; draw z1..z2..z3..z4..cycle;
94 enddef;
95
96 def Cross (expr nh)=
97   x1=x3=.2w; x2=x4=.8w;
98   y1=y4=.2nh+shift; y2=y3=nh-.2nh+shift;
99   pickup pencircle scaled med;
100   draw z1--z2; draw z3--z4;
101   labels (1,2,3,4);
102 enddef;
103
104 beginchar(16, 3nhw#, 0, 0);" small grid";
105   tabulatur (108/25nhh);
106 endchar;
107
108 beginchar(17, 3/2nhw#, 0, 0); " small dot";
109   fill fullcircle scaled .54nhh shifted (w,-.36nhh);
110 endchar;
111
112 beginchar(18, 3nhw#, 0, 0); " small bar";
113   fill unitsquare xscaled w yscaled .24nhh shifted (0,-.48nhh);
114 endchar;
115
116 beginchar(19, 3/5nhw#, 0, 0); " small circle";
117   Circle (.72nhh);
118 endchar;
119
120 beginchar(20, 3/5nhw#, 0, 0); " small cross";
121   Cross (.72nhh);
122 endchar;
123
124 % the next seems to be senseless, but it isn't
125
126 beginchar(28, 3/5nhw#, 0, 0); " small blank";
127 endchar;
128
129 %%%%%%%
130 message ("<several lines>");
131 %%%%%%%
132
133 hooklength:=4.5pt;
134
135 beginchar(21, 0, 0, 0);" bracket hook up";
136   pickup line_pen;
137   draw origin--(0, hooklength);
138 endchar;
139
140 beginchar(22, 0, 0, 0);" bracket hook down";
141   pickup line_pen;
142   draw origin--(0, -hooklength);
143 endchar;
144
145 beginchar(23, nhw#, 0, 0);" upper octaveline";
146   pickup line_pen;
147   draw (.33w, 1.1nhw)--(.66w, 1.1nhw);
148 endchar;
149
150 beginchar(24, 0, 0, 0);" final hook for upper octaveline";
151   pickup line_pen;
152   draw (1.1nhw,0)--(1.1nhw, 1.1nhw);
153   draw (.33nhw, 1.1nhw)--(1.1nhw, 1.1nhw);
154 endchar;
155
156 beginchar(25, nhw#, 0, 0);" lower octaveline";
157   pickup line_pen;
158   draw (.33w, 0)--(.66w, 0);
159 endchar;
160
161 beginchar(26, 0, 0, 0);" final hook for lower octaveline";
162   pickup line_pen;
163   draw (1.1nhw,0)--(1.1nhw, 1.1nhw);
164   draw (.33nhw,0)--(1.1nhw, 0);
165 endchar;
166
167 beginchar(27, .75nhw#, 0, 0);" used for \bracket";
168   pickup line_pen;
169   draw origin--(.5nhw, 0);
170 endchar;
171
172 beginchar(29, qqw#, 0, 0);" line ydim 0pt";
173   pickup line_pen;
174   draw origin--(w,0);
175 endchar;
176
177 % lines length xdim 10pt, ydim (-).25 to (-)5pt
178
179 for j=1 upto 20:
180   beginchar(29+j, qqw#, 0, 0); " line ydim "&decimal .25j&"pt";
181     pickup line_pen;
182     draw origin--(w, .25pt*j);
183     save_pic:= currentpicture;
184   endchar;
185
186   beginchar(49+j, qqw#, 0, 0); " line ydim -"&decimal .25j&"pt";
187     currentpicture:= save_pic reflectedabout (origin, right);
188   endchar;
189 endfor;
190
191 %%%%%%%
192 message ("<circles>");
193 %%%%%%%
194
195 for n:=1 upto 14:
196   beginchar(70+n-1, 0, 0, 0);
197   " fullcircle diameter "&decimal ((n+2)*2)&" pt";
198     diameter:=(n+2)*2pt;
199     pickup line_pen;
200     draw fullcircle scaled diameter;
201   endchar;
202 endfor;
203
204 %%%%%%%
205 message ("<(de-)crescendi>");
206 %%%%%%%
207
208 widthstep:=nhw;
209 crescendowidth:=.5nhh; % \Internote
210
211 for n:=1 upto 32:
212   beginchar(84+n-1, 0, 3pt#, 3pt#);
213   " crescendo length "&decimal n&" noteheadwidths";
214     pickup line_pen;
215     draw (n*widthstep, crescendowidth+.0075n*crescendowidth)--(0,0);
216     addto currentpicture also currentpicture reflectedabout (origin,right);
217     save_pic:= currentpicture;
218   endchar;
219
220   beginchar(116+n-1, 0, 3pt#, 3pt#);
221   " decrescendo length "&decimal n&" noteheadwidths";
222     currentpicture:= save_pic reflectedabout(origin, up) shifted (n*widthstep,0);
223   endchar;
224 endfor;
225
226 %%%%%%%
227 message ("<piano brackets>");
228 %%%%%%%
229
230 % lastbrace is adjustable (originally 99)
231
232 firstbrace:=20;  % smallest brace is 2*20 pt (\simeq 14mm)
233 lastbrace:=67+48;   % largest brace is 2*67 pt (\simeq 47mm)
234
235 %%% from Stanislav Kneifl
236
237 def drawpianobracket (expr height) =
238   u# := 1nhh#/5pt# * 1pt#;
239   v# := (height/40) * 1pt#;
240   define_pixels (u, v);
241 %  beginchar (height-firstbrace, 1.25nhh#, 0, 0);
242   beginchar (height-firstbrace+148, 0, 0, 0);
243     z1 = origin;
244     z2 = (4.7u, 7v);
245     z3 = (3.6u, 16.5v);
246     z4 = (1.9u, 25v);
247     z5 = (2.28u, 32v);
248     z6 = (w, 40v);
249     penpos1 (max(1,0.1u), 125);
250     penpos2 (1.2u, 180);
251     penpos3 (3.2u, 195);
252     penpos4 (2.5u, 180);
253     penpos5 (1.14u, 180);
254     penpos6 (max(2,0.3u), 150);
255     penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
256     currenttransform := identity reflectedabout ((0,0),(1,0));
257     penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
258     currenttransform := identity;
259 % inserted
260     currentpicture:=currentpicture shifted (round(-1.75nhh), 0);
261 %
262   endchar;
263 enddef;
264
265 def bigbrace(expr v) =
266   beginchar (v-firstbrace+148, 0, 0, 0);
267   " brace vsize "&decimal round(2v*pt#)&"pt";
268     vwidth:=v*pt;
269     hwidth:=max(.1vwidth,3.25pt);
270     hwidth:=min(hwidth,6.5pt);
271     actwidth:=.035vwidth;
272     x1=.25nhw;  y1=vwidth;
273     x2l=-.8hwidth; y2=2/3vwidth;
274     x3r=.2hwidth; y3=1/3vwidth;
275     x4=-hwidth; y4=0;
276     penpos1(max(1,.25pt),-35);
277     penpos2(1.5med+actwidth,40);
278     penpos3(1.75med+actwidth,45);
279     penpos4(max(1,.2pt),-90);
280     penstroke z1e..z2e..z3e..{left+sw}z4e;
281     currentpen:= pencircle; draw z1..z2..z3..{left+sw}z4;
282     addto currentpicture also currentpicture reflectedabout (origin, right);
283     penlabels(1,2,3,4);
284     currentpicture:= currentpicture shifted (round(-.75nhh), 0);
285   endchar;
286 enddef;
287
288 %!!! comment the line 'bigbrace' and uncomment the line 'drawpianobracket'
289
290 for v=firstbrace upto lastbrace :
291   bigbrace (v);
292 %  drawpianobracket (v);
293 endfor;
294
295 end