1 font_identifier := "music_special_symbols";
3 % Here are two types of pianobrackets available, they are absolute compatible,
4 % so choose this one you prefer (search for '%!!!')
15 qqs#=.4pt#; %width of lines
16 qqw#=10pt#; %length of horizontal stroke.
19 thick#:=1/16designsize;
23 define_pixels(qqw,nhh,nhw);
24 define_blacker_pixels(med,thick);
26 qqs:=ceiling(qqs#*hppp); % the way rule widths are calculated
35 line_pen:= pencircle scaled qqs;
38 message ("<glissandi-elements>");
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);
51 beginchar(slope-1, (cosd(10slope))*nhw#,(sind(10slope))*nhw#, 0);
52 " glissando element slope "&decimal (10slope)&" degree";
54 save_pic:= currentpicture;
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);
65 message ("<guitar chords>");
68 def tabulatur (expr nd)=
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);
75 draw (z2--z3) shifted (0,v*-hwidth);
79 draw (z1--z2) shifted (v*hwidth,0);
86 x1l=.1w; x2=x4=.5w; x3l=.9w;
87 y1=y3=.5nh+shift; y2=.1nh+shift; y4=.9nh+shift;
89 penpos2(thinwidth,90);
91 penpos4(thinwidth, 270);
92 penstroke z1e..z2e..z3e..z4e..cycle;
93 pickup pencircle; draw z1..z2..z3..z4..cycle;
98 y1=y4=.2nh+shift; y2=y3=nh-.2nh+shift;
99 pickup pencircle scaled med;
100 draw z1--z2; draw z3--z4;
104 beginchar(16, 3nhw#, 0, 0);" small grid";
105 tabulatur (108/25nhh);
108 beginchar(17, 3/2nhw#, 0, 0); " small dot";
109 fill fullcircle scaled .54nhh shifted (w,-.36nhh);
112 beginchar(18, 3nhw#, 0, 0); " small bar";
113 fill unitsquare xscaled w yscaled .24nhh shifted (0,-.48nhh);
116 beginchar(19, 3/5nhw#, 0, 0); " small circle";
120 beginchar(20, 3/5nhw#, 0, 0); " small cross";
124 % the next seems to be senseless, but it isn't
126 beginchar(28, 3/5nhw#, 0, 0); " small blank";
130 message ("<several lines>");
135 beginchar(21, 0, 0, 0);" bracket hook up";
137 draw origin--(0, hooklength);
140 beginchar(22, 0, 0, 0);" bracket hook down";
142 draw origin--(0, -hooklength);
145 beginchar(23, nhw#, 0, 0);" upper octaveline";
147 draw (.33w, 1.1nhw)--(.66w, 1.1nhw);
150 beginchar(24, 0, 0, 0);" final hook for upper octaveline";
152 draw (1.1nhw,0)--(1.1nhw, 1.1nhw);
153 draw (.33nhw, 1.1nhw)--(1.1nhw, 1.1nhw);
156 beginchar(25, nhw#, 0, 0);" lower octaveline";
158 draw (.33w, 0)--(.66w, 0);
161 beginchar(26, 0, 0, 0);" final hook for lower octaveline";
163 draw (1.1nhw,0)--(1.1nhw, 1.1nhw);
164 draw (.33nhw,0)--(1.1nhw, 0);
167 beginchar(27, .75nhw#, 0, 0);" used for \bracket";
169 draw origin--(.5nhw, 0);
172 beginchar(29, qqw#, 0, 0);" line ydim 0pt";
177 % lines length xdim 10pt, ydim (-).25 to (-)5pt
180 beginchar(29+j, qqw#, 0, 0); " line ydim "&decimal .25j&"pt";
182 draw origin--(w, .25pt*j);
183 save_pic:= currentpicture;
186 beginchar(49+j, qqw#, 0, 0); " line ydim -"&decimal .25j&"pt";
187 currentpicture:= save_pic reflectedabout (origin, right);
192 message ("<circles>");
196 beginchar(70+n-1, 0, 0, 0);
197 " fullcircle diameter "&decimal ((n+2)*2)&" pt";
200 draw fullcircle scaled diameter;
205 message ("<(de-)crescendi>");
209 crescendowidth:=.5nhh; % \Internote
212 beginchar(84+n-1, 0, 3pt#, 3pt#);
213 " crescendo length "&decimal n&" noteheadwidths";
215 draw (n*widthstep, crescendowidth+.0075n*crescendowidth)--(0,0);
216 addto currentpicture also currentpicture reflectedabout (origin,right);
217 save_pic:= currentpicture;
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);
227 message ("<piano brackets>");
230 % lastbrace is adjustable (originally 99)
232 firstbrace:=20; % smallest brace is 2*20 pt (\simeq 14mm)
233 lastbrace:=67; % largest brace is 2*67 pt (\simeq 47mm)
235 %%% from Stanislav Kneifl
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);
249 penpos1 (max(1,0.1u), 125);
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;
260 currentpicture:=currentpicture shifted (round(-1.75nhh), 0);
265 def bigbrace(expr v) =
266 beginchar (v-firstbrace+148, 0, 0, 0);
267 " brace vsize "&decimal round(2v*pt#)&"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;
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);
284 currentpicture:= currentpicture shifted (round(-.75nhh), 0);
288 %!!! comment the line 'bigbrace' and uncomment the line 'drawpianobracket'
290 for v=firstbrace upto lastbrace :
292 % drawpianobracket (v);