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 draw_staff_if_debugging (-2, 2);
121 fet_beginchar ("Sharp", "sharp");
122 draw_sharp (false, false);
126 fet_beginchar ("Arrowed Sharp (arrow up)", "sharp.arrowup");
127 draw_sharp (true, false);
131 fet_beginchar ("Arrowed Sharp (arrow down)", "sharp.arrowdown");
132 draw_sharp (false, true);
136 fet_beginchar ("Arrowed Sharp (arrows up and down)", "sharp.arrowboth");
137 draw_sharp (true, true);
141 fet_beginchar ("1/2 Sharp", "sharp.slashslash.stem");
142 save stem, stemwidth;
143 save outer_space, interbeam;
145 stemwidth# := stafflinethickness# + .05 staff_space#;
146 define_whole_blacker_pixels (stemwidth);
148 interbeam := 1.05 staff_space_rounded;
150 set_char_box (0, 0.7 staff_space#,
151 1.5 staff_space#, 1.5 staff_space#);
154 outer_space := hround ((w - stemwidth) / 2);
156 w := 2 outer_space + stemwidth;
157 d := d - feta_space_shift;
159 draw_meta_sharp (w, -.5 interbeam);
160 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
162 pickup pencircle scaled stemwidth;
164 lft x5 = lft x6 = outer_space;
165 top y6 = vround (1.5 staff_space - .5 stem);
166 bot y5 = -top y6 + feta_space_shift;
170 draw_gridline (z5, z6, stemwidth);
172 draw_staff_if_debugging (-2, 2);
176 fet_beginchar ("Sharp (3 beams)", "sharp.slashslashslash.stemstem");
177 save stem, stemx, stemwidth;
178 save outer_space, interbeam;
179 save sharp_beamheight;
181 sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
183 stemwidth# := stafflinethickness# + .05 staff_space#;
184 define_whole_blacker_pixels (stemwidth);
186 interbeam := 1.2 staff_space_rounded;
188 set_char_box (0, 1.1 staff_space#,
189 1.5 staff_space#, 1.5 staff_space#);
192 stemx := hround stem;
193 outer_space := hround ((w - stemx - stemwidth) / 2);
195 w := 2 outer_space + stemx + stemwidth;
196 d := d - feta_space_shift;
198 draw_meta_sharp (.88 w, -.5 interbeam);
199 draw_meta_sharp (.88 w, -.5 interbeam + vround interbeam);
200 sharp_beamheight# := 1/.88 sharp_beamheight#;
201 draw_meta_sharp (w, 0);
203 pickup pencircle scaled stemwidth;
205 lft x5 = lft x6 = outer_space;
206 lft x7 = lft x8 = outer_space + stemx;
208 top y6 = vround (1.5 staff_space - stem * beamslope);
209 bot y7 = -top y6 + feta_space_shift;
214 draw_gridline (z5, z6, stemwidth);
215 draw_gridline (z7, z8, stemwidth);
217 draw_staff_if_debugging (-2, 2);
221 fet_beginchar ("1/2 Sharp (3 beams)", "sharp.slashslashslash.stem");
222 save stem, stemx, stemwidth;
223 save outer_space, interbeam;
224 save sharp_beamheight;
226 sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
228 stemwidth# := stafflinethickness# + .05 staff_space#;
229 define_whole_blacker_pixels (stemwidth);
231 interbeam := 1.2 staff_space_rounded;
233 set_char_box (0, 0.95 staff_space#,
234 1.3 staff_space#, 1.3 staff_space#);
237 outer_space := hround ((w - stemwidth) / 2);
239 w := 2 outer_space + stemwidth;
240 d := d - feta_space_shift;
242 draw_meta_sharp (.8 w, -.5 interbeam);
243 draw_meta_sharp (.8 w, -.5 interbeam + vround interbeam);
244 sharp_beamheight# := 1/.8 sharp_beamheight#;
245 draw_meta_sharp (w, 0);
247 pickup pencircle scaled stemwidth;
249 lft x5 = lft x6 = outer_space;
250 top y6 = vround (1.5 staff_space - .5 stem);
251 bot y5 = -top y6 + feta_space_shift;
254 draw_gridline (z5, z6, stemwidth);
256 draw_staff_if_debugging (-2, 2);
260 fet_beginchar ("3/4 Sharp", "sharp.slashslash.stemstemstem");
261 save stem, stemx, stemwidth;
262 save outer_space, interbeam;
264 stemwidth# := stafflinethickness# + .05 staff_space#;
265 define_whole_blacker_pixels (stemwidth);
267 interbeam := 1.05 staff_space_rounded;
269 set_char_box (0, 1.6 staff_space#,
270 1.5 staff_space#, 1.5 staff_space#);
273 stemx := hround stem;
274 outer_space := hround ((w - 2 stemx - stemwidth) / 2);
276 w := 2 outer_space + 2 stemx + stemwidth;
277 d := d - feta_space_shift;
279 draw_meta_sharp (w, -.5 interbeam);
280 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
282 pickup pencircle scaled stemwidth;
284 lft x5 = lft x6 = outer_space;
285 lft x7 = lft x8 = outer_space + stemx;
286 lft x9 = lft x10 = outer_space + 2 stemx;
288 top y6 = vround (1.5 staff_space - 2 stem * beamslope);
289 bot y9 = -top y6 + feta_space_shift;
294 labels (5, 6, 7, 8, 9, 10);
296 draw_gridline (z5, z6, stemwidth);
297 draw_gridline (z7, z8, stemwidth);
298 draw_gridline (z9, z10, stemwidth);
300 draw_staff_if_debugging (-2, 2);
304 fet_beginchar ("Double Sharp", "doublesharp");
305 save klaverblad, klaversteel;
309 klaversteel = 1/15 staff_space;
310 klaverblad = .4 staff_space - .5 stafflinethickness;
312 set_char_box (0, staff_space#, .5 staff_space#, .5 staff_space#);
314 z1 = (klaversteel, 0);
315 z2 = (w / 2 - klaverblad / 10, h - klaverblad);
317 z4 = z2 reflectedabout ((0, 0), (1, 1));
318 z5 = z1 reflectedabout ((0, 0), (1, 1));
320 labels (1, 2, 3, 4, 5);
322 pickup pencircle scaled blot_diameter;
324 x2 := hfloor (rt x2) - blot_diameter / 2;
325 x3 := hfloor (rt x3) - blot_diameter / 2;
326 y3 := vfloor (top y3) - blot_diameter / 2;
327 y4 := vfloor (top y4) - blot_diameter / 2;
336 .. {dir 225}(top z5);
338 -- reverse pat xscaled -1 shifted (-feta_eps, 0);
340 % assure symmetry -- it's more important to center the glyph on the
341 % staff line than centering it between staff lines, so we use
342 % feta_shift, not feta_space_shift.
345 fill pat shifted (0, feta_shift)
346 -- reverse pat yscaled -1 shifted (0, -feta_eps)
350 currentpicture := currentpicture shifted (hround (w / 2), 0);
352 draw_staff_if_debugging (-2, 2);