1 % Feta (not the Font-En-Tja) music font -- implement Clefs -*-Fundamental-*-
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>,
5 % Jan Nieuwenhuizen <janneke@gnu.org>,
6 % Juergen Reuter <reuter@ipd.uka.de>
8 % The LilyPond font is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version, or under the SIL Open Font License.
13 % LilyPond is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU General Public License for more details.
18 % You should have received a copy of the GNU General Public License
19 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
22 fet_begingroup ("clefs");
28 % Insert a brushed piece of the path, and draw the rest of the bulb
31 % The bulb has circular form. Neat merging of the bulb and brushed path
32 % is done by playing with tension.
35 def new_bulb (expr start_point, start_angle,
38 big_radius, bulb_radius, flare,
39 direction, turning_dir) =
41 save pat, before, after;
44 path pat, before, after;
49 center = outer_tangent_point
50 + big_radius * dir (0);
51 % + (big_radius - bulb_radius) * dir (-turning_dir * 90)
53 z1' = center + bulb_radius * dir (turning_dir * 180);
54 z2' = outer_tangent_point + flare * dir (0);
55 z3' = center + bulb_radius * dir (0);
56 z4' = center + bulb_radius * dir (turning_dir * 90);
57 z5' = center - 0.5 [big_radius, bulb_radius] * dir (turning_dir * 90);
59 labels (1', 2', 3', 4', 5');
61 before := z3'{dir (turning_dir * 90)}
63 ..tension 1.1.. z1'{-dir (turning_dir* 90)};
64 after := z2'{dir (turning_dir * 90)}
65 .. end_point{dir (end_angle)};
66 (u, v) = before intersectiontimes after;
68 pat := start_point{dir (start_angle)}
69 .. outer_tangent_point{dir (-turning_dir * 90)}
70 ..tension 1.02.. z5'{dir (0)}
71 .. subpath (0, u) of before
72 .. subpath (v, infinity) of after;
84 % [Wanske] says the bulbs should be positioned about 1/4 right of the
87 % TODO: The hair-curve at z6r looks a little awkward.
90 def draw_c_clef (expr reduction) =
91 save hair, norm, reduced_ss, right_edge;
94 reduced_ss# = staff_space# * reduction;
95 norm# := 2/3 reduced_ss#;
96 hair# := 0.06 reduced_ss# + 0.5 linethickness#;
97 right_edge# = 15/4 norm# + 2 hair#;
98 define_pixels (norm, reduced_ss, right_edge);
99 define_whole_vertical_blacker_pixels (hair);
101 set_char_box (0, right_edge#, 2 reduced_ss#, 2 reduced_ss#);
103 % make unreduced glyph fit exactly into five staff lines
105 h := d := 2 staff_space_rounded;
108 % assure that the gap between the left and right stem
109 % has the same number of pixels as the thickness of the right
111 draw_block ((0, -d + feta_shift),
112 (3/4 norm + 1/2 hair, h));
113 draw_block ((3/4 norm + 1/2 hair + hround (3/2 hair), -d + feta_shift),
114 (3/4 norm + 1/2 hair + 2 hround (3/2 hair), h));
121 xoff = 3/4 norm + 1/2 hair + 2 hround (3/2 hair);
122 z5l = (xoff - 3/4 hair, 0);
125 penpos1 (hair - pen_top - pen_bot, -90);
126 top z1l = (xoff + norm + hair, h);
128 penpos2 (hround (norm - 3/2 hair) - pen_lft - pen_rt, 180);
131 penpos3 (hair - pen_top - pen_bot, 90);
132 bot z3l = ((right_edge - xoff) / 2 + xoff,
133 vround (.5 norm - 1.5 hair));
135 penpos4 (hair - pen_lft - pen_rt, 0);
136 top z4 = (xoff + 1/2 norm + 1/2 hair,
137 vfloor (reduced_ss - linethickness - .2 hair));
139 bot z6 = (xoff + 3/4 norm, vround (.5 norm - .5 hair));
151 ..tension t.. z2r{up}
152 ..tension t.. flare_path (top z1l, 180, 90,
153 hair, hfloor (norm - 1/2 hair), -1)
154 ..tension t.. z2l{down}
159 filldraw pat shifted (0, feta_shift)
160 -- reverse pat yscaled -1 shifted (0, -feta_eps)
163 penlabels (1, 2, 3, 4, 5, 6);
165 % ugh, should be bulb, not flare?
167 draw_staff_if_debugging (-2, 2);
171 fet_beginchar ("C clef", "C");
176 fet_beginchar ("C clef", "C_change");
180 def draw_varc_clef (expr reduction) =
181 save hair, norm, reduced_ss;
182 save thick, thin, upper_stroke;
186 reduced_ss# = staff_space# * reduction;
187 norm# := 2/3 reduced_ss#;
188 hair# := 0.06 reduced_ss# + 0.5 linethickness#;
189 define_pixels (norm, reduced_ss);
190 define_whole_vertical_blacker_pixels (hair);
192 set_char_box (0, 2.25 reduced_ss#, 2 reduced_ss#, 2 reduced_ss#);
194 % make unreduced glyph fit exactly into five staff lines
196 h := d := 2 staff_space_rounded;
199 % assure that the gap between the left and right stem
200 % has the same number of pixels as the thickness of the right
202 draw_block ((0, -d + feta_shift),
203 (3/4 norm + 1/2 hair, h));
204 draw_block ((3/4 norm + 1/2 hair + hround (3/2 hair), -d + feta_shift),
205 (3/4 norm + 1/2 hair + 2 hround (3/2 hair), h));
210 thin := hround (3/2 hair);
211 thick := hround (3/4 norm);
213 x1'' = x8'' = x6'' - reduced_ss = 3/4 norm + 1/2 hair + 1.5 hround (3/2 hair);
214 x7'' = x6'' - 1/2 hair;
215 % the thick part of the c clef should be placed in the
216 % center of the forth staff space
217 y1'' = y2'' = 0.5 reduced_ss + thick/2;
219 y7'' = y8'' = y6'' - 1/2 hair = y1'' - thick;
221 x2'' = x3'' = x4'' = x6'' - thin;
223 y5'' = y3'' = y2'' + 0.6 reduced_ss;
226 y4'' = 2.25 reduced_ss;
228 upper_stroke := z1'' -- z2''
229 -- new_bulb (z3'', 90, z4'', z5'', 270,
230 0.37 reduced_ss, 0.33 reduced_ss, thin, 1, -1)
231 -- z6''{down} .. z7''{left} -- z8'' -- cycle;
234 % the c clef parts should be symmetrical to the forth staff line
235 fill upper_stroke yscaled -1;
237 penlabels (1'', 2'', 3'', 4'', 5'', 6'', 7'', 8'');
239 draw_staff_if_debugging (-2, 2);
243 fet_beginchar ("Variant C clef", "varC");
244 draw_varc_clef (1.0);
248 fet_beginchar ("Variant C clef", "varC_change");
249 draw_varc_clef (0.8);
254 % There is some variation in the shape of bass clefs.
256 % * In some clefs the size of the swoosh tip almost reaches the
257 % bottom staff line; in some it crosses the 2nd line from the bottom
258 % with a small overshoot.
260 % The most popular design is where the X part of the tip is aligned
261 % with the left bulb boundary, and the Y part ends on the 2nd
262 % staffline exactly. This is what we do.
264 % * The diameter of the bulb is the width of the open space.
266 % * The vertical center of the bulb can be on or slightly above the
269 % * The vertical position of the dots can be symmetrical around the
270 % staffline, centered in the staff space. The Baerenreiter SCS has
271 % the bottom dot raised by approximately 0.1 staff space.
273 % * Uncarefully set music may have overshoots at the top. We have none.
275 % * It is not exactly clear where the vertical tangent at the right
276 % of the swoosh should be.
279 def draw_bass_clef (expr exact_center, reduction) =
280 save reduced_ss, swoosh_width;
281 save right_thickness, right_offset, tip_protrude;
282 save dot_diam, bulb_y_offset, bulb_flare;
285 reduced_ss# = staff_space# * reduction;
286 2.2 dot_diam# = reduction * (staff_space# - stafflinethickness#);
287 right_thickness# = 0.37 staff_space# + 1.2 linethickness#;
288 swoosh_width# = 2.1 reduced_ss#;
289 define_pixels (swoosh_width);
290 define_whole_pixels (reduced_ss);
291 define_whole_blacker_pixels (dot_diam, right_thickness);
293 right_offset = 0.05 staff_space;
294 bulb_y_offset := 0.075 staff_space;
295 bulb_flare := 2.5 linethickness;
296 % tip_protrude := (-linethickness, -.2 staff_space);
297 tip_protrude := (0, 0);
299 set_char_box (-xpart exact_center,
300 xpart exact_center + swoosh_width# + 7/12 reduced_ss#,
301 -ypart exact_center + 2.5 reduced_ss#,
302 ypart exact_center + reduced_ss#);
310 y2l := vround_pixels (reduced_ss# + 0.5 linethickness#);
311 y2l - y2r = linethickness;
313 x3l - x1 = swoosh_width;
314 x3l - x3r = right_thickness;
316 % optical correction: the top dot seems farther away if y3l = 0.
319 z4 = -(0, 2.0 reduced_ss) + tip_protrude;
321 penpos3 (whatever, 185);
322 penpos4 (linethickness, 135);
324 fill new_bulb (z2l, 180, z1, z2r, 0,
325 0.45 reduced_ss, 0.4 reduced_ss,
328 .. {curl 0}simple_serif (z4r, z4l, 90){curl 0}
330 ..tension 0.9.. cycle;
332 pickup pencircle scaled dot_diam;
334 lft x5 = hround (x3l + 1/3 reduced_ss - dot_diam / 2);
335 bot y5 = vfloor (.5 reduced_ss - dot_diam / 2);
339 y5 := y5 + feta_shift;
344 penlabels (1, 2, 3, 4, 5, 6);
346 draw_staff_if_debugging (-3, 1);
350 fet_beginchar ("F clef ", "F");
351 draw_bass_clef ((0, 0), 1.0);
355 fet_beginchar ("F clef (reduced)", "F_change");
356 draw_bass_clef ((0, 0), 0.8);
362 % Inspired by Baerenreiter
365 % Beste lezers, kijk,
367 % Een bolletje hebben we bij toeval allemaal wel eens getekend, maar begint u
368 % toch eenvoudig. Eerst een eenvoudig kruis of herstellingsteken
369 % en via de dubbelslag naar een voorzichtig vlaggetje, en heb geduld!
370 % Ikzelf heb bijvoorbeeld over mijn eerste gave G-sleutel
371 % 35 kilobyte metafont, 12 patchlevels, 0 vriendinnen en 45 dagen gedaan
373 % -- vrij naar Van Kooten & De Bie
376 def debugfill = fill enddef;
378 def draw_gclef (expr reduction, double_shift, extra_width) =
379 save reduced_ss, double_shift_ss, extra_width_ss;
380 save downstroke_dir, downstroke_angle, center;
381 save breapth_factor, inner_thick_end, thinness, thickness, thinnib;
382 save start_angle, inner_start_angle;
383 save upward_swoosh_angle, bot_angle;
384 save swirl, bulb, pat;
385 save corr_angle, corr, left_, right_, up_, down_, bot_angle_;
386 path swirl, bulb, pat;
387 pair downstroke_dir, center;
389 pair left_, right_, up_, down_;
391 reduced_ss# = staff_space# * reduction;
392 define_pixels (reduced_ss);
394 % G clef has now a smaller upper loop than it used to have.
395 % Too small loop in reduced clef (G_change) interacts badly
396 % with stafflines, so we make reduced clef's loop a bit bigger.
397 reduced_loop_correction := min (max (0.94, (0.6 + 0.46 * reduction)), 1);
399 thinness = 0.095 staff_space + 0.75 linethickness;
400 downstroke_dir = unitvector (14, -75);
401 downstroke_angle = angle downstroke_dir;
402 bot_angle = -180; % downstroke_angle - 87
404 upward_swoosh_angle = 132;
407 breapth_factor = 21/14;
408 inner_thick_end = 45;
409 inner_start_angle = downstroke_angle - 43;
410 thickness = .33 reduced_ss + 1.1 linethickness;
414 set_char_box (0, (1.71 * breapth_factor + double_shift + extra_width) * reduced_ss#,
415 2.55 * reduced_ss#, 4.8 * reduced_ss# / reduced_loop_correction);
417 center := (breapth_factor * reduced_ss, 0);
419 z1 = center + whatever * dir (inner_start_angle);
420 x1 = xpart center - .28 reduced_ss;
421 penpos1 (thinnib, inner_start_angle);
424 y2r = vround_pixels (reduced_ss# + .5 stafflinethickness#);
425 penpos2 (thickness, 90);
427 z3 = (z4 - center) rotated inner_thick_end + center;
428 penpos3 (thinnib, -90 + inner_thick_end);
430 x4 = xpart center - .1 reduced_ss;
431 y4r = -y2r + feta_shift;
432 penpos4 (thinnib, -90);
434 x5r = -breapth_factor * reduced_ss + xpart center;
435 y5r = .37 reduced_ss + ypart center;
436 penpos5 (thickness, upward_swoosh_angle);
438 z6 = center + whatever * downstroke_dir + (-0.02, 0) * reduced_ss;
439 y6 = ypart center + 1.95 reduced_ss / reduced_loop_correction;
440 % penpos6 is computed later
442 z7l - z6 = whatever * (z5 - z6);
443 y7l = 3.38 reduced_ss / reduced_loop_correction;
444 penpos7 (thickness, upward_swoosh_angle);
447 top y9l = 4.78 reduced_ss / reduced_loop_correction;
448 penpos9 (1.45 thickness, -70);
450 x11 - x13r = 1.44 * reduced_ss + 0.5 thinnib;
451 y11 = ypart center - 45/28 reduced_ss;
452 y12 = ypart center - 69/28 reduced_ss;
453 y13 = .48 [y12, y4r];
454 x12r = xpart (.45 [z13r, z11] + .75 reduced_ss * downstroke_dir);
456 % z10 = center + whatever * dir (downstroke_angle - 1.5);
457 x10 = x6 - 1.85 thinnib * reduction / reduced_loop_correction;
458 y10 = ypart center + 3.32 reduced_ss / reduced_loop_correction;
459 y10l - y10r = 1.0 thickness;
460 z10r - z10l = .7 thinnib * dir (downstroke_angle + 90)
461 + whatever * downstroke_dir;
462 z10 = .5 [z10l, z10r];
463 z11 = center + whatever * downstroke_dir + (0.03 reduced_ss, 0);
465 penpos11 (thinnib, start_angle + 90);
466 penpos12 (thinnib, bot_angle + 90);
467 penpos13 (thinnib + 0.14 staff_space, 180);
469 % this auxiliary point ensures good contour overlapping
470 z8 = .5 [z9l, z9r] + .25 ((z9r - z9l) rotated -90);
472 z20 = z9l - (0, .25 blot_diameter);
473 penpos20 (blot_diameter, 0);
477 ..tension 1.1.. z11{dir (start_angle)};
479 penpos6 (thinnib, angle (direction 1 of pat) + 90);
481 % two auxiliary points to simulate `draw' with `penstroke'
482 z10' = point 0.3 of pat;
483 penpos10' (1.3 thinnib, angle (direction 0.3 of pat) + 50);
485 z11' = point 1.5 of pat + (0.033, -0.5) * reduced_ss;
486 penpos11' (thinnib, angle (direction 1.5 of pat) + 90);
491 % after computing all points, we want to rotate the clef
492 % rotating the whole picture won't work due to the complexity
493 % of the path and metafont's memory limitations, so we transform
494 % each point and draw the clef thereafter
496 corr := identity rotatedabout (center, -corr_angle);
498 bot_angle_ := bot_angle + corr_angle;
500 left_ := left rotated corr_angle;
501 right_ := right rotated corr_angle;
502 up_ := up rotated corr_angle;
503 down_ := down rotated corr_angle;
505 % transform points; we transform every point and save it
506 % to a shifted index range: z1 -> z101, z2 -> z102, etc.
508 forsuffixes e := l,,r:
509 z[n+100]e = z[n]e transformed corr;
513 % transform helper points
515 forsuffixes e := l,,r:
516 z[n+100]'e = z[n]'e transformed corr;
524 swirl := z102l{right}
527 ..tension 1.07.. z105l{up_}% inside curve
529 ..tension 1.2.. z120r{curl 1}
530 .. {direction 0 of pat}z120l
532 -- z109r % {dir (downstroke_angle + 0)}
533 ..tension 0.8.. z107r{down_}
538 ..tension .95.. z101r
539 -- simple_serif (z101r, z101l, 80)
541 ..tension 0.85.. cycle;
549 .. z111e{dir (-95 + corr_angle)}
550 .. z112e{dir (bot_angle_)};
552 bulb := new_bulb (z112r, bot_angle_, z113r, z112l, bot_angle_ + 180,
553 0.45 reduced_ss, 0.38 reduced_ss,
554 thinnib + .05 staff_space, 1, -1)
559 if double_shift <> 0:
560 addto currentpicture also
561 currentpicture shifted (double_shift * reduced_ss, 0);
564 penlabels (range 101 thru 121);
565 penlabels (110', 111');
567 draw_staff_if_debugging (-1, 3);
571 fet_beginchar ("G clef", "G");
572 draw_gclef (1.0, 0, 0);
576 fet_beginchar ("G clef", "G_change");
577 draw_gclef (0.8, 0, 0);
581 fet_beginchar ("double G clef", "GG");
582 draw_gclef (1.0, 1.5, 0);
586 fet_beginchar ("double G clef", "GG_change");
587 draw_gclef (0.8, 1.5, 0);
590 def draw_tenor_extension (expr reduction) =
591 save reduced_ss, thick, thin, upper_stroke, ne_beam_dir, nw_dist;
593 pair ne_beam_dir, nw_dist;
595 reduced_ss# = staff_space# * reduction;
596 define_pixels (reduced_ss);
598 thin := hround (0.17 reduced_ss);
599 thick := hround (0.51 reduced_ss);
601 % the slanted left edge should protrude the g clef by a
602 % fixed amount relative to the width of the g clef:
603 x1'' = x6'' - 1.8 reduced_ss - 0.5 staff_space = 0.62 reduced_ss * reduction;
604 x8'' = x1'' - 2 thin;
605 x2'' = x3'' = x4'' = x6'' - thin;
607 x7'' = x6'' - 1/3 thin;
608 % the thick part of the c clef should be placed in the
609 % center of the forth staff space
610 y1'' = y2'' = 2.5 staff_space + thick/2;
611 y7'' = y8'' = y6'' - 1/3 thin = y1'' - thick;
612 y5'' = y3'' = y2'' + reduced_ss;
613 y4'' = 4.5 reduced_ss;
616 -- new_bulb (z3'', 90, z4'', z5'', 270,
617 0.35 reduced_ss, 0.22 reduced_ss, thin, 1, -1)
618 -- z6''{down} .. z7''{left};
620 % z1'' and z8'' are helper points that are responsible for
621 % hiding the lower left slant in the g clef's stroke
622 % z9'' and z10'' are computed to obtain nice rounded corners
624 pickup pencircle scaled 2/3 thin;
631 ne_beam_dir = unitvector (z9'' - z10'');
632 nw_dist = (ne_beam_dir rotated 90) * 1/3 thin;
634 fill (z9''+nw_dist){ne_beam_dir}
638 ... (z10''+nw_dist){ne_beam_dir}
641 % the slanted edge of the lower hook must not be visible, so it is
642 % shifted accordingly in x direction;
643 z1''' = z1'' shifted (staff_space - 0.9 reduced_ss, - staff_space);
644 z8''' = z8'' shifted (staff_space - 0.9 reduced_ss, - staff_space);
646 % the visible c clef parts should be symmetrical to the forth staff line
648 -- reverse upper_stroke yscaled -1 shifted (0, 4 staff_space)
651 penlabels (1''',2'',3'',4'',5'',6'',7'',8''',9'',10'');
653 draw_staff_if_debugging (-1, 3);
656 fet_beginchar ("Tenor G clef", "tenorG");
657 draw_gclef (1.0, 0, 0.75);
658 draw_tenor_extension (1.0);
662 fet_beginchar ("Tenor G clef", "tenorG_change");
663 draw_gclef (0.8, 0, 0.75);
664 draw_tenor_extension (0.8);
673 % The percussion clef extent is not coincident with its bbox, since
674 % the percussion clef needs more space in front than a normal clef.
677 def draw_percussion_clef (expr reduction) =
678 save reduced_ss, razt;
680 reduced_ss# = staff_space# * reduction;
681 define_pixels (reduced_ss);
683 set_char_box (-.67 reduced_ss#, 2.0 reduced_ss#,
684 reduced_ss#, reduced_ss#);
686 razt := hround (0.45 reduced_ss);
690 draw_block ((-b, -d), (-b + razt, h));
691 draw_block ((w - razt, -d), (w, h));
693 draw_staff_if_debugging (-3, 1);
697 fet_beginchar ("percussion clef", "percussion");
698 draw_percussion_clef (1.0);
702 fet_beginchar ("percussion clef (reduced)", "percussion_change");
703 draw_percussion_clef (.8);
706 def draw_varpercussion_clef (expr reduction) =
707 save reduced_ss, thin, thick;
709 reduced_ss# = staff_space# * reduction;
710 define_pixels (reduced_ss);
712 set_char_box (-.67 reduced_ss#, 1.75 reduced_ss#,
713 1.675 reduced_ss#, 1.675 reduced_ss#);
715 thin := hround (0.175 reduced_ss);
716 thick := hround (0.35 reduced_ss);
720 draw_block ((-b, -d), (-b + thin, h));
721 draw_block ((w - thin, -d), (w, h));
723 pickup penrazor scaled thick rotated 90;
725 top z1 = (-b + thin/2, h);
726 top z2 = (w - thin/2, h);
728 bot z3 = (-b + thin/2, -d);
729 bot z4 = (w - thin/2, -d);
734 penlabels (range 1 thru 4);
736 draw_staff_if_debugging (-3, 1);
740 fet_beginchar ("variant percussion clef", "varpercussion");
741 draw_varpercussion_clef (1.0);
745 fet_beginchar ("variant percussion clef (reduced)", "varpercussion_change");
746 draw_varpercussion_clef (.8);
750 def draw_tab_T (expr pos, siz, slant) =
757 vx = (xpart siz) * dir 0;
758 vy = (ypart siz) * dir 90;
760 penpos1 (.75 penh, 100);
761 z1 = z2 + (1/6 * vx - .15 * vy);
762 penpos2 (hround (.9 penw), 0);
763 x2l = hround xpart (pos + .75 vy);
764 y2l = ypart (pos + .75 vy);
765 penpos3 (penh, -100);
766 z3l = pos + .4 vx + vy;
768 z4 = -.1 vy + .5 [z3, z5];
769 penpos5 (.8 penh, -30);
770 x5r = xpart (pos + siz);
771 y5l = ypart (pos + siz);
773 penpos10 (penw, 170);
774 z10 = pos + .55 vx + .9 vy;
775 penpos11 (.75 [penh, penw], 170);
776 z11 = z10 - .5 vy + .025 vx;
777 penpos12 (penh, 100);
778 z12l = (xpart .5 [z13, z11], ypart (pos - .025 * siz));
779 penpos13 (.75 penh, 60);
780 z13 = pos + .2 vx + .15 vy;
782 % penlabels (range 1 thru 13);
789 slanted slant shifted (slant * -ypart pos, 0);
791 soft_end_penstroke (z10e
794 ..tension 1.1.. z13e{(z13r - z13l) rotated 90})
795 slanted slant shifted (slant * -ypart pos, 0);
800 def draw_tab_A (expr pos, siz, slant) =
808 vx = (xpart siz) * dir 0;
809 vy = (ypart siz) * dir 90;
811 penpos1 (.75 penh, -110);
814 z2r = (.5 [x1, x3], ypart pos);
815 penpos3 (.25 [penh, penw], -30);
816 z3 = (.45 [x2, x4], .15 [y2, y4]);
817 penpos4 (1 [penh, penw], 0);
818 z4 = pos + .5 vx + .975 vy;
820 penpos5 (1 [penh, penw], -180);
822 penpos6 (.2 [penh, penw], -150);
823 z6l = (.8 [x5l, x7l], .9 [y5l, y7l]);
825 z7r = (.5 [x6, x8], ypart pos);
826 penpos8 (.75 penh, -70);
827 z8r = (xpart (pos + siz), y7r + .075 ypart (siz));
833 penpos10 (penh, angle (direction 1.2 of pat) - 180);
834 z10 = point 1.2 of pat;
835 penpos11 (.9 penh, -90);
836 z11 = .4 [z10, z6] - 0.05 vy;
837 penpos12 (.75 penh, -75);
838 z12 = .3 [z11, z6] + 0.02 vy;
840 % penlabels (range 1 thru 12);
842 soft_penstroke (z1e{(z1r - z1l) rotated 90}
846 slanted slant shifted (slant * -ypart pos, 0);
848 soft_end_penstroke (z5e
851 .. z8e{(z8r - z8l) rotated 90})
852 slanted slant shifted (slant * -ypart pos, 0);
854 soft_end_penstroke (z10e
857 slanted slant shifted (slant * -ypart pos, 0);
862 def draw_tab_B (expr pos, siz, slant) =
869 vx = (xpart siz) * dir 0;
870 vy = (ypart siz) * dir 90;
872 penpos1 (.75 penh, 100);
873 z1 = z2 + (.15 * vx - .1 * vy);
874 penpos2 (hround (.9 penw), 0);
875 x2l = hround xpart (pos + .75 vy);
876 y2l = ypart (pos + .75 vy);
877 penpos3 (penh, -100);
878 z3l = pos + .4 vx + 1.05 vy;
879 penpos4 (.8 [penh, penw], -180);
880 z4 = (xpart (pos + .75 siz), .5 [y3, y5]);
881 penpos5 (.8 penh, 90);
882 z5 = (.5 [x10, x4], ypart (pos + .55 siz));
884 penpos6 (.8 penh, 270);
887 z7l = (xpart (pos + siz), .5 [y6, y8]);
888 penpos8 (.8 penh, 45);
889 z8 = .5 [z12l, z11l] + .15 vx - .05 vy;
891 penpos10 (.75 [penh, penw], 170);
892 z10 = pos + .375 vx + vy;
893 penpos11 (.8 [penh, penw], 150);
894 z11 = z10 - .5 vy + .04 vx;
895 penpos12 (penh, 100);
896 z12l = (xpart .5 [z13, z11], ypart pos);
897 penpos13 (.75 penh, 60);
898 z13 = pos + .1 vx + .15 vy;
900 % penlabels (range 1 thru 13);
907 slanted slant shifted (slant * -ypart pos, 0);
909 soft_end_penstroke (z6e{right}
911 .. z8e{(z8r - z8l) rotated 90})
912 slanted slant shifted (slant * -ypart pos, 0);
914 soft_end_penstroke (z10e
917 ..tension 1.1.. z13e{(z13r - z13l) rotated 90})
918 slanted slant shifted (slant * -ypart pos, 0);
923 def draw_tab_clef (expr reduction) =
924 save reduced_ss, letterheight, penw, penh;
926 reduced_ss# = staff_space# * reduction;
927 letterheight# = 1.8 reduced_ss#;
928 define_pixels (reduced_ss, letterheight);
930 set_char_box (-.2 reduced_ss#, 2.8 reduced_ss#,
931 1.6 letterheight#, 1.6 letterheight#);
933 penw = .45 reduced_ss;
934 penh = .2 reduced_ss;
936 draw_tab_T ((-b + .15 reduced_ss, h - letterheight),
937 (2.1 reduced_ss, letterheight), 0.2);
938 draw_tab_A ((-b - .05 reduced_ss, -.5 letterheight +.15 reduced_ss),
939 (2.2 reduced_ss, letterheight), 0.4);
940 draw_tab_B ((-b + .025 reduced_ss, -d),
941 (2.1 reduced_ss, letterheight), 0.25);
943 draw_staff_if_debugging (-3, 2);
947 fet_beginchar ("tab clef", "tab");
952 fet_beginchar ("tab clef (reduced)", "tab_change");
956 fet_endgroup ("clefs");