]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-clefs.mf
68589a34c500753a37e146b24b6254d910636111
[lilypond.git] / mf / feta-clefs.mf
1 % Feta (not the Font-En-Tja) music font --  implement Clefs -*-Fundamental-*-
2 % This file is part of LilyPond, the GNU music typesetter.
3 %
4 % Copyright (C) 1997--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>,
5 % Jan Nieuwenhuizen <janneke@gnu.org>,
6 % Juergen Reuter <reuter@ipd.uka.de>
7 %
8 % LilyPond 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.
12 %
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.
17 %
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/>.
20
21
22 fet_begingroup ("clefs");
23
24 %
25 % [Wanske] says the bulbs should be positioned about 1/4 right of the
26 % `arrow'.
27 %
28 % TODO: The hair-curve at z6r looks a little awkward.
29 %
30
31 def draw_c_clef (expr reduction) =
32         save hair, norm, reduced_ss, right_edge;
33         save xoff;
34
35         reduced_ss# = staff_space# * reduction;
36         norm# := 2/3 reduced_ss#;
37         hair# := 0.06 reduced_ss# + 0.5 linethickness#;
38         right_edge# = 15/4 norm# + 2 hair#;
39         define_pixels (norm, reduced_ss, right_edge);
40         define_whole_vertical_blacker_pixels (hair);
41
42         set_char_box (0, right_edge#, 2 reduced_ss#, 2 reduced_ss#);
43
44         % make unreduced glyph fit exactly into five staff lines
45         if reduction = 1:
46                 h := d := 2 staff_space_rounded;
47         fi;
48
49         % assure that the gap between the left and right stem
50         % has the same number of pixels as the thickness of the right
51         % stem
52         draw_block ((0, -d + feta_shift),
53                     (3/4 norm + 1/2 hair, h));
54         draw_block ((3/4 norm + 1/2 hair + hround (3/2 hair), -d + feta_shift),
55                     (3/4 norm + 1/2 hair + 2 hround (3/2 hair), h));
56
57         % assure symmetry
58         h := h - feta_shift;
59
60         pickup feta_fillpen;
61
62         xoff = 3/4 norm + 1/2 hair + 2 hround (3/2 hair);
63         z5l = (xoff - 3/4 hair, 0);
64         z5r = (x4, 0);
65
66         penpos1 (hair - pen_top - pen_bot, -90);
67         top z1l = (xoff + norm + hair, h);
68
69         penpos2 (hround (norm - 3/2 hair) - pen_lft - pen_rt, 180);
70         rt z2l = (w, h / 2);
71
72         penpos3 (hair - pen_top - pen_bot, 90);
73         bot z3l = ((right_edge - xoff) / 2 + xoff,
74                    vround (.5 norm - 1.5 hair));
75
76         penpos4 (hair - pen_lft - pen_rt, 0);
77         top z4 = (xoff + 1/2 norm + 1/2 hair,
78                   vfloor (reduced_ss - linethickness - .2 hair));
79
80         bot z6 = (xoff + 3/4 norm, vround (.5 norm - .5 hair));
81
82         save t;
83         t = 0.833;
84
85         save pat;
86         path pat;
87
88         pat = z5l{curl 1}
89               .. z4l{up}
90               .. z4r{down}
91               .. z3r{right}
92               ..tension t.. z2r{up}
93               ..tension t.. flare_path (top z1l, 180, 90,
94                                         hair, hfloor (norm - 1/2 hair), -1)
95               ..tension t.. z2l{down}
96               .. z3l{left}
97               .. z6
98               .. z5r{down};
99
100         filldraw pat shifted (0, feta_shift)
101                  -- reverse pat yscaled -1 shifted (0, -feta_eps)
102                  -- cycle;
103
104         penlabels (1, 2, 3, 4, 5, 6);
105
106         % ugh, should be bulb, not flare?
107
108         draw_staff (-2, 2, 0);
109 enddef;
110
111
112 fet_beginchar ("C clef", "C");
113         draw_c_clef (1.0);
114 fet_endchar;
115
116
117 fet_beginchar ("C clef", "C_change");
118         draw_c_clef (.8);
119 fet_endchar;
120
121
122 %
123 % New bulb routine:
124 %
125 % Insert a brushed piece of the path, and draw the rest of the bulb
126 % separately.
127 %
128 % The bulb has circular form.  Neat merging of the bulb and brushed path
129 % is done by playing with tension.
130 %
131
132 def new_bulb (expr start_point, start_angle,
133               outer_tangent_point,
134               end_point, end_angle,
135               big_radius, bulb_radius, flare,
136               direction, turning_dir) =
137 begingroup;
138         save pat, before, after;
139         save center;
140         save u, v;
141         path pat, before, after;
142         pair center;
143
144         clearxy;
145
146         center = outer_tangent_point
147                  + big_radius * dir (0);
148 %                + (big_radius - bulb_radius) * dir (-turning_dir * 90)
149
150         z1' = center + bulb_radius * dir (turning_dir * 180);
151         z2' = outer_tangent_point + flare * dir (0);
152         z3' = center + bulb_radius * dir (0);
153         z4' = center + bulb_radius * dir (turning_dir * 90);
154         z5' = center - 0.5 [big_radius, bulb_radius] * dir (turning_dir * 90);
155
156         labels (1', 2', 3', 4', 5');
157
158         before := z3'{dir (turning_dir * 90)}
159                   .. z4'{-dir (0)}
160                   ..tension 1.1.. z1'{-dir (turning_dir* 90)};
161         after := z2'{dir (turning_dir * 90)}
162                  .. end_point{dir (end_angle)};
163         (u, v) = before intersectiontimes after;
164
165         pat := start_point{dir (start_angle)}
166                .. outer_tangent_point{dir (-turning_dir * 90)}
167                ..tension 1.02.. z5'{dir (0)}
168                .. subpath (0, u) of before
169                .. subpath (v, infinity) of after;
170
171         if direction = 0:
172                 pat := reverse pat;
173         fi
174
175 pat
176 endgroup
177 enddef;
178
179
180 %
181 % There is some variation in the shape of bass clefs.
182 %
183 % * In some clefs the size of the swoosh tip almost reaches the
184 %   bottom staff line; in some it crosses the 2nd line from the bottom
185 %   with a small overshoot.
186 %
187 %   The most popular design is where the X part of the tip is aligned
188 %   with the left bulb boundary, and the Y part ends on the 2nd
189 %   staffline exactly.  This is what we do.
190 %
191 % * The diameter of the bulb is the width of the open space.
192 %
193 % * The vertical center of the bulb can be on or slightly above the
194 %   staff line.
195 %
196 % * The vertical position of the dots can be symmetrical around the
197 %   staffline, centered in the staff space.  The Baerenreiter SCS has
198 %   the bottom dot raised by approximately 0.1 staff space.
199 %
200 % * Uncarefully set music may have overshoots at the top.  We have none.
201 %
202 % * It is not exactly clear where the vertical tangent at the right
203 %   of the swoosh should be.
204 %
205
206 def draw_bass_clef (expr exact_center, reduction) =
207         save reduced_ss, swoosh_width;
208         save right_thickness, right_offset, tip_protrude;
209         save dot_diam, bulb_y_offset, bulb_flare;
210         pair tip_protrude;
211
212         reduced_ss# = staff_space# * reduction;
213         2.2 dot_diam# = reduction * (staff_space# - stafflinethickness#);
214         right_thickness# = 0.37 staff_space# + 1.2 linethickness#;
215         swoosh_width# = 2.1 reduced_ss#;
216         define_pixels (swoosh_width);
217         define_whole_pixels (reduced_ss);
218         define_whole_blacker_pixels (dot_diam, right_thickness);
219
220         right_offset = 0.05 staff_space;
221         bulb_y_offset := 0.075 staff_space;
222         bulb_flare := 2.5 linethickness;
223 %       tip_protrude := (-linethickness, -.2 staff_space);
224         tip_protrude := (0, 0);
225
226         set_char_box (-xpart exact_center,
227                       xpart exact_center + swoosh_width# + 7/12 reduced_ss#,
228                       -ypart exact_center + 2.5 reduced_ss#,
229                       ypart exact_center + reduced_ss#);
230
231         y1 = bulb_y_offset;
232         x1 = 0;
233
234         x2 = .5 [x1, x3];
235         x2l = x2r = x2;
236
237         y2l := vround_pixels (reduced_ss# + 0.5 linethickness#);
238         y2l - y2r = linethickness;
239
240         x3l - x1 = swoosh_width;
241         x3l - x3r = right_thickness;
242
243         % optical correction: the top dot seems farther away if y3l = 0.
244         y3l = right_offset;
245
246         z4 = -(0, 2.0 reduced_ss) + tip_protrude;
247
248         penpos3 (whatever, 185);
249         penpos4 (linethickness, 135);
250
251         fill new_bulb (z2l, 180, z1, z2r, 0,
252                        0.45 reduced_ss, 0.4 reduced_ss,
253                        bulb_flare, 1, 1)
254              .. z3r{down}
255              .. {curl 0}simple_serif (z4r, z4l, 90){curl 0}
256              .. z3l{up}
257              ..tension 0.9.. cycle;
258
259         pickup pencircle scaled dot_diam;
260
261         lft x5 = hround (x3l + 1/3 reduced_ss - dot_diam / 2);
262         bot y5 = vfloor (.5 reduced_ss - dot_diam / 2);
263         z6 = z5 yscaled -1;
264
265         % for symmetry
266         y5 := y5 + feta_shift;
267
268         drawdot z5;
269         drawdot z6;
270
271         penlabels (1, 2, 3, 4, 5, 6);
272
273         draw_staff (-3, 1, 0);
274 enddef;
275
276
277 fet_beginchar ("F clef ", "F");
278         draw_bass_clef ((0, 0), 1.0);
279 fet_endchar;
280
281
282 fet_beginchar ("F clef (reduced)", "F_change");
283         draw_bass_clef ((0, 0), 0.8);
284 fet_endchar;
285
286
287
288 %
289 % Inspired by Baerenreiter
290 %
291 %
292 % Beste lezers, kijk,
293 %
294 % Een bolletje hebben we bij toeval allemaal wel eens getekend, maar begint u
295 % toch eenvoudig.  Eerst een eenvoudig kruis of herstellingsteken
296 % en via de dubbelslag naar een voorzichtig vlaggetje, en heb geduld!
297 % Ikzelf heb bijvoorbeeld over mijn eerste gave G-sleutel
298 % 35 kilobyte metafont, 12 patchlevels, 0 vriendinnen en 45 dagen gedaan
299 %
300 %  -- vrij naar Van Kooten & De Bie
301 %
302
303 def debugfill = fill enddef;
304
305 def draw_gclef (expr reduction) =
306         save reduced_ss, downstroke_dir, downstroke_angle, center;
307         save breapth_factor, inner_thick_end, thinness, thickness, thinnib;
308         save start_angle, inner_start_angle, thinness;
309         save upward_swoosh_angle, bot_angle;
310         save pat;
311         path pat;
312         pair downstroke_dir, center;
313         save corr_angle, corr;
314         transform corr;
315
316         reduced_ss# = staff_space# * reduction;
317         define_pixels (reduced_ss);
318
319         thinness = 0.095 staff_space + 0.75 linethickness;
320         downstroke_dir = unitvector (14, -75);
321         downstroke_angle = angle downstroke_dir;
322         bot_angle = -180;               % downstroke_angle - 87
323
324         upward_swoosh_angle = 132;
325         start_angle = -97;
326
327         breapth_factor = 21/14;
328         inner_thick_end = 45;
329         inner_start_angle = downstroke_angle - 43;
330         thickness = .32 reduced_ss + 1.1 linethickness;
331
332         thinnib = thinness;
333
334         set_char_box (0, 1.71 * breapth_factor * reduced_ss#,
335                       2.6 * reduced_ss#, 5 * reduced_ss#);
336
337         center := (breapth_factor * reduced_ss, 0);
338
339         z1 = center + whatever * dir (inner_start_angle);
340         x1 = xpart center - .28 reduced_ss;
341         penpos1 (thinnib, inner_start_angle);
342
343         x2r = xpart center;
344         y2r = vround_pixels (reduced_ss# + .5 stafflinethickness#);
345         penpos2 (thickness, 90);
346
347         z3 = (z4 - center) rotated inner_thick_end + center;
348         penpos3 (thinnib, -90 + inner_thick_end);
349
350         x4 = xpart center - .1 reduced_ss;
351         y4r = -y2r + feta_shift;
352         penpos4 (thinnib, -90);
353
354         x5r = -breapth_factor * reduced_ss + xpart center;
355         y5r = .37 reduced_ss + ypart center;
356         penpos5 (thickness, upward_swoosh_angle);
357
358         z6 = center + whatever * downstroke_dir;
359         y6 = ypart center + 2 reduced_ss;
360         % penpos6 is computed later
361
362         z7l - z6 = whatever * (z5 - z6) ;
363         y7l = 3.5 reduced_ss;
364         penpos7 (thickness, upward_swoosh_angle);
365
366         x9 = .7 [x10, x7r];
367         top y9l = 5 reduced_ss;
368         penpos9 (1.45 thickness, -70);
369
370         x11 - x13r = 1.5 reduced_ss + 0.5 thinnib;
371         y11 = ypart center - 47/28 reduced_ss;
372         y12 = ypart center - 71/28 reduced_ss;
373         y13 = .48 [y12, y4r];
374         x12r = xpart (.45 [z13r, z11] + .75 reduced_ss * downstroke_dir);
375
376 %       z10 = center + whatever * dir (downstroke_angle - 1.5);
377         x10 = x6 - 2 thinnib;
378         y10 = ypart center + 3.5 reduced_ss;
379         y10l - y10r = 1.0 thickness;
380         z10r - z10l = .7 thinnib * dir (downstroke_angle + 90)
381                       + whatever * downstroke_dir;
382         z10 = .5 [z10l, z10r];
383         z11 = center + whatever * downstroke_dir + (-0.05 reduced_ss, 0);
384
385         penpos11 (thinnib, start_angle + 90);
386         penpos12 (thinnib, bot_angle + 90);
387         penpos13 (thinnib + 0.14 staff_space, 180);
388
389         % this auxiliary point ensures good contour overlapping
390         z8 = .5 [z9l, z9r] + .25 ((z9r - z9l) rotated -90);
391
392         z20 = z9l - (0, .25 blot_diameter);
393         penpos20 (blot_diameter, 0);
394
395         pat := z10{down}
396                .. z6
397                ..tension 1.1.. z11{dir (start_angle)};
398
399         penpos6 (thinnib, angle (direction 1 of pat) + 90);
400
401         % two auxiliary points to simulate `draw' with `penstroke'
402         z10' = point 0.3 of pat;
403         penpos10' (1.3 thinnib, angle (direction 0.3 of pat) + 50);
404
405         z11' = point 1.5 of pat;
406         penpos11' (thinnib, angle (direction 1.5 of pat) + 90);
407
408         z21l = z20l;
409         z21r = z9r;
410
411         % after computing all points, we want to rotate the clef
412         % rotating the whole picture won't work due to the complexity
413         % of the path and metafont's memory limitations, so we transform
414         % each point and draw the clef thereafter
415         corr_angle = 1.5;
416         corr = identity rotatedabout (center, -corr_angle);
417
418         % transform points; we transform every point and save it
419         % to a shifted index range: z1 -> z101, z2 ->z102 etc.
420         for n=1 upto 21:
421             forsuffixes e=l,,r:
422                z[n+100]e = z[n]e  transformed corr;
423             endfor
424         endfor
425         % transform helper points
426         for n=10,11:
427                 forsuffixes e=l,,r:
428                         z[n+100]'e = z[n]'e transformed corr;
429                 endfor
430         endfor
431
432         pat := z121l
433                .. z110l{dir -90} % was {down}
434                .. z110'l;
435
436         fill z102l{dir 0} % {right}
437              .. z103l
438              .. z104l{dir (180 + corr_angle)} % {left}
439              ..tension 1.07.. z105l{dir (90 + corr_angle)}  % inside curve % was {up}
440              .. z107l{dir (90 + corr_angle)} % {up}
441              ..tension 1.2.. z120r{curl 1}
442              .. {direction 0 of pat}z120l
443              -- z108
444              -- z109r                   % {dir (downstroke_angle + 0)}
445              ..tension 0.8.. z107r{dir (-90 + corr_angle)} %{down}
446              .. z105r{dir (-90 + corr_angle)} %{down}
447              .. z104r{dir corr_angle} %{right}
448              .. z103r
449              .. z102r{dir (180 + corr_angle)} % {left}
450              ..tension .95.. z101r
451              -- simple_serif (z101r, z101l, 80)
452              -- z101l
453              ..tension 0.85.. cycle;
454
455         penstroke z121e
456                   .. z110e{dir (-90 + corr_angle)} %{down}
457                   .. z110'e
458                   .. z106e
459                   .. z111'e
460                   .. z111e{dir (-95 + corr_angle)}
461                   .. z112e{dir (bot_angle + corr_angle)};
462
463         fill new_bulb (z112r, bot_angle + corr_angle, z113r, z112l, bot_angle + corr_angle + 180,
464                        0.45 reduced_ss, 0.38 reduced_ss,
465                        thinnib + .05 staff_space, 1, -1)
466              -- cycle;
467
468         penlabels (range 101 thru 121);
469         penlabels (110', 111');
470
471         draw_staff (-1, 3, 0);
472 enddef;
473
474
475 fet_beginchar ("G clef", "G");
476         draw_gclef (1.0);
477 fet_endchar;
478
479
480 fet_beginchar ("G clef", "G_change");
481         draw_gclef (0.8);
482 fet_endchar;
483
484
485 %%%%
486 %
487 % PERCUSSION
488 %
489
490 %
491 % The percussion clef extent is not coincident with its bbox, since
492 % the percussion clef needs more space in front than a normal clef.
493 %
494
495 def draw_percussion_clef (expr reduction) =
496         save reduced_ss, razt;
497
498         reduced_ss# = staff_space# * reduction;
499         define_pixels (reduced_ss);
500
501         set_char_box (-.67 reduced_ss#, 2.0 reduced_ss#,
502                       reduced_ss#, reduced_ss#);
503
504         razt := hround (0.45 reduced_ss);
505
506         d := d - feta_shift;
507
508         draw_block ((-b, -d), (-b + razt, h));
509         draw_block ((w - razt, -d), (w, h));
510
511         draw_staff (-3, 1, 1);
512 enddef;
513
514
515 fet_beginchar ("percussion clef", "percussion");
516         draw_percussion_clef (1.0);
517 fet_endchar;
518
519
520 fet_beginchar ("percussion clef (reduced)", "percussion_change");
521         draw_percussion_clef (.8);
522 fet_endchar;
523
524
525 def draw_tab_T (expr pos, siz, slant) =
526 begingroup;
527         save vx, vy;
528         pair vx, vy;
529
530         clearxy;
531
532         vx = (xpart siz) * dir 0;
533         vy = (ypart siz) * dir 90;
534
535         penpos1 (.75 penh, 100);
536         z1 = z2 + (1/6 * vx - .15 * vy);
537         penpos2 (hround (.9 penw), 0);
538         x2l = hround xpart (pos + .75 vy);
539         y2l = ypart (pos + .75 vy);
540         penpos3 (penh, -100);
541         z3l = pos + .4 vx + vy;
542         penpos4 (penh, -90);
543         z4 = -.1 vy + .5 [z3, z5];
544         penpos5 (.8 penh, -30);
545         x5r = xpart (pos + siz);
546         y5l = ypart (pos + siz);
547
548         penpos10 (penw, 170);
549         z10 = pos + .55 vx + .9 vy;
550         penpos11 (.75 [penh, penw], 170);
551         z11 = z10 - .5 vy + .025 vx;
552         penpos12 (penh, 100);
553         z12l = (xpart .5 [z13, z11], ypart (pos - .025 * siz));
554         penpos13 (.75 penh, 60);
555         z13 = pos + .2 vx + .15 vy;
556
557         % penlabels (range 1 thru 13);
558
559         soft_penstroke (z1e
560                         ..tension 1.1.. z2e
561                         .. z3e{right}
562                         ..tension 1.5.. z4e
563                         ..z5e)
564           slanted slant shifted (slant * -ypart pos, 0);
565
566         soft_end_penstroke (z10e
567                             ..tension 1.5.. z11e
568                             .. z12e
569                             ..tension 1.1.. z13e{(z13r - z13l) rotated 90})
570           slanted slant shifted (slant * -ypart pos, 0);
571 endgroup;
572 enddef;
573
574
575 def draw_tab_A (expr pos, siz, slant) =
576 begingroup;
577         save vx, vy, pat;
578         pair vx, vy;
579         path pat;
580
581         clearxy;
582
583         vx = (xpart siz) * dir 0;
584         vy = (ypart siz) * dir 90;
585
586         penpos1 (.75 penh, -110);
587         z1r = pos + .07 vy;
588         penpos2 (penh, -75);
589         z2r = (.5 [x1, x3], ypart pos);
590         penpos3 (.25 [penh, penw], -30);
591         z3 = (.45 [x2, x4], .15 [y2, y4]);
592         penpos4 (1 [penh, penw], 0);
593         z4 = pos + .5 vx + .975 vy;
594
595         penpos5 (1 [penh, penw], -180);
596         z5 = z4;
597         penpos6 (.2 [penh, penw], -150);
598         z6l = (.8 [x5l, x7l], .9 [y5l, y7l]);
599         penpos7 (penh,-90);
600         z7r = (.5 [x6, x8], ypart pos);
601         penpos8 (.75 penh, -70);
602         z8r = (xpart (pos + siz), y7r + .075 ypart (siz));
603
604         pat := z2
605                .. z3
606                .. z4;
607
608         penpos10 (penh, angle (direction 1.2 of pat) - 180);
609         z10 = point 1.2 of pat;
610         penpos11 (.9 penh, -90);
611         z11 = .4 [z10, z6] - 0.05 vy;
612         penpos12 (.75 penh, -75);
613         z12 = .3 [z11, z6] + 0.02 vy;
614
615         % penlabels (range 1 thru 12);
616
617         soft_penstroke (z1e{(z1r - z1l) rotated 90}
618                         .. z2e
619                         .. z3e
620                         .. z4e)
621           slanted slant shifted (slant * -ypart pos, 0);
622
623         soft_end_penstroke (z5e
624                             .. z6e
625                             .. z7e
626                             .. z8e{(z8r - z8l) rotated 90})
627           slanted slant shifted (slant * -ypart pos, 0);
628
629         soft_end_penstroke (z10e
630                             .. z11e
631                             .. z12e)
632           slanted slant shifted (slant * -ypart pos, 0);
633 endgroup;
634 enddef;
635
636
637 def draw_tab_B (expr pos, siz, slant) =
638 begingroup;
639         save vx, vy;
640         pair vx, vy;
641
642         clearxy;
643
644         vx = (xpart siz) * dir 0;
645         vy = (ypart siz) * dir 90;
646
647         penpos1 (.75 penh, 100);
648         z1 = z2 + (.15 * vx - .1 * vy);
649         penpos2 (hround (.9 penw), 0);
650         x2l = hround xpart (pos + .75 vy);
651         y2l = ypart (pos + .75 vy);
652         penpos3 (penh, -100);
653         z3l = pos + .4 vx + 1.05 vy;
654         penpos4 (.8 [penh, penw], -180);
655         z4 = (xpart (pos + .75 siz), .5 [y3, y5]);
656         penpos5 (.8 penh, 90);
657         z5 = (.5 [x10, x4], ypart (pos + .55 siz));
658
659         penpos6 (.8 penh, 270);
660         z6 = z5;
661         penpos7 (penw, 180);
662         z7l = (xpart (pos + siz), .5 [y6, y8]);
663         penpos8 (.8 penh, 45);
664         z8 = .5 [z12l, z11l] + .15 vx - .05 vy;
665
666         penpos10 (.75 [penh, penw], 170);
667         z10 = pos + .375 vx + vy;
668         penpos11 (.8 [penh, penw], 150);
669         z11 = z10 - .5 vy + .04 vx;
670         penpos12 (penh, 100);
671         z12l = (xpart .5 [z13, z11], ypart pos);
672         penpos13 (.75 penh, 60);
673         z13 = pos + .1 vx + .15 vy;
674
675         % penlabels (range 1 thru 13);
676
677         soft_penstroke (z1e
678                         ..tension 1.1.. z2e
679                         .. z3e
680                         .. z4e
681                         ..z5e {left})
682           slanted slant shifted (slant * -ypart pos, 0);
683
684         soft_end_penstroke (z6e{right}
685                             .. z7e
686                             .. z8e{(z8r - z8l) rotated 90})
687           slanted slant shifted (slant * -ypart pos, 0);
688
689         soft_end_penstroke (z10e
690                             ..tension 1.5.. z11e
691                             .. z12e
692                             ..tension 1.1.. z13e{(z13r - z13l) rotated 90})
693           slanted slant shifted (slant * -ypart pos, 0);
694 endgroup;
695 enddef;
696
697
698 def draw_tab_clef (expr reduction) =
699         save reduced_ss, letterheight, penw, penh;
700
701         reduced_ss# = staff_space# * reduction;
702         letterheight# = 1.8 reduced_ss#;
703         define_pixels (reduced_ss, letterheight);
704
705         set_char_box (-.2 reduced_ss#, 2.8 reduced_ss#,
706                       1.6 letterheight#, 1.6 letterheight#);
707
708         penw = .45 reduced_ss;
709         penh = .2 reduced_ss;
710
711         draw_tab_T ((-b + .15 reduced_ss, h - letterheight),
712                     (2.1 reduced_ss, letterheight), 0.2);
713         draw_tab_A ((-b - .05 reduced_ss, -.5 letterheight +.15 reduced_ss),
714                     (2.2 reduced_ss, letterheight), 0.4);
715         draw_tab_B ((-b + .025 reduced_ss, -d),
716                     (2.1 reduced_ss, letterheight), 0.25);
717
718         draw_staff (-3, 2, 0.5);
719 enddef;
720
721
722 fet_beginchar ("tab clef", "tab");
723         draw_tab_clef (1.0);
724 fet_endchar;
725
726
727 fet_beginchar ("tab clef (reduced)", "tab_change");
728         draw_tab_clef (.8);
729 fet_endchar;
730
731 fet_endgroup ("clefs");