3 sharp_beamheight# := 0.3 staff_space# + stafflinethickness#;
6 % The beams of most sharps have horizontal endings (as if drawn with
7 % a square pen). [Wanske] does not mention this, so we'll just ignore
11 def draw_meta_sharp (expr width, offset) =
12 save beamwidth, beamslope;
18 define_whole_vertical_blacker_pixels (sharp_beamheight);
22 beamslope = sharp_beamheight / beamwidth;
24 pickup pencircle scaled 2 blot_diameter;
26 rt x2 - lft x1 = beamwidth;
27 z2 = z1 + whatever * (beamwidth, sharp_beamheight);
28 .5 [z1, z3] = (.5 w, offset);
30 top y2 - bot y3 = sharp_beamheight;
32 top y1 - bot y4 = sharp_beamheight;
34 ne = unitvector (z2 - z1);
35 nw_dist = (ne rotated 90) * blot_diameter;
38 ... (z1 + nw_dist){ne}
42 ... (z3 - nw_dist){-ne}
43 -- (z4 - nw_dist){-ne}
51 def draw_sharp(expr arrowup, arrowdown) =
52 save stem, stemx, stemwidth;
53 save outer_space, interbeam;
54 save stemlength, extendleft, extendright, height, depth;
56 stemwidth# := stafflinethickness# + .05 staff_space#;
57 define_whole_blacker_pixels (stemwidth);
59 interbeam := 1.05 staff_space_rounded;
61 stemlength# := 1.5 staff_space#;
62 define_pixels (stemlength);
64 height# = stemlength#;
69 height# := height# + 1.2 staff_space#;
70 extendright# := extendright# + 1.5 stafflinethickness#;
73 depth# := depth# + 1.2 staff_space#;
74 extendleft# := extendleft# + 1.5 stafflinethickness#;
76 define_pixels (extendleft, extendright);
77 set_char_box (extendleft#, 1.1 staff_space#, depth#, height#);
81 outer_space := hround ((w - stemx - stemwidth) / 2);
83 w := 2 outer_space + stemx + stemwidth;
84 d := d - feta_space_shift;
86 draw_meta_sharp (w, -.5 interbeam);
87 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
89 % expand the charbox so that it encloses the whole arrow;
90 % this must not happen earlier because some commands above
91 % still rely on the old width
94 pickup pencircle scaled stemwidth;
96 lft x5 = lft x6 = outer_space;
97 lft x7 = lft x8 = outer_space + stemx;
99 top y6 = vround (1.5 staff_space - stem * beamslope);
100 bot y7 = -top y6 + feta_space_shift;
105 draw_gridline (z5, z6, stemwidth);
106 draw_gridline (z7, z8, stemwidth);
109 draw_arrow (z8, stemwidth, up,
110 stafflinethickness / 2 + stemwidth / 2, false);
113 draw_arrow (z5, stemwidth, up,
114 stafflinethickness / 2 + stemwidth / 2, true);
117 remember_pic := currentpicture;
119 draw_staff (-2, 2, 0);
123 fet_beginchar ("Sharp", "sharp");
124 draw_sharp (false, false);
131 fet_beginchar ("Arrowed Sharp (arrow up)", "sharp.arrowup");
132 draw_sharp (true, false);
139 fet_beginchar ("Arrowed Sharp (arrow down)", "sharp.arrowdown");
140 draw_sharp (false, true);
147 fet_beginchar ("Arrowed Sharp (arrows up and down)", "sharp.arrowboth");
148 draw_sharp (true, true);
155 fet_beginchar ("1/2 Sharp", "sharp.slashslash.stem");
156 save stem, stemwidth;
157 save outer_space, interbeam;
159 stemwidth# := stafflinethickness# + .05 staff_space#;
160 define_whole_blacker_pixels (stemwidth);
162 interbeam := 1.05 staff_space_rounded;
164 set_char_box (0, 0.7 staff_space#,
165 1.5 staff_space#, 1.5 staff_space#);
168 outer_space := hround ((w - stemwidth) / 2);
170 w := 2 outer_space + stemwidth;
171 d := d - feta_space_shift;
173 draw_meta_sharp (w, -.5 interbeam);
174 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
176 pickup pencircle scaled stemwidth;
178 lft x5 = lft x6 = outer_space;
179 top y6 = vround (1.5 staff_space - .5 stem);
180 bot y5 = -top y6 + feta_space_shift;
184 draw_gridline (z5, z6, stemwidth);
186 remember_pic := currentpicture;
188 draw_staff (-2, 2, 0);
195 fet_beginchar ("Sharp (3 beams)", "sharp.slashslashslash.stemstem");
196 save stem, stemx, stemwidth;
197 save outer_space, interbeam;
198 save sharp_beamheight;
200 sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
202 stemwidth# := stafflinethickness# + .05 staff_space#;
203 define_whole_blacker_pixels (stemwidth);
205 interbeam := 1.2 staff_space_rounded;
207 set_char_box (0, 1.1 staff_space#,
208 1.5 staff_space#, 1.5 staff_space#);
211 stemx := hround stem;
212 outer_space := hround ((w - stemx - stemwidth) / 2);
214 w := 2 outer_space + stemx + stemwidth;
215 d := d - feta_space_shift;
217 draw_meta_sharp (.88 w, -.5 interbeam);
218 draw_meta_sharp (.88 w, -.5 interbeam + vround interbeam);
219 sharp_beamheight# := 1/.88 sharp_beamheight#;
220 draw_meta_sharp (w, 0);
222 pickup pencircle scaled stemwidth;
224 lft x5 = lft x6 = outer_space;
225 lft x7 = lft x8 = outer_space + stemx;
227 top y6 = vround (1.5 staff_space - stem * beamslope);
228 bot y7 = -top y6 + feta_space_shift;
233 draw_gridline (z5, z6, stemwidth);
234 draw_gridline (z7, z8, stemwidth);
236 remember_pic := currentpicture;
238 draw_staff (-2, 2, 0);
245 fet_beginchar ("1/2 Sharp (3 beams)", "sharp.slashslashslash.stem");
246 save stem, stemx, stemwidth;
247 save outer_space, interbeam;
248 save sharp_beamheight;
250 sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
252 stemwidth# := stafflinethickness# + .05 staff_space#;
253 define_whole_blacker_pixels (stemwidth);
255 interbeam := 1.2 staff_space_rounded;
257 set_char_box (0, 0.95 staff_space#,
258 1.3 staff_space#, 1.3 staff_space#);
261 outer_space := hround ((w - stemwidth) / 2);
263 w := 2 outer_space + stemwidth;
264 d := d - feta_space_shift;
266 draw_meta_sharp (.8 w, -.5 interbeam);
267 draw_meta_sharp (.8 w, -.5 interbeam + vround interbeam);
268 sharp_beamheight# := 1/.8 sharp_beamheight#;
269 draw_meta_sharp (w, 0);
271 pickup pencircle scaled stemwidth;
273 lft x5 = lft x6 = outer_space;
274 top y6 = vround (1.5 staff_space - .5 stem);
275 bot y5 = -top y6 + feta_space_shift;
278 draw_gridline (z5, z6, stemwidth);
280 remember_pic := currentpicture;
282 draw_staff (-2, 2, 0);
289 fet_beginchar ("3/4 Sharp", "sharp.slashslash.stemstemstem");
290 save stem, stemx, stemwidth;
291 save outer_space, interbeam;
293 stemwidth# := stafflinethickness# + .05 staff_space#;
294 define_whole_blacker_pixels (stemwidth);
296 interbeam := 1.05 staff_space_rounded;
298 set_char_box (0, 1.6 staff_space#,
299 1.5 staff_space#, 1.5 staff_space#);
302 stemx := hround stem;
303 outer_space := hround ((w - 2 stemx - stemwidth) / 2);
305 w := 2 outer_space + 2 stemx + stemwidth;
306 d := d - feta_space_shift;
308 draw_meta_sharp (w, -.5 interbeam);
309 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
311 pickup pencircle scaled stemwidth;
313 lft x5 = lft x6 = outer_space;
314 lft x7 = lft x8 = outer_space + stemx;
315 lft x9 = lft x10 = outer_space + 2 stemx;
317 top y6 = vround (1.5 staff_space - 2 stem * beamslope);
318 bot y9 = -top y6 + feta_space_shift;
323 labels (5, 6, 7, 8, 9, 10);
325 draw_gridline (z5, z6, stemwidth);
326 draw_gridline (z7, z8, stemwidth);
327 draw_gridline (z9, z10, stemwidth);
329 remember_pic := currentpicture;
331 draw_staff (-2, 2, 0);
338 fet_beginchar ("Double Sharp", "doublesharp");
339 save klaverblad, klaversteel;
343 klaversteel = 1/15 staff_space;
344 klaverblad = .4 staff_space - .5 stafflinethickness;
346 set_char_box (0, staff_space#, .5 staff_space#, .5 staff_space#);
348 z1 = (klaversteel, 0);
349 z2 = (w / 2 - klaverblad / 10, h - klaverblad);
351 z4 = z2 reflectedabout ((0, 0), (1, 1));
352 z5 = z1 reflectedabout ((0, 0), (1, 1));
354 labels (1, 2, 3, 4, 5);
356 pickup pencircle scaled blot_diameter;
358 x2 := hfloor (rt x2) - blot_diameter / 2;
359 x3 := hfloor (rt x3) - blot_diameter / 2;
360 y3 := vfloor (top y3) - blot_diameter / 2;
361 y4 := vfloor (top y4) - blot_diameter / 2;
370 .. {dir 225}(top z5);
372 -- reverse pat xscaled -1 shifted (-feta_eps, 0);
374 % assure symmetry -- it's more important to center the glyph on the
375 % staff line than centering it between staff lines, so we use
376 % feta_shift, not feta_space_shift.
379 fill pat shifted (0, feta_shift)
380 -- reverse pat yscaled -1 shifted (0, -feta_eps)
384 currentpicture := currentpicture shifted (hround (w / 2), 0);
386 remember_pic := currentpicture;
388 draw_staff (-2, 2, 0);