]> git.donarmstrong.com Git - lilypond.git/commitdiff
Prepare glyph shapes for mf2pt1 conversion.
authorWerner Lemberg <wl@gnu.org>
Mon, 3 Jan 2005 07:54:19 +0000 (07:54 +0000)
committerWerner Lemberg <wl@gnu.org>
Mon, 3 Jan 2005 07:54:19 +0000 (07:54 +0000)
* mf/feta-accordion.mf (accreg_pen): Removed.  No longer used.
(accDiscant, accFreebase, accStdbase): Replace `draw' with
`penstroke'.
(accDot): Use `drawdot'.
(accBayanbase): Replace `draw' with `draw_gridline'.
(print_penpos): Moved to feta-macros.mf.
(accOldEE): Replace `filldraw' with `penstroke'.
Replace `draw' with `penstroke' and `drawdot'.

* mf/feta-banier.mf: Code clean-up.
("grace dash (up)", "grace dash (down)"): Replace `draw' with
`fill'.

* mf/feta-bolletjes (draw_cross): Remove call to `labels'.

* mf/feta-eindelijk.mf (draw_rest_bulb, draw_eigth_rest): Add
paremeter to control drawing of labels.  Update all callers.

* mf/feta-klef.mf (draw_c_clef): Use `&' not `..' to connect paths.
(new_bulb): Return a bulb as a single path.  To do that, it now
takes some more parameters.  Updated all callers.
(draw_gclef): Major clean-up.  `draw' has been replaced with
`penstroke', unnecessary outlines have been removed.
Remove (unused) gnome-canvas code.

* mf/feta-macros.mf (print_penpos): New macro (from
feta-accordion.mf).
Other minor fixes.

* mf/feta-pendaal.mf ("Pedal asterisk"): Use `undrawdot'.
("Pedal dot"): Use `drawdot'.
(draw_pedal_P): Add parameter to control drawing of labels.  Update
all callers.
Fix shape at top.
(draw_pedal_e): Add parameter to control drawing of labels.  Update
all callers.
(draw_pedal_d): Add parameter to control drawing of labels.  Update
all callers.
Revert drawing direction.

* mf/feta-schrift.mf (draw_fermata): Use single path.
(draw_short_fermata): Replace `filldraw' with `fill'.
(draw_long_fermata, draw_very_long_fermata): Replace calls to
`draw_rounded_block' with a single path.
("Thumb"): Draw full circle instead of mirroring segments.
(draw_accent): New macro.
("> accent", "espr"): Use it.
(draw_marcato): Replace `filldraw' and `draw' with `fill'.
("open (unstopped)"): Draw full circle instead of mirroring
segments.
(draw_vee): Removed.
("Upbow"): Use `draw_accent' instead of `draw_vee'.
("Downbow"): Replace calls to `draw_rounded_block' with a single
path.
("Trill (`tr')"): Replace overlapping loop drawn with `draw' with
partial pieces drawn with `fill' -- these do still overlap with the
stem of the `t' but just once, not multiple times so that fontforge
can handle it gracefully.
Change other parts of the glyph so that fontforge's overlapping
algorithm reliably works.
(draw_heel): Replace `draw' with `fill'.
(draw_toe): Use `draw_accent' instead of `draw_vee'.
("Flageolet"): Replace `draw' with `penstroke'.
("Segno"): Replace `filldraw' with `penstroke'.
Replace `draw' with `drawdot'.
("Coda"): Replace `fill' with `penstroke', using a single path.
("Varied Coda"): Use less overlapping paths.
(draw_arpeggio_arrow): Replace `filldraw' with `fill', using a
single path.

* mf/feta-slag.mf (draw_trillelement): Put `clearxy' outside of
group to better control the `labels' command.
Rename argument to `offset' and use it actually.  Update all
callers.
Replace `filldraw' with `fill'.
("mordent", "prallmordent", "upmordent", "downmordent",
"lineprall"): Replace `draw' with `draw_gridline'.
("upprall", "downprall"): Replace `draw' with `fill'.

* mf/feta-timesig.mf: Formatting.

* mf feta-toevallig.mf (draw_meta_flag): Move code to draw labels
to...
("Flat"): Here.
(draw_paren): Move code to draw labels to...
("Right Parenthesis"): Here.

12 files changed:
ChangeLog
mf/feta-accordion.mf
mf/feta-banier.mf
mf/feta-bolletjes.mf
mf/feta-eindelijk.mf
mf/feta-klef.mf
mf/feta-macros.mf
mf/feta-pendaal.mf
mf/feta-schrift.mf
mf/feta-slag.mf
mf/feta-timesig.mf
mf/feta-toevallig.mf

index b209f12c23f1841b63f832ebc7a3884cc6decfb6..5d13354cb73ba4fa2257f945677245d354584230 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,94 @@
+2005-01-03  Werner Lemberg  <wl@gnu.org>
+
+       Prepare glyph shapes for mf2pt1 conversion.
+
+       * mf/feta-accordion.mf (accreg_pen): Removed.  No longer used.
+       (accDiscant, accFreebase, accStdbase): Replace `draw' with
+       `penstroke'.
+       (accDot): Use `drawdot'.
+       (accBayanbase): Replace `draw' with `draw_gridline'.
+       (print_penpos): Moved to feta-macros.mf.
+       (accOldEE): Replace `filldraw' with `penstroke'.
+       Replace `draw' with `penstroke' and `drawdot'.
+
+       * mf/feta-banier.mf: Code clean-up.
+       ("grace dash (up)", "grace dash (down)"): Replace `draw' with
+       `fill'.
+
+       * mf/feta-bolletjes (draw_cross): Remove call to `labels'.
+
+       * mf/feta-eindelijk.mf (draw_rest_bulb, draw_eigth_rest): Add
+       paremeter to control drawing of labels.  Update all callers.
+
+       * mf/feta-klef.mf (draw_c_clef): Use `&' not `..' to connect paths.
+       (new_bulb): Return a bulb as a single path.  To do that, it now
+       takes some more parameters.  Updated all callers.
+       (draw_gclef): Major clean-up.  `draw' has been replaced with
+       `penstroke', unnecessary outlines have been removed.
+       Remove (unused) gnome-canvas code.
+
+       * mf/feta-macros.mf (print_penpos): New macro (from
+       feta-accordion.mf).
+       Other minor fixes.
+
+       * mf/feta-pendaal.mf ("Pedal asterisk"): Use `undrawdot'.
+       ("Pedal dot"): Use `drawdot'.
+       (draw_pedal_P): Add parameter to control drawing of labels.  Update
+       all callers.
+       Fix shape at top.
+       (draw_pedal_e): Add parameter to control drawing of labels.  Update
+       all callers.
+       (draw_pedal_d): Add parameter to control drawing of labels.  Update
+       all callers.
+       Revert drawing direction.
+
+       * mf/feta-schrift.mf (draw_fermata): Use single path.
+       (draw_short_fermata): Replace `filldraw' with `fill'.
+       (draw_long_fermata, draw_very_long_fermata): Replace calls to
+       `draw_rounded_block' with a single path.
+       ("Thumb"): Draw full circle instead of mirroring segments.
+       (draw_accent): New macro.
+       ("> accent", "espr"): Use it.
+       (draw_marcato): Replace `filldraw' and `draw' with `fill'.
+       ("open (unstopped)"): Draw full circle instead of mirroring
+       segments.
+       (draw_vee): Removed.
+       ("Upbow"): Use `draw_accent' instead of `draw_vee'.
+       ("Downbow"): Replace calls to `draw_rounded_block' with a single
+       path.
+       ("Trill (`tr')"): Replace overlapping loop drawn with `draw' with
+       partial pieces drawn with `fill' -- these do still overlap with the
+       stem of the `t' but just once, not multiple times so that fontforge
+       can handle it gracefully.
+       Change other parts of the glyph so that fontforge's overlapping
+       algorithm reliably works.
+       (draw_heel): Replace `draw' with `fill'.
+       (draw_toe): Use `draw_accent' instead of `draw_vee'.
+       ("Flageolet"): Replace `draw' with `penstroke'.
+       ("Segno"): Replace `filldraw' with `penstroke'.
+       Replace `draw' with `drawdot'.
+       ("Coda"): Replace `fill' with `penstroke', using a single path.
+       ("Varied Coda"): Use less overlapping paths.
+       (draw_arpeggio_arrow): Replace `filldraw' with `fill', using a
+       single path.
+
+       * mf/feta-slag.mf (draw_trillelement): Put `clearxy' outside of
+       group to better control the `labels' command.
+       Rename argument to `offset' and use it actually.  Update all
+       callers.
+       Replace `filldraw' with `fill'.
+       ("mordent", "prallmordent", "upmordent", "downmordent",
+       "lineprall"): Replace `draw' with `draw_gridline'.
+       ("upprall", "downprall"): Replace `draw' with `fill'.
+
+       * mf/feta-timesig.mf: Formatting.
+
+       * mf feta-toevallig.mf (draw_meta_flag): Move code to draw labels
+       to...
+       ("Flat"): Here.
+       (draw_paren): Move code to draw labels to...
+       ("Right Parenthesis"): Here.
+
 2005-01-02  Graham Percival <gperlist@shaw.ca>
 
        * Documentation/user/notation.itely: add example of \setTextDecresc
index ec3c470df31443ed2bca09d3e3907ec861c0006e..5da0be8a57ea4888a892ae3f681ff17997626fb3 100644 (file)
 % -*- Fundamental -*-
 
-fet_begingroup("accordion")
+fet_begingroup ("accordion")
 
-accreg_dot_size# := .5staff_space#;
-accreg_linethickness# := 1.3stafflinethickness#;
+accreg_dot_size# := .5 staff_space#;
+accreg_linethickness# := 1.3 stafflinethickness#;
 
-% This dimention is the same on all registersymbols.
+%
+% This dimension is the same for all register symbols.
 % The different symbols should calculate their other
-% dimensions from this and accreg_dot_size
-accreg_lh# := 1.0staff_space#;
-
-define_pixels(accreg_dot_size, accreg_linethickness, accreg_lh);
-pen accreg_pen;
-accreg_pen := pencircle xscaled accreg_linethickness yscaled 0.7accreg_linethickness;
-
-fet_beginchar("accDiscant", "accDiscant")
-       save r, sx;
-       r# = 3/2accreg_lh#;
-       define_pixels(r);
-%      set_char_box(r#, r#, 2r#, 0);
-       set_char_box(r#, r#, 0r#, 2r#); %% arg3 = under linjen, arg4 = over
-       pickup accreg_pen;
-       draw fullcircle scaled 2r;
-       sx = cosd(19.471221);
-       draw (-sx*r, r/3)--(sx*r, r/3);
-       draw (-sx*r, -r/3)--(sx*r, -r/3);
-       currentpicture := currentpicture shifted (0, r);
+% dimensions from this and accreg_dot_size.
+%
+
+accreg_lh# := 1.0 staff_space#;
+
+define_pixels (accreg_dot_size, accreg_linethickness, accreg_lh);
+
+
+fet_beginchar ("accDiscant", "accDiscant")
+       save r, p;
+       path p;
+
+       r# = 3/2 accreg_lh#;
+       define_pixels (r);
+
+       set_char_box (r#, r#, 0, 2 r#);
+
+       penpos1 (accreg_linethickness, 0);
+       penpos2 (0.7 accreg_linethickness, 90);
+       penpos3 (accreg_linethickness, 180);
+       penpos4 (0.7 accreg_linethickness, 270);
+
+       z1 = (r, r);
+       z2 = (0, 2 r);
+       z3 = (-r, r);
+       z4 = (0, 0);
+
+       penlabels (1, 2, 3, 4);
+
+       penstroke z1e
+                 .. z2e
+                 .. z3e
+                 .. z4e
+                 .. cycle;
+
+       p := z4{right}
+            .. z1{up}
+            .. {left}z2;
+
+       z5 = p intersectionpoint ((0, 4/3 r) -- (r, 4/3 r));
+       z6 = z5 xscaled -1;
+       z7 = p intersectionpoint ((0, 2/3 r) -- (r, 2/3 r));
+       z8 = z7 xscaled -1;
+
+       labels (5, 6, 7, 8);
+
+       pickup penrazor scaled 0.7 accreg_linethickness rotated 90;
+
+       draw z5
+            -- z6;
+       draw z7
+            -- z8;
 fet_endchar;
 
-fet_beginchar("accDot", "accDot")
-       set_char_box(accreg_dot_size#, accreg_dot_size#, 0, 0);
+
+fet_beginchar ("accDot", "accDot")
+       set_char_box (accreg_dot_size#, accreg_dot_size#, 0, 0);
+
        pickup pencircle scaled accreg_dot_size;
-       draw(0, 0);
+
+       drawdot (0, 0);
 fet_endchar;
 
-fet_beginchar("accFreebase", "accFreebase")
-       save r;
-       r#= accreg_lh#;
-       define_pixels(r);
-       set_char_box(r#, r#, 0, 2r#);
-       pickup accreg_pen;
-       draw fullcircle scaled 2r;
-       draw (-r, 0)--(r, 0);
-       currentpicture := currentpicture shifted (0, r);
+
+fet_beginchar ("accFreebase", "accFreebase")
+       save r, p;
+       path p;
+
+       r# = accreg_lh#;
+       define_pixels (r);
+
+       set_char_box (r#, r#, 0, 2 r#);
+
+       penpos1 (accreg_linethickness, 0);
+       penpos2 (0.7 accreg_linethickness, 90);
+       penpos3 (accreg_linethickness, 180);
+       penpos4 (0.7 accreg_linethickness, 270);
+
+       z1 = (r, r);
+       z2 = (0, 2 r);
+       z3 = (-r, r);
+       z4 = (0, 0);
+
+       penlabels (1, 2, 3, 4);
+
+       penstroke z1e
+                 .. z2e
+                 .. z3e
+                 .. z4e
+                 .. cycle;
+
+       pickup penrazor scaled 0.7 accreg_linethickness rotated 90;
+
+       draw z1
+            -- z3;
 fet_endchar;
 
-fet_beginchar("accStdbase", "accStdbase")
-       save r, sx;
-       r# = 2accreg_lh#;
-       define_pixels(r);
-       sx = cosd 30 ;
-       set_char_box(r#, r#, 0, 2r#);
-       pickup accreg_pen;
-       draw fullcircle scaled 2r;
-       draw (-r, 0)--(r, 0);
-       draw (-sx*r, r/2)--(sx*r, r/2);
-       draw (-sx*r, -r/2)--(sx*r, -r/2);
-       currentpicture := currentpicture shifted (0, r);
+
+fet_beginchar ("accStdbase", "accStdbase")
+       save r, p;
+       path p;
+
+       r# = 2 accreg_lh#;
+       define_pixels (r);
+
+       set_char_box (r#, r#, 0, 2 r#);
+
+       penpos1 (accreg_linethickness, 0);
+       penpos2 (0.7 accreg_linethickness, 90);
+       penpos3 (accreg_linethickness, 180);
+       penpos4 (0.7 accreg_linethickness, 270);
+
+       z1 = (r, r);
+       z2 = (0, 2 r);
+       z3 = (-r, r);
+       z4 = (0, 0);
+
+       penlabels (1, 2, 3, 4);
+
+       penstroke z1e
+                 .. z2e
+                 .. z3e
+                 .. z4e
+                 .. cycle;
+
+       p := z4{right}
+            .. z1{up}
+            .. {left}z2;
+
+       z5 = p intersectionpoint ((0, 3/2 r) -- (r, 3/2 r));
+       z6 = z5 xscaled -1;
+       z7 = p intersectionpoint ((0, 1/2 r) -- (r, 1/2 r));
+       z8 = z7 xscaled -1;
+
+       labels (5, 6, 7, 8);
+
+       pickup penrazor scaled 0.7 accreg_linethickness rotated 90;
+
+       draw z1
+            -- z3;
+       draw z5
+            -- z6;
+       draw z7
+            -- z8;
 fet_endchar;
 
-%%% strange turning path.
-fet_beginchar("accBayanbase", "accBayanbase")
+
+fet_beginchar ("accBayanbase", "accBayanbase")
        save lh;
        lh = accreg_lh;
-%      set_char_box(accreg_lh#, accreg_lh#, 3accreg_lh#, 0);
-       set_char_box(accreg_lh#, accreg_lh#, 0, 3accreg_lh#);
-       pickup pencircle scaled accreg_linethickness;
-       %draw (0, 0)--(2w, 0)--(2w, 3accreg_lh)--(0, 3accreg_lh)--(0, 0);
-       draw (0, 0)--(2w, 0)--(2w, 3accreg_lh)--(0, 3accreg_lh)--cycle;
-       draw (0, accreg_lh)--(2w, accreg_lh);
-       draw (0, 2accreg_lh)--(2w, 2accreg_lh);
-       currentpicture := currentpicture shifted (-w, 0);% -3lh);
+
+       set_char_box (accreg_lh#, accreg_lh#, 0, 3 accreg_lh#);
+
+       draw_gridline ((-w, 0), (w, 0), accreg_linethickness);
+       draw_gridline ((-w, lh),(w, lh), accreg_linethickness);
+       draw_gridline ((-w, 2 lh), (w, 2 lh), accreg_linethickness);
+       draw_gridline ((-w, 3 lh), (w, 3 lh), accreg_linethickness);
+
+       draw_gridline ((-w, 0), (-w, 3 lh), accreg_linethickness);
+       draw_gridline ((w, 0), (w, 3 lh), accreg_linethickness);
 fet_endchar;
 
-def def_B(expr w, h) = 
-       % huh?
-       % pickup pencircle scaled 0.1pt;
-       pickup pencircle scaled 0.15linethickness;
-       penpos10(thin, -90);
-       penpos11(thin, -90);
-       penpos12(thick, 0);
-       penpos13(thin, 90);
-       penpos14(thin, 90);
-
-       penpos15(thick, 180);
-       penpos16(thin, -90);
-       penpos17(thin, -90);
-       penpos18(thick, 0);
-       penpos19(thick, 0);
+
+def def_B (expr w, h) =
+       pickup pencircle scaled 0.15 linethickness;
+
+       penpos10 (thin, -90);
+       penpos11 (thin, -90);
+       penpos12 (thick, 0);
+       penpos13 (thin, 90);
+       penpos14 (thin, 90);
+
+       penpos15 (thick, 180);
+       penpos16 (thin, -90);
+       penpos17 (thin, -90);
+       penpos18 (thick, 0);
+       penpos19 (thick, 0);
+
        z10 = (0, 0);
-       z11 = (cOne*w, 0);
-       z12 = (w, .5mb*h);
-       z13 = (cTwo*w, mb*h);
-       z14 = (2thick, mb*h);
-       z15 = (.94w, h-.5mt*h);
-       z16 = z13 + (0, mt*h);
+       z11 = (cOne * w, 0);
+       z12 = (w, .5 mb * h);
+       z13 = (cTwo * w, mb * h);
+       z14 = (2 thick, mb * h);
+       z15 = (.94 w, h - .5 mt * h);
+       z16 = z13 + (0, mt * h);
        z17 = (0, h);
-       z18 = (1.5thick, 0);
-       z19 = (1.5thick, h);
+       z18 = (1.5 thick, 0);
+       z19 = (1.5 thick, h);
 enddef;
 
-def def_S(expr w, h) =
-       % huh?
-       %pickup pencircle scaled 0.02pt;
-       pickup pencircle scaled 0.03linethickness;
-       penpos1(thin, 180);
-       penpos2(thin, -90);
-       penpos3(thick, 0);
-       penpos4(.5thick, 90);
-       penpos5(thick, 0);
-       penpos6(thin, -90);
-       penpos7(thin, 180);
-       penpos8(thin, 180);
-       penpos9(thin, 0);
+
+def def_S (expr w, h) =
+       pickup pencircle scaled 0.03 linethickness;
+
+       penpos1 (thin, 180);
+       penpos2 (thin, -90);
+       penpos3 (thick, 0);
+       penpos4 (.5 thick, 90);
+       penpos5 (thick, 0);
+       penpos6 (thin, -90);
+       penpos7 (thin, 180);
+       penpos8 (thin, 180);
+       penpos9 (thin, 0);
+
        z1 = (0, hs);
-       z2 = (w/2, 0);
-       z3 = (w-.5thick, .5mb*h);
-       z4 = (w/2, mb*h);
-       z5 = (.5thick, h-.5mt*h);
-       z6 = (w/2, h);
-       z7 = (w, h-hs);
+       z2 = (w / 2, 0);
+       z3 = (w - .5 thick, .5 mb * h);
+       z4 = (w / 2, mb * h);
+       z5 = (.5 thick, h - .5 mt * h);
+       z6 = (w / 2, h);
+       z7 = (w, h - hs);
        z8 = (0, y2r);
        z9 = (w, y6l);
+
        path bue, bueoverst;
-       bue=z2{left}..z1{up};
-       numeric t;
-       t:=xpart(bue intersectiontimes(z8l--z7l));
-%      show t;
-       bueoverst=z6{right}..z7{down};
+
+       bue := z2{left}
+              .. z1{up};
+
+       t := xpart (bue intersectiontimes (z8l -- z7l));
+
+       bueoverst := z6{right}
+                    .. z7{down};
 enddef;
 
+
 def def_some_vars =
        save hs, mb, mt, thin, thick, height, width, cOne, cTwo;
-       width = .8(4 staff_space);
-       height = 2.4staff_space;
+       save bx, hx;
+
+       width = .8 (4 staff_space);
+       height = 2.4 staff_space;
        % URG.  smaller sizes should be wider and fatter
-       %thin = 0.05staff_space;
-       %thick = 0.2staff_space;
-       save bx,hx; 4hx+bx=1.15; 10hx+bx=1;
-       fatten:=designsize*hx+bx*1.2;
-       thick:= 0.2staff_space*fatten;
+       % thin = 0.05 staff_space;
+       % thick = 0.2 staff_space;
+
+       4 hx + bx = 1.15;
+       10 hx + bx = 1;
+       fatten := designsize * hx + bx * 1.2;
+       thick := 0.2 staff_space * fatten;
+
        % urg: mustn't ever go thinner than blot!
-       thin#:= blot_diameter#;
+       thin# := blot_diameter#;
        define_pixels (thin);
 
-       hs = 0.4staff_space;
+       hs = 0.4 staff_space;
        mb = .53;
-       mt = .47;       
+       mt = .47;
        cOne = 0.65;
        cTwo = 0.60;
 enddef;
 
-def print_penpos (suffix $)=
-       message "z"&str $ &"l = ("&decimal x.$.l&", "&decimal y.$.l&"); z"&str $ &"r = ("&decimal x.$.r&", "&decimal y.$.r&");";
-enddef;
 
+fet_beginchar ("accOldEE", "accOldEE")
+       save pp;
+
+       set_char_box (staff_space#, staff_space#, 0, 2 staff_space#);
 
-%%% strange turning path.
-fet_beginchar("accOldEE", "accOldEE")
-       set_char_box(staff_space#, staff_space#, 0, 2staff_space#);
        r = staff_space;
        lr = .4 staff_space - linethickness;
        ir = .6 staff_space;
 
-       z1 = (0,0);
+       z1 = (0, 0);
        z2 = (0, ir);
-       penpos1 (0,0);
-       penpos2 ( .05 staff_space + .5 linethickness,0);
 
-       penlabels(1,2,3);
+       penpos1 (blot_diameter, 0);
+       penpos2 (.05 staff_space + .5 linethickness + blot_diameter, 0);
+
+       pickup pencircle scaled (lr + blot_diameter);
 
-       numeric pp;
-       pickup pencircle scaled blot_diameter;
        for pp := 0 step 45 until 360:
-               filldraw fullcircle scaled lr shifted (ir*(dir pp));
-               filldraw  (z1r--z1l--z2l--z2r--cycle) rotated pp;
-       endfor
+               drawdot (0, 0) shifted (ir * (dir pp));
 
-       pickup accreg_pen;
-       draw fullcircle scaled 2r;
-       pickup penrazor;
+               penstroke (z1e
+                          -- z2e) rotated pp;
+       endfor;
 
-       filldraw fullcircle scaled lr;
+       penpos3 (accreg_linethickness, 0);
+       penpos4 (0.7 accreg_linethickness, 90);
+       penpos5 (accreg_linethickness, 180);
+       penpos6 (0.7 accreg_linethickness, 270);
 
-       currentpicture := currentpicture shifted (0, r);
+       z3 = (r, 0);
+       z4 = (0, r);
+       z5 = (-r, 0);
+       z6 = (0, -r);
 
+       % penlabels (1, 2, 3, 4, 5, 6);
 
-fet_endchar;
+       penstroke z3e
+                 .. z4e
+                 .. z5e
+                 .. z6e
+                 .. cycle;
 
+       pickup pencircle scaled lr;
+
+       drawdot (0, 0);
+
+       currentpicture := currentpicture shifted (0, r);
+fet_endchar;
 
 
-fet_endgroup("accordion")
+fet_endgroup ("accordion")
index ddfeb804c1b102f96407d9d12b224ae75e8849da..7b21fd859fbbb476102f0814f150f806f22a960a 100644 (file)
@@ -1,15 +1,19 @@
-% flags 
+% flags
 %
 
 
-fet_begingroup("flags")
+fet_begingroup ("flags")
+
 save outer_path;
 path outer_path;
 
-% Flags pointing down overlap with  the notehead (in x-direction), so 
-% the down-flag can be bigger
-upflag_width# = .650 black_notehead_width# + stemthickness#/2;
-downflag_width# = .833 black_notehead_width# + stemthickness#/2;
+%
+% Flags pointing down overlap with the notehead (in x-direction), so
+% the down-flag can be bigger.
+%
+
+upflag_width# = .65 black_notehead_width# + stemthickness# / 2;
+downflag_width# = .833 black_notehead_width# + stemthickness# / 2;
 
 right_upflag_space# = .0 upflag_width#;
 right_downflag_space# = .0 downflag_width#;
@@ -17,7 +21,7 @@ right_downflag_space# = .0 downflag_width#;
 %
 % Flags pointing down cannot overlap with the notehead in y-direction,
 % so they have less slant.
-
+%
 % Because of optical illusion, the utmost flag (bottom for
 % down-pointing, top for up-pointing) should be smaller than the other
 % flags.  Adobe Sonata doesn't do this correctly.  (Instead they have
@@ -27,427 +31,426 @@ right_downflag_space# = .0 downflag_width#;
 save hip_thickness, foot_thickness;
 
 hip_thickness# = 1.0 linethickness# + 0.069 staff_space#;
-foot_thickness# =   1.2055 linethickness# + 0.06 staff_space#;
+foot_thickness# = 1.2055 linethickness# + 0.06 staff_space#;
 
 %
-% Inspired by Adobe Sonata and [Wanske]
-% for example, see POSTSCRIPT Language -- program design, 
-% page 119, and [Wanske], p 41,42
+% Inspired by Adobe Sonata and [Wanske].
+% For example, see POSTSCRIPT Language -- program design,
+% page 119, and [Wanske], p 41, 42.
 %
-def draw_flag(expr center, flare, 
-       dims, hip_depth, foot_wid, hip_thickness, foot_thickness)=
+
+def draw_flag (expr center, flare, dims, hip_depth, foot_wid,
+              hip_thickness, foot_thickness, show_labels) =
+       save c;
+
        clearxy;
-       save c ;
+
        c = 0.7;
-       penpos1(flare, 90);
-       penpos2(whatever, 0);
+
+       penpos1 (flare, 90);
+       penpos2 (whatever, 0);
+
        x2r - x2l = hip_thickness;
+
        penpos3 (foot_thickness, -20.0);
 
-       z1r  = center;
-       z2r = center + (xpart dims, -ypart(dims) * hip_depth);
-       z3r = center + (xpart(dims) * foot_wid, -ypart dims);
+       z1r = center;
+       z2r = center + (xpart (dims), -ypart (dims) * hip_depth);
+       z3r = center + (xpart (dims) * foot_wid, -ypart (dims));
 
        outer_path := z3r{curl c} .. z2r{up} .. {up}z1r;
 
-       penlabels(1, 2, 3);
+       if show_labels = 1:
+               penlabels (1, 2, 3);
+       fi;
+
        fill z1l{curl 0}
-               ..tension 1.1 .. z2l{down} .. 
-               {curl c} simple_serif(z3l, z3r, 80) &
-               outer_path & z1r -- cycle;
+            ..tension 1.1.. z2l{down}
+            .. {curl c}simple_serif (z3l, z3r, 80)
+            & outer_path
+            & z1r
+            -- cycle;
 enddef;
 
 %
-% TODO: calc intersectpoint (see TeX book, p. 137)
-% TODO: calc incision_depth
-% 
-
-def add_flag(expr yoff, flare, hip_wid_multiplier, 
-               hip_dep_multiplier,
-               intersectpoint, hip_thickness, foot_thickness) =
-       begingroup
+% TODO: calculate intersectpoint (see TeX book, p. 137)
+% TODO: calculate incision_depth
+%
+
+def add_flag (expr yoff, flare, hip_wid_multiplier, hip_dep_multiplier,
+             intersectpoint, hip_thickness, foot_thickness) =
+begingroup
        save prev_center, prev_xextreme, prev_yextreme;
        save rel_foot, ip, center, incision_depth;
        save prev_hipwid, prev_footdep, prev_hipdep, wid, dep, hip_dep;
        save hip_dep_ratio, foot_wid_ratio;
        pair prev_center, center, foot, prev_xextreme, prev_yextreme;
        pair ip, rel_foot;
-       
+
        incision_depth = 1.013;
        prev_center = point 2 of outer_path;
        prev_xextreme = point 1 of outer_path;
        prev_yextreme = point 0 of outer_path;
        prev_hipwid = xpart (prev_xextreme - prev_center);
        prev_footdep = -ypart (prev_yextreme - prev_center);
-       prev_hipdep = -ypart(prev_xextreme - prev_center);
+       prev_hipdep = -ypart (prev_xextreme - prev_center);
        ip = point intersectpoint of outer_path;
 
        wid = prev_hipwid * hip_wid_multiplier;
        hip_dep = prev_hipdep * hip_dep_multiplier;
 
-       center = prev_center + (0,yoff);
+       center = prev_center + (0, yoff);
        rel_foot = incision_depth [(wid, hip_dep), ip - center];
-       dep = -ypart(rel_foot);
-       foot_wid_ratio = xpart(rel_foot ) / wid;
+       dep = -ypart (rel_foot);
+       foot_wid_ratio = xpart (rel_foot) / wid;
        hip_dep_ratio = hip_dep / dep;
 
-       draw_flag(center, flare, 
-               (wid, dep), hip_dep_ratio, foot_wid_ratio, 
-               hip_thickness, foot_thickness);
-       endgroup
+       draw_flag (center, flare, (wid, dep),
+                  hip_dep_ratio, foot_wid_ratio,
+                  hip_thickness, foot_thickness, 0);
+endgroup
 enddef;
 
-fet_beginchar("8th Flag (up)", "u3")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+fet_beginchar ("8th Flag (up)", "u3")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
 
        flare# = 1.0 staff_space#;
-       hip_depth_ratio = .72; 
+       hip_depth_ratio = .72;
        foot_width_ratio = .8;
-       hip_width# = upflag_width# - hip_thickness#/2;
-
-       foot_depth# =  3 staff_space# - blot_diameter#/2;
+       hip_width# = upflag_width# - hip_thickness# / 2;
+       foot_depth# = 3 staff_space# - blot_diameter# / 2;
+       define_pixels (flare, hip_width, hip_thickness,
+                      foot_depth, foot_thickness);
 
-       set_char_box(0, hip_width# 
-               + stemthickness#/2 + right_upflag_space#, 
-                foot_depth# + foot_thickness#/2, stemthickness#/2)
+       set_char_box (0, hip_width# + stemthickness# / 2 + right_upflag_space#,
+                     foot_depth# + foot_thickness# / 2, stemthickness# / 2);
 
-       define_pixels(flare, hip_width, hip_thickness,
-               foot_depth, foot_thickness);
-       draw_flag((0,0), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio, foot_width_ratio, hip_thickness, foot_thickness);
+       draw_flag ((0,0), flare, (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 1);
 
-       draw_square_block ((-.5 stemthickness,-1 staff_space),
-                          (0, 0));
+       draw_square_block ((-.5 stemthickness, -staff_space), (0, 0));
 fet_endchar;
 
-fet_beginchar("16th Flag (up)", "u4")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+fet_beginchar ("16th Flag (up)", "u4")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
-       total_depth# = 3.5 staff_space# - blot_diameter# /;
+       total_depth# = 3.5 staff_space# - blot_diameter# / 2;
        flag_count = 2;
        flare# = .85 staff_space#;
-       flagspace# = .85 staff_space#;  
-       hip_depth_ratio = .72 ;
-       hip_width# = upflag_width# - hip_thickness#/2;
+       flagspace# = .85 staff_space#;
+       hip_depth_ratio = .72;
+       hip_width# = upflag_width# - hip_thickness# / 2;
        flagspace# + foot_depth# = total_depth#;
-
        foot_width_ratio = .8;
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth,  foot_thickness);
 
-       set_char_box(0, hip_width#
-               + stemthickness#/2 + right_upflag_space#, 
-               total_depth# + foot_thickness#/2, stemthickness#/2)
+       set_char_box (0,
+                     hip_width# + stemthickness# / 2 + right_upflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2);
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
-       draw_flag((0, - flagspace ), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
+       draw_flag ((0, -flagspace), flare, (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 1);
 
-       add_flag(flagspace, flare,
-               .97, 1.00, 1.25, hip_thickness, foot_thickness);  
+       add_flag (flagspace, flare, .97, 1.00, 1.25,
+                 hip_thickness, foot_thickness);
 
-       pickup pencircle scaled stemthickness;
-
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, -2 staff_space));
+       draw_square_block ((-.5 stemthickness, 0), (0, -2 staff_space));
 fet_endchar;
 
 
-fet_beginchar("32nd Flag (up)", "u5")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+fet_beginchar ("32nd Flag (up)", "u5")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
+
        flag_count = 3;
-       total_depth#=4.25 staff_space#;
+       total_depth# = 4.25 staff_space#;
        flare# = .85 staff_space#;
-       flagspace# = .87 staff_space#;  
-       hip_depth_ratio = .72 ;
-       hip_width# = upflag_width# - hip_thickness#/2;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
+       flagspace# = .87 staff_space#;
+       hip_depth_ratio = .72;
+       hip_width# = upflag_width# - hip_thickness# / 2;
        foot_width_ratio = .8;
 
-       set_char_box(0, hip_width#
-               +  right_upflag_space#, 
-               total_depth# + foot_thickness#/2, stemthickness#/2)
-
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
-
-       draw_flag((0,- 2 flagspace), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
+       (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
 
-       add_flag(flagspace, flare,
-               .97, 1.00, 1.25, hip_thickness, foot_thickness);  
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth, foot_thickness);
 
-       add_flag(flagspace, flare,
-               .95, 1.05, 1.25, hip_thickness, foot_thickness);  
+       set_char_box (0, hip_width# + right_upflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2);
 
+       draw_flag ((0, -2 flagspace), flare, (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 1);
 
+       add_flag (flagspace, flare, .97, 1.00, 1.25,
+                 hip_thickness, foot_thickness);
+       add_flag (flagspace, flare, .95, 1.05, 1.25,
+                 hip_thickness, foot_thickness);
 
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, -3 staff_space));
+       draw_square_block ((-.5 stemthickness, 0), (0, -3 staff_space));
 fet_endchar;
 
-fet_beginchar("64th Flag (up)", "u6")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+fet_beginchar ("64th Flag (up)", "u6")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
-       
+
        flag_count = 4;
        flare# = .85 staff_space#;
-       flagspace# = .9 staff_space#;   
-       hip_depth_ratio = .72 ;
-       hip_width# = upflag_width# - hip_thickness#/2;
+       flagspace# = .9 staff_space#;
+       hip_depth_ratio = .72;
+       hip_width# = upflag_width# - hip_thickness# / 2;
        total_depth# = 5.25 staff_space#;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
        foot_width_ratio = .8;
 
-       set_char_box(0, hip_width#
-               +  right_upflag_space#, 
-               total_depth# + foot_thickness#/2, stemthickness#/2)
+       (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth,  foot_thickness);
 
-       draw_flag((0,- (flag_count-1)* flagspace), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
+       set_char_box (0, hip_width# + right_upflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2);
 
-       add_flag(flagspace, flare,
-               .97, 1.00, 1.3, hip_thickness, foot_thickness);  
+       draw_flag ((0, -(flag_count - 1) * flagspace), flare,
+                  (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 1);
 
-       add_flag(flagspace, flare,
-               1.00, 1.00, 1.25, hip_thickness, foot_thickness);  
-       add_flag(flagspace, flare,
-               .95, 1.05, 1.25, hip_thickness, foot_thickness);  
+       add_flag (flagspace, flare, .97, 1.00, 1.3,
+                 hip_thickness, foot_thickness);
+       add_flag (flagspace, flare, 1.00, 1.00, 1.25,
+                 hip_thickness, foot_thickness);
+       add_flag (flagspace, flare, .95, 1.05, 1.25,
+                 hip_thickness, foot_thickness);
 
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, -4 staff_space));
+       draw_square_block ((-.5 stemthickness, 0), (0, -4 staff_space));
 fet_endchar;
 
-fet_beginchar("8th (down)", "d3")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+fet_beginchar ("8th (down)", "d3")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
-       
+
        flag_count = 1;
        flare# = .99 staff_space#;
-       flagspace# = .9 staff_space#;   
+       flagspace# = .9 staff_space#;
        hip_depth_ratio = .72 ;
-       hip_width# = downflag_width# - hip_thickness#/2;
+       hip_width# = downflag_width# - hip_thickness# / 2;
        total_depth# = 2.85 staff_space#;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
        foot_width_ratio = .8;
 
-       set_char_box(0, hip_width#
-               +  right_downflag_space#,
-               total_depth# + foot_thickness#/2, stemthickness#/2)
+       (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
+
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth, foot_thickness);
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
+       set_char_box (0, hip_width# + right_downflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2)
 
-       draw_flag((0,- (flag_count-1) *flagspace), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, - staff_space));
+       draw_flag ((0, -(flag_count - 1) * flagspace), flare,
+                  (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 0);
 
-        y_mirror_char;
+       draw_square_block ((-.5 stemthickness, 0), (0, -staff_space));
+
+       y_mirror_char;
 fet_endchar;
 
+
 %%%%%%%%
 %
-%
-%
 % Single Stroke for Short Appogiatura
 %
-%
-%
 
-fet_beginchar("grace dash (up)", "ugrace")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth;
+fet_beginchar ("grace dash (up)", "ugrace")
+       save flare, hip_depth_ratio, hip_width, foot_depth;
 
-       flare# = 1.0 staff_space#;
-       hip_depth_ratio = .72; 
-       hip_width# = upflag_width# - hip_thickness#/2;
+       flare# = staff_space#;
+       hip_depth_ratio = .72;
+       hip_width# = upflag_width# - hip_thickness# / 2;
+       foot_depth# = 3 staff_space#;
+
+       define_pixels (flare, hip_width, hip_thickness,
+                      foot_depth, foot_thickness);
 
-       foot_depth# =  3 staff_space#;
+       set_char_box (hip_width# * hip_depth_ratio,
+                     hip_width# + right_upflag_space#,
+                     foot_depth# * hip_depth_ratio, -flare#)
 
-       define_pixels(flare, hip_width, hip_thickness,
-               foot_depth, foot_thickness);
+       pickup pencircle scaled 1.5 stemthickness;
 
-       set_char_box(hip_width# * hip_depth_ratio,
-         hip_width# +  right_upflag_space#, 
-         foot_depth# * hip_depth_ratio, -flare#)
+       z1 = (-b, -d);
+       z2 = (w, h);
 
-       pickup pencircle scaled 1.5 stemthickness;
-       draw (-b ,-d) ..
-         (w, h);
+       penpos1 (1.5 stemthickness, angle (z2 - z1) - 90);
+       penpos2 (1.5 stemthickness, angle (z2 - z1) - 90);
 
+       fill z1l
+            --- z2l
+            .. top z2
+            .. rt z2
+            .. z2r
+            --- z1r
+            .. bot z1
+            .. lft z1
+            .. cycle;
+
+       penlabels (1, 2);
 fet_endchar;
 
-fet_beginchar("grace dash (down)", "dgrace")
+
+fet_beginchar ("grace dash (down)", "dgrace")
        save flare, hip_depth_ratio, hip_width, foot_depth;
-       save flagspace, total_depth, flag_count;
-       
-       flag_count = 1;
+       save flagspace, total_depth;
+
        flare# = .99 staff_space#;
-       flagspace# = .9 staff_space#;   
+       flagspace# = .9 staff_space#;
        hip_depth_ratio = .72 ;
-       hip_width# = downflag_width# - hip_thickness#/2;
+       hip_width# = downflag_width# - hip_thickness# / 2;
        total_depth# = 2.85 staff_space#;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
+       foot_depth# = total_depth#;
        foot_width_ratio = .8;
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace, foot_depth);
+       define_pixels (flare, hip_width, hip_thickness,
+                      flagspace, foot_depth);
+
+       set_char_box (hip_width# * hip_depth_ratio,
+                     hip_width# + right_downflag_space#,
+                     foot_depth# * hip_depth_ratio, -flare#)
+
+       pickup pencircle scaled 1.5 stemthickness;
 
-       set_char_box(hip_width# * hip_depth_ratio,
-         hip_width# +  right_downflag_space#,
-         foot_depth# * hip_depth_ratio, -flare#)
+       z1 = (-b, -d);
+       z2 = (w, h);
+
+       penpos1 (1.5 stemthickness, angle (z2 - z1) - 90);
+       penpos2 (1.5 stemthickness, angle (z2 - z1) - 90);
+
+       fill z1l
+            --- z2l
+            .. top z2
+            .. rt z2
+            .. z2r
+            --- z1r
+            .. bot z1
+            .. lft z1
+            .. cycle;
 
-       pickup pencircle scaled 1.5 stemthickness;
-       draw (-b ,-d) ..
-         (w, h);
        y_mirror_char;
 fet_endchar;
 
-fet_beginchar("16th (down)", "d4")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+fet_beginchar ("16th (down)", "d4")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
-       
+
        flag_count = 2;
        flare# = .8 staff_space#;
-       flagspace# = .9 staff_space#;   
-       hip_depth_ratio = .85 ;
-       hip_width# = downflag_width# - hip_thickness#/2;
-       total_depth# = 3.0 staff_space# - blot_diameter# /2;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
+       flagspace# = .9 staff_space#;
+       hip_depth_ratio = .85;
+       hip_width# = downflag_width# - hip_thickness# / 2;
+       total_depth# = 3.0 staff_space# - blot_diameter# / 2;
        foot_width_ratio = .95;
 
-       set_char_box(0, hip_width#
-               +  right_downflag_space#, 
-               total_depth# + foot_thickness#/2, stemthickness#/2)
+       (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
+       set_char_box (0, hip_width# + right_downflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2);
 
-       draw_flag((0,- (flag_count-1) *flagspace), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
-       add_flag(flagspace, flare,
-               .95, 1.00, 1.25, hip_thickness, foot_thickness);  
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth, foot_thickness);
 
-       
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, - 2 staff_space));
+       draw_flag ((0, -(flag_count - 1) * flagspace), flare,
+                  (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 0);
 
+       add_flag (flagspace, flare, .95, 1.00, 1.25,
+                 hip_thickness, foot_thickness);
+
+       draw_square_block ((-.5 stemthickness, 0), (0, -2 staff_space));
 
        y_mirror_char;
 fet_endchar;
 
-fet_beginchar("32nd (down)", "d5")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+fet_beginchar ("32nd (down)", "d5")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
-       
+
        flag_count = 3;
        flare# = .84 staff_space#;
-       flagspace# = .9 staff_space#;   
-       hip_depth_ratio = .85 ;
-       hip_width# = downflag_width# - hip_thickness#/2;
+       flagspace# = .9 staff_space#;
+       hip_depth_ratio = .85;
+       hip_width# = downflag_width# - hip_thickness# / 2;
        total_depth# = 3.85 staff_space#;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
        foot_width_ratio = .95;
 
-       set_char_box(0, hip_width#
-               +  right_downflag_space#, 
-               total_depth# + foot_thickness#/2, stemthickness#/2)
+       (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth,  foot_thickness);
 
-       draw_flag((0,- (flag_count-1) *flagspace), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
-       add_flag(flagspace, flare,
-               .97, 1.00, 1.25, hip_thickness, foot_thickness);  
+       set_char_box (0, hip_width# + right_downflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2);
 
-       add_flag(flagspace, flare,
-               .95, 1.05, 1.25, hip_thickness, foot_thickness);  
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, - 3 staff_space));
+       draw_flag ((0, -(flag_count - 1) * flagspace), flare,
+                  (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 0);
 
+       add_flag (flagspace, flare, .97, 1.00, 1.25,
+                 hip_thickness, foot_thickness);
+       add_flag (flagspace, flare, .95, 1.05, 1.25,
+                 hip_thickness, foot_thickness);
+
+       draw_square_block ((-.5 stemthickness, 0), (0, -3 staff_space));
 
        y_mirror_char;
 fet_endchar;
-fet_beginchar("64th (down)", "d6")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth, foot_width_ratio;
+
+
+fet_beginchar ("64th (down)", "d6")
+       save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
        save flagspace, total_depth, flag_count;
-       
+
        flag_count = 4;
        flare# = .8 staff_space#;
-       flagspace# = .9 staff_space#;   
-       hip_depth_ratio = .85 ;
-       hip_width# = downflag_width# - hip_thickness#/2;
+       flagspace# = .9 staff_space#;
+       hip_depth_ratio = .85;
+       hip_width# = downflag_width# - hip_thickness# / 2;
        total_depth# = 4.35 staff_space#;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
        foot_width_ratio = .98;
 
-       set_char_box(0, hip_width#
-               + right_downflag_space#, 
-               total_depth# + foot_thickness#/2, stemthickness#/2)
+       (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
+
+       define_pixels (flare, hip_width, hip_thickness, flagspace,
+                      foot_depth, foot_thickness);
 
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace,
-               foot_depth,  foot_thickness);
+       set_char_box (0, hip_width# + right_downflag_space#,
+                     total_depth# + foot_thickness# / 2, stemthickness# / 2);
 
-       draw_flag((0,- (flag_count-1) *flagspace), flare, 
-               (hip_width, foot_depth), 
-               hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
-       add_flag(flagspace, flare,
-               .97, 1.20, 1.175, hip_thickness, foot_thickness);  
-       add_flag(flagspace, flare,
-               .97, 1.10, 1.175, hip_thickness, foot_thickness);  
+       draw_flag ((0, -(flag_count - 1) * flagspace), flare,
+                  (hip_width, foot_depth),
+                  hip_depth_ratio, foot_width_ratio,
+                  hip_thickness, foot_thickness, 0);
 
-       add_flag(.98 flagspace, flare,
-               .91, 1.05, 1.2, hip_thickness, foot_thickness);  
+       add_flag (flagspace, flare, .97, 1.20, 1.175,
+                 hip_thickness, foot_thickness);
+       add_flag (flagspace, flare, .97, 1.10, 1.175,
+                 hip_thickness, foot_thickness);
+       add_flag (.98 flagspace, flare, .91, 1.05, 1.2,
+                 hip_thickness, foot_thickness);
 
-       draw_square_block ((-.5 stemthickness,0),
-                          (0, - 4 staff_space));
+       draw_square_block ((-.5 stemthickness, 0), (0, -4 staff_space));
 
        y_mirror_char;
 fet_endchar;
 
-
-
-fet_endgroup("flags");
+fet_endgroup ("flags");
index 93d8818e9a1caa6477994ef4ab3f7aa5042b83e0..1331fecffd6c84074b0a867363b012156d3ae7b9 100644 (file)
@@ -26,7 +26,7 @@ save slash_thick, slash_slope, overdone_heads;
 numeric black_notehead_width, noteheight, slash_thick;
 
 
-fet_begingroup("noteheads");
+fet_begingroup ("noteheads");
 
 
 % Slope of slash.  From scm/grob-description.scm.  How to auto-copy?
@@ -399,7 +399,7 @@ fet_beginchar ("Quart trianglehead", "u2triangle")
 fet_endchar;
 
 
-fet_beginchar("Quart trianglehead", "d2triangle")
+fet_beginchar ("Quart trianglehead", "d2triangle")
        draw_closed_triangle_head (-1);
 fet_endchar;
 
@@ -516,7 +516,7 @@ def draw_cross (expr thick) =
        z1 = whatever * ne_dir
             + thick / 2 * stafflinethickness# * (ne_dir rotated -90);
 
-       labels (1, 2, 3, 4, 5, 6);
+       labels (1, 2, 3, 4, 5, 6);
 
        nw_dir = unitvector (z3 - z4);
 
@@ -1128,7 +1128,7 @@ fet_beginchar ("Quart down tihead", "d2ti")
 fet_endchar;
 
 
-fet_endgroup("noteheads");
+fet_endgroup ("noteheads");
 
 
 %
index c0eead5a92bf3a11dc8466ef801c86c7acc8bf78..4c4eac3c94e0d383caaecda7beef7e8f5c4f77bc 100644 (file)
@@ -92,7 +92,7 @@ fet_endchar;
 
 
 fet_beginchar ("breve rest", "-1");
-       set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
+       set_char_box (0, breve_rest_x#, 0, breve_rest_y#);
        draw_block ((0, 0), (breve_rest_x, floor (breve_rest_y)));
 fet_endchar;
 
@@ -105,7 +105,7 @@ fet_beginchar ("Quarter rest", "2");
        alpha:=-50;
 
        thick# := 1/4 staff_space#;
-       define_blacker_pixels(thick);
+       define_blacker_pixels (thick);
 
        rthin := 1.25 linethickness;
        rthick := 2 thick + rthin;
@@ -117,9 +117,9 @@ fet_beginchar ("Quarter rest", "2");
        save xcenter;
        xcenter = -0.1 staff_space;
 
-       set_char_box(0, 0.95 staff_space#,
-                    -yshift#,
-                    yshift# + height#);
+       set_char_box (0, 0.95 staff_space#,
+                     -yshift#,
+                     yshift# + height#);
 
        save ne, nw, se, sw;
        pair ne, nw, se, sw;
@@ -233,9 +233,10 @@ define_pixels (bulb_diam, thin, thick);
 % PAT is a compact way to pass the brush shape to the routine.
 %
 
-def draw_rest_bulb (expr ycenter, ycut, pat, stretch) =
+def draw_rest_bulb (expr ycenter, ycut, pat, stretch, show_labels) =
 begingroup;
        save x, y, pt, res;
+
        z1l = point 0 of pat;
        z2l = point 1 of pat;
        z2r = point 3 of pat;
@@ -271,13 +272,16 @@ begingroup;
              .. z3{right}
              .. {curl 0.2}z6;
 
-       labels (3, 4, 5, 6, 7, 8, 10);
+       if show_labels = 1:
+               labels (3, 4, 5, 6, 7, 8, 10);
+       fi;
+
 res
 endgroup;
 enddef;
 
 
-def draw_eighth_rest =
+def draw_eighth_rest (expr show_labels) =
        save width;
        save ycenter;
        save pat, bulb;
@@ -299,15 +303,18 @@ def draw_eighth_rest =
        z2 = z1 + whatever * dir (72);
        z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
 
+       if show_labels = 1:
+               penlabels (1, 2);
+               labels (9);
+       fi;
+
        pat = z1l
              --- z2l
              .. z9
              .. z2r
              --- z1r
              .. cycle;
-       bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0);
-%      remove_overlap (pat, bulb) () R;
-%      fill R1;
+       bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0, show_labels);
 
        fill simple_serif (z1l, z1r, 40)
             --- z2r
@@ -316,21 +323,18 @@ def draw_eighth_rest =
             --- z1l
             .. cycle;
 
-       penlabels (1, 2);
-       labels (9);
-
        % draw_staff (-2, 2, 0.0);
 enddef;
 
 
 fet_beginchar ("Classical quarter rest", "2classical");
-       draw_eighth_rest;
+       draw_eighth_rest (0);
        currentpicture := currentpicture xscaled -1 shifted (w, 0);
 fet_endchar;
 
 
 fet_beginchar ("8th rest", "3");
-       draw_eighth_rest;
+       draw_eighth_rest (1);
 fet_endchar;
 
 
@@ -358,17 +362,17 @@ fet_beginchar ("16th rest", "4");
        y1 = -2 staff_space ;
        y2 = h -  lower_brush;
        x2r = width;
-       z2 = z1 + whatever*dir(74);
-               z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
+       z2 = z1 + whatever*dir (74);
+               z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
        pat = z1l
              --- z2l
              .. z9
              .. z2r
              --- z1r
              .. cycle;
-       bulb_a = draw_rest_bulb (0.5 staff_space, y2r, pat, 0.98);
+       bulb_a = draw_rest_bulb (0.5 staff_space, y2r, pat, 0.98, 1);
        bulb_b = draw_rest_bulb (-0.5 staff_space,
-                               (-0.5 + 0.2) * staff_space, pat, 1.02);
+                               (-0.5 + 0.2) * staff_space, pat, 1.02, 1);
 
        fill simple_serif (z1l, z1r, 40)
             --- z2r
@@ -412,11 +416,11 @@ fet_beginchar ("32th rest", "5");
              .. z2r
              --- z1r
              .. cycle;
-       bulb_a = draw_rest_bulb( 1.5 staff_space, y2r, pat, 0.96);
-       bulb_b = draw_rest_bulb0.5 staff_space,
-                                (0.5 + 0.2) * staff_space, pat, 1.00);
-       bulb_c = draw_rest_bulb-0.5 staff_space,
-                                (-0.5 + 0.21) * staff_space, pat, 1.04);
+       bulb_a = draw_rest_bulb ( 1.5 staff_space, y2r, pat, 0.96, 1);
+       bulb_b = draw_rest_bulb (0.5 staff_space,
+                                (0.5 + 0.2) * staff_space, pat, 1.00, 1);
+       bulb_c = draw_rest_bulb (-0.5 staff_space,
+                                (-0.5 + 0.21) * staff_space, pat, 1.04, 1);
 
        fill simple_serif (z1l, z1r, 40)
             --- z2r
@@ -461,13 +465,13 @@ fet_beginchar ("64th rest", "6");
              .. z2r
              --- z1r
              .. cycle;
-       bulb_a = draw_rest_bulb (1.5 staff_space, y2r, pat, 0.94);
+       bulb_a = draw_rest_bulb (1.5 staff_space, y2r, pat, 0.94, 1);
        bulb_b = draw_rest_bulb (0.5 staff_space,
-                                (0.5 + 0.20) * staff_space, pat, 0.98);
+                                (0.5 + 0.20) * staff_space, pat, 0.98, 1);
        bulb_c = draw_rest_bulb (-0.5 staff_space,
-                                (-0.5 + 0.21) * staff_space, pat, 1.02);
+                                (-0.5 + 0.21) * staff_space, pat, 1.02, 1);
        bulb_d = draw_rest_bulb (-1.5 staff_space,
-                                (-1.5 + 0.22) * staff_space, pat, 1.06);
+                                (-1.5 + 0.22) * staff_space, pat, 1.06, 1);
 
        fill simple_serif (z1l, z1r, 40)
             --- z2r
@@ -513,15 +517,15 @@ fet_beginchar ("128th rest", "7");
              .. z2r
              --- z1r
              .. cycle;
-       bulb_a = draw_rest_bulb (2.5 staff_space, y2r, pat, 0.92);
+       bulb_a = draw_rest_bulb (2.5 staff_space, y2r, pat, 0.92, 1);
        bulb_b = draw_rest_bulb (1.5 staff_space,
-                                (1.5 + 0.20) * staff_space, pat, 0.96);
+                                (1.5 + 0.20) * staff_space, pat, 0.96, 1);
        bulb_c = draw_rest_bulb (0.5 staff_space,
-                                (0.5 + 0.21) * staff_space, pat, 1.0);
+                                (0.5 + 0.21) * staff_space, pat, 1.0, 1);
        bulb_d = draw_rest_bulb (-0.5 staff_space,
-                                (-0.5 + 0.22) * staff_space, pat, 1.04);
+                                (-0.5 + 0.22) * staff_space, pat, 1.04, 1);
        bulb_e = draw_rest_bulb (-1.5 staff_space,
-                                (-1.5 + 0.23) * staff_space, pat, 1.08);
+                                (-1.5 + 0.23) * staff_space, pat, 1.08, 1);
 
        fill simple_serif (z1l, z1r, 40)
             --- z2r
index 4ef8e0b7bcc366ef75797d8cc86a0fd731f48867..aa4d2cd10c5363aac4d077235a4411fa6755f164 100644 (file)
 % feta-klef.mf --  implement Clefs -*-Fundamental-*-
-% 
+%
 % part of LilyPond's pretty-but-neat music font
 %
 % source file of the Feta (not the Font-En-Tja) music font
-% 
+%
 % (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
 % Jan Nieuwenhuizen <janneke@gnu.org>,
 % Juergen Reuter <reuter@ipd.uka.de>
 
 
-fet_begingroup("clefs");
-test_staff = 0;
+fet_begingroup ("clefs");
+
+test_staff := 0;
 
 
 % [Wanske] says the bulbs should be positioned about 1/4 right of the
-% "arrow"
+% "arrow".
 
 %
 % TODO: the hair-curve at z6r looks a little awkward.
-def draw_c_clef (expr reduction) = 
+%
+
+def draw_c_clef (expr reduction) =
        save hair, norm, reduced_ss, right_edge;
-       reduced_ss#=staff_space#*reduction;
-       norm#:=2/3reduced_ss#;
-       hair#:=0.06 reduced_ss# + 0.5 linethickness# ;
+       save xoff;
 
-       right_edge# = 15/4norm#+2hair#;
+       reduced_ss# = staff_space# * reduction;
+       norm# := 2/3 reduced_ss#;
+       hair# := 0.06 reduced_ss# + 0.5 linethickness#;
+       right_edge# = 15/4 norm# + 2 hair#;
+       define_pixels (hair, norm, reduced_ss, right_edge);
 
-       set_char_box (0, right_edge# + 0, 
-               2 reduced_ss#, 2 reduced_ss#);
-       define_pixels (hair,norm,reduced_ss, right_edge);
+       set_char_box (0, right_edge# + 0,
+                     2 reduced_ss#, 2 reduced_ss#);
 
-       draw_block ((0,-d), (3/4norm+1/2hair,h));
-       draw_block ((3/4norm+2hair,-d), 
-               (3/4norm+7/2hair,h));
+       draw_block ((0, -d), (3/4 norm + 1/2 hair, h));
+       draw_block ((3/4 norm + 2 hair, -d), (3/4 norm + 7/2 hair, h));
 
-       
-       save xoff;
-       xoff=3/4norm+7/2hair;
+       xoff = 3/4 norm + 7/2 hair;
        z5l = (xoff - 3/4 hair, 0);
        z5r = (x4, 0);
 
-       penpos1(hair,-90);
-       z1l=(xoff+norm+hair,h);
-       penpos2(norm-3/2hair,180);
-       z2l=(right_edge,h/2);
-       penpos3(hair,90);
-       z3=(((right_edge -xoff)/2)+xoff,2hair);
+       penpos1 (hair, -90);
+       z1l = (xoff + norm + hair, h);
 
-       penpos4(hair,0);
-       z4=(xoff+1/2norm+1/2hair, reduced_ss - linethickness - .2 hair);
+       penpos2 (norm - 3/2 hair, 180);
+       z2l = (right_edge, h / 2);
 
-       penpos6(norm-hair,90);
-       z6=(xoff+3/4norm,0);
+       penpos3 (hair, 90);
+       z3 = ((right_edge - xoff) / 2 + xoff, 2 hair);
 
+       penpos4 (hair, 0);
+       z4 = (xoff + 1/2 norm + 1/2 hair,
+             reduced_ss - linethickness - .2 hair);
+
+       penpos6 (norm - hair, 90);
+       z6 = (xoff + 3/4 norm, 0);
+
+       save t;
+       t = 0.833;
+
+       save p;
+       path p;
 
-       save t; t=0.833;
-       save p; path p;
-       p = z5l..z4l{up}..z4r{down}..z3r{right}..tension t..z2r{up}
-               ..tension t..
-               flare_path(z1l,180,90,hair,norm-1/2hair, -1)
-               ..tension t..z2l{down}
-               ..z3l{left}..z6r..z5r{down};
        pickup pencircle scaled 1pt#;
-       filldraw p..(reverse p yscaled -1)..cycle;
-       penlabels (1,2,3,4,5,6);
+
+       p = z5l{curl 1}
+           .. z4l{up}
+           .. z4r{down}
+           .. z3r{right}
+           ..tension t.. z2r{up}
+           ..tension t.. flare_path (z1l, 180, 90, hair, norm - 1/2 hair, -1)
+           ..tension t.. z2l{down}
+           .. z3l{left}
+           .. z6r
+           .. z5r{down};
+
+       % mf2pt1 replaces `filldraw' with `fill' -- since we use fontforge
+       % for postprocessing and hinting, we don't have to care for a
+       % minimum width of the contour.
+       filldraw p
+                & reverse p yscaled -1
+                & cycle;
+
+       penlabels (1, 2, 3, 4, 5, 6);
 
        % ugh, should be bulb, not flare?
+enddef;
 
-       enddef;
 
 fet_beginchar ("C clef", "C")
        if test_staff = 1:
                draw_staff (-2,2, 0.0);
        fi;
+
        draw_c_clef (1.0);
 fet_endchar;
 
+
 fet_beginchar ("C clef", "C_change")
        if test_staff = 1:
                draw_staff (-2,2, 0.0);
        fi;
+
        draw_c_clef (.8);
 fet_endchar;
 
+
 %
 % New bulb routine:
 %
-% Insert a brushed piece of the path, and draw a bulb separately
+% Insert a brushed piece of the path, and draw the rest of the bulb
+% separately.
 %
-% The bulb is  circular form. Neat merging of the bulb and brushed path
+% The bulb has circular form.  Neat merging of the bulb and brushed path
 % is done by playing with tension.
 %
-%
-
-def new_bulb (expr outer_tangent_point, 
-    big_radius, bulb_radius, flare, direction, turning_dir) =
 
+def new_bulb (expr start_point, start_angle,
+             outer_tangent_point,
+             end_point, end_angle,
+             big_radius, bulb_radius, flare,
+             direction, turning_dir) =
 begingroup;
-    save p, oldpen;
-    path p;
-    pen oldpen;
-    save center;
-    pair center;
-    clearxy;
-    
-    center = outer_tangent_point +big_radius* dir(0) + big_radius* dir(-turning_dir * 90)
-      - bulb_radius * dir (- turning_dir * 90);
-
-    z1 = center + bulb_radius * dir (turning_dir * 180);
-    z2 = center + bulb_radius * dir (turning_dir * 270);
-
-    z9 = center + bulb_radius * dir (0);
-    z10 = center + bulb_radius * dir (turning_dir *90);
-    z3 = outer_tangent_point + flare * dir (0);
-
-    labels(1,2,3,9,10);
-
-    % tension is needed to open up the space between return path and the
-    % ball.
-    fill
-%      draw
-      z9 .. z10 .. tension 1.1  .. z1 .. z2 .. cycle;
-    
-    p:=    outer_tangent_point{dir (-turning_dir* 90)}
-       .. tension 0.97
-       .. {dir (turning_dir * 90)}z9 -- z3
-     ;
-    if direction = 1:
-      p
-    else:
-      reverse p
-    fi
-  endgroup
-enddef;
+       save p, before, after;
+       save center;
+       save u, v;
+       path p, before, after;
+       pair center;
+
+       clearxy;
+
+       center = outer_tangent_point
+                + big_radius * dir (0)
+                + big_radius * dir (-turning_dir * 90)
+                - bulb_radius * dir (-turning_dir * 90);
+
+       z1' = center + bulb_radius * dir (turning_dir * 180);
+       z2' = outer_tangent_point + flare * dir (0);
+       z3' = center + bulb_radius * dir (0);
+       z4' = center + bulb_radius * dir (turning_dir * 90);
+
+       labels (1', 2', 3', 4');
 
+       before := z3'{dir (turning_dir * 90)}
+                 .. z4'
+                 ..tension 1.1.. z1';
+       after := z2'{dir (turning_dir * 90)}
+                .. end_point{dir (end_angle)};
+       (u, v) = before intersectiontimes after;
+
+       p := start_point{dir (start_angle)}
+            .. outer_tangent_point{dir (-turning_dir * 90)}
+            ..tension 0.97.. subpath (0, u) of before
+            .. subpath (v, infinity) of after;
+
+       if direction = 0:
+               p := reverse p'
+       fi
+
+p
+endgroup
+enddef;
 
 
 %
 %
-% There is  some variation is shape of bass clefs. Important points
+% There is some variation in the shape of bass clefs.
 %
-% * the size of the swoosh tip: in some clefs, it almost reaches the
-% bottom staff line, in some it crosses the 2nd line from the bottom
-% with a small overshoot.
+% * In some clefs the size of the swoosh tip almost reaches the
+%   bottom staff line; in some it crosses the 2nd line from the bottom
+%   with a small overshoot.
 %
-% The most popular design is where the X part of the tip is aligned 
-% left bulb boundary, and the Y part ends on the 2nd staffline exactly. 
-% This is what we do.
+%   The most popular design is where the X part of the tip is aligned
+%   with the left bulb boundary, and the Y part ends on the 2nd
+%   staffline exactly.  This is what we do.
 %
-% * The size of the bulb. The diameter of the bulb is the width of the 
-% open space.
+% * The diameter of the bulb is the width of the open space.
 %
-% * The y-alignment of the bulb. The center of the bulb can be on or slightly 
-% above the staff line.
+% * The vertical center of the bulb can be on or slightly above the
+%   staff line.
 %
-% * The position of the dots. They can be symmetrical around the
-% staffline, centered in the staff space. The Baerenreiter SCS has the
-% bottom dot raised by approx. 0.1 ss.
+% * The vertical position of the dots can be symmetrical around the
+%   staffline, centered in the staff space.  The Baerenreiter SCS has
+%   the bottom dot raised by approximately 0.1 staff space.
 %
-% * uncarefully set music may have overshoots at the top. We have none. 
+% * Uncarefully set music may have overshoots at the top.  We have none.
 %
 % * It is not exactly clear where the vertical tangent at the right
-% of the swoosh should be.
-%
+%   of the swoosh should be.
 %
 
-def draw_bass_clef(expr exact_center, reduction) = 
-        save reduced_ss, left_tilt, left_thick, swoosh_width;
+def draw_bass_clef (expr exact_center, reduction) =
+       save reduced_ss, swoosh_width;
        save right_thickness, tip_protude;
+       save dot_diam, bulb_y_offset, overshoot_top;
        pair tip_protude;
-        save dot_diam;
-        reduced_ss# = staff_space# * reduction;
 
-        2.2 dot_diam = round reduction* (staff_space - stafflinethickness);
-       right_thickness = 0.37 staff_space + 1.2 linethickness ;
-        swoosh_width# = 2.1 reduced_ss#;
+       reduced_ss# = staff_space# * reduction;
+
+       2.2 dot_diam = round reduction * (staff_space - stafflinethickness);
+       right_thickness = 0.37 staff_space + 1.2 linethickness;
+       swoosh_width# = 2.1 reduced_ss#;
 %      tip_protude := (-linethickness, -.2 staff_space);
-       tip_protude := (0, 0);  
+       tip_protude := (0, 0);
        bulb_y_offset := 0.15 staff_space;
        overshoot_top := 0.0;
-       %% 
 
-        set_char_box(0 +
-                - xpart exact_center,
-                0 +
-                xpart exact_center + swoosh_width# + 7/12 reduced_ss#, 
-                - ypart exact_center + 2.5 reduced_ss#, 
-                ypart exact_center +reduced_ss#);
+       define_pixels (swoosh_width);
+       define_whole_pixels (reduced_ss);
 
-        define_pixels(swoosh_width);
-       define_whole_pixels(reduced_ss); 
-        left_tilt = 5;
+       set_char_box (-xpart exact_center,
+                     xpart exact_center + swoosh_width# + 7/12 reduced_ss#,
+                     -ypart exact_center + 2.5 reduced_ss#,
+                     ypart exact_center + reduced_ss#);
 
        y1 = bulb_y_offset;
        x1 = 0;
 
-        x2 = .5 [x1,x3];
+       x2 = .5 [x1, x3];
        x2l = x2r = x2;
 
        y2l := vround_pixels (reduced_ss#  + 0.5 linethickness#);
        y2l - y2r = (1.0 + overshoot_top) * linethickness;
 
-        x3l - x1 =  swoosh_width;
-        x3l - x3r = right_thickness;
+       x3l - x1 = swoosh_width;
+       x3l - x3r = right_thickness;
 
-       % try to correct: the top dot seems farther away if y3l = 0.
-        y3l = 0.05 staff_space;
-       
-        z4 =  - (0, 2.0 reduced_ss) + tip_protude;
+       % optical correction: the top dot seems farther away if y3l = 0.
+       y3l = 0.05 staff_space;
 
-        z5 = (x3l +  1/3 reduced_ss, .5 reduced_ss);
+       z4 = -(0, 2.0 reduced_ss) + tip_protude;
+       z5 = (x3l + 1/3 reduced_ss, .5 reduced_ss);
 
-        penpos3(whatever,  185);
-        penpos4(linethickness, 135);
+       penpos3 (whatever, 185);
+       penpos4 (linethickness, 135);
 
-       pickup pencircle scaled 1; 
-%      draw
-       fill
-           new_bulb (z1, 0.45 reduced_ss, 0.4 reduced_ss, 2.5 linethickness,  1, 1)
+       fill new_bulb (z2l, 180, z1, z2r, 0,
+                      0.45 reduced_ss, 0.4 reduced_ss,
+                      2.5 linethickness, 1, 1)
+            .. z3r{down}
+            .. {curl 0}simple_serif (z4r, z4l, 90){curl 0}
+            .. z3l{up}
+            ..tension 0.9.. cycle;
 
-{dir (90)}
-               .. z2r{right} .. tension 1.0 .. z3r{down}  .. {curl 0} 
-                simple_serif(z4r, z4l, 90) {curl 0}
-                .. z3l{up} .. tension 0.9 .. z2l{left} 
-                 .. cycle
-               ;
-        labels(2,4);
-        labels(range 1 thru 12);
+       penlabels (1, 2, 3, 4, 5);
 
-       penlabels(2,3,4);
+       pickup pencircle scaled dot_diam;
 
-        pickup pencircle scaled dot_diam;
-        drawdot z5;
-        drawdot z5 yscaled -1;
+       drawdot z5;
+       drawdot z5 yscaled -1;
 enddef;
 
 
-
-
-fet_beginchar("F clef ", "F")
+fet_beginchar ("F clef ", "F")
        if test_staff = 1:
-               draw_staff(-3,1, 0.0);
+               draw_staff (-3,1, 0.0);
        fi;
-       draw_bass_clef((0, 0), 1.0);
+
+       draw_bass_clef ((0, 0), 1.0);
 fet_endchar;
 
-fet_beginchar("F clef (reduced)", "F_change")
-       draw_bass_clef((0, 0),0.8);
+
+fet_beginchar ("F clef (reduced)", "F_change")
+       draw_bass_clef ((0, 0), 0.8);
 fet_endchar;
 
 
 
 %
 % Inspired by Baerenreiter
-% 
+%
 
 % Beste lezers, kijk,
 %
-% Een bolletje  hebben we bij toeval allemaal wel eens getekend, maar begint u
-% toch eenvoudig.   Eerst een eenvoudig kruis of herstellingsteken
+% Een bolletje hebben we bij toeval allemaal wel eens getekend, maar begint u
+% toch eenvoudig.  Eerst een eenvoudig kruis of herstellingsteken
 % en via de dubbelslag naar een voorzichtig vlaggetje, en heb geduld!
 % Ikzelf heb bijvoorbeeld over mijn eerste gave G-sleutel
 % 35 kilobyte metafont, 12 patchlevels, 0 vriendinnen en 45 dagen gedaan
 %
 %  -- vrij naar Van Kooten & De Bie
 %
+
 def debugfill = fill enddef;
-def draw_gclef (expr reduction)=
+
+def draw_gclef (expr reduction) =
        save reduced_ss, downstroke_dir, downstroke_angle, center;
        save breapth_factor, inner_thick_end, thinness, thickness, thinnib;
-       save inner_start_angle, thinness;
-       reduced_ss# = staff_space# * reduction;
-       define_pixels(reduced_ss);
+       save start_angle, inner_start_angle, thinness;
+       save upward_swoosh_angle, bot_angle;
+       save p;
+       path p;
        pair downstroke_dir, center;
 
+       reduced_ss# = staff_space# * reduction;
+       define_pixels (reduced_ss);
+
        thinness = 0.08 staff_space + 0.7 linethickness;
        downstroke_dir = unitvector (14, -75);
        downstroke_angle = angle downstroke_dir;
+       bot_angle = -180;               % downstroke_angle - 87
 
+       upward_swoosh_angle = 132;
+       start_angle = -95;
 
        breapth_factor = 21.0 /14;
        inner_thick_end = 45;
@@ -286,408 +312,355 @@ def draw_gclef (expr reduction)=
 
        thinnib = thinness;
 
-       
-       set_char_box(0,
-                1.71 * breapth_factor* reduced_ss#, 
-                2.6 * reduced_ss#,
-                5 * reduced_ss#);
-
-       center := (1.0 * breapth_factor* reduced_ss, 0);
+       set_char_box (0, 1.71 * breapth_factor * reduced_ss#,
+                     2.6 * reduced_ss#, 5 * reduced_ss#);
 
-       save upward_swoosh_angle;
-       upward_swoosh_angle = 132;
-       penpos7(thickness, upward_swoosh_angle);
-       penpos5(thickness, upward_swoosh_angle);
+       center := (breapth_factor * reduced_ss, 0);
 
-       
        z1 = center + whatever * dir (inner_start_angle);
-       x1 = xpart center -.28 reduced_ss;
-       
-       top z2r = center + (0,reduced_ss + stafflinethickness/2);
-       
-       x4 = xpart center - .1 reduced_ss;
-       bot y4r = -(reduced_ss + .5 stafflinethickness);
+       x1 = xpart center - .28 reduced_ss;
+       penpos1 (thinnib, inner_start_angle);
+
+       z2r = center + (0, reduced_ss + stafflinethickness / 2);
+       penpos2 (thickness, 90);
 
        z3 = (z4 - center) rotated inner_thick_end + center;
-       x5r = - breapth_factor* reduced_ss + xpart center;
+       penpos3 (thinnib, -90 + inner_thick_end);
+
+       x4 = xpart center - .1 reduced_ss;
+       y4r = -(reduced_ss + .5 stafflinethickness);
+       penpos4 (thinnib, -90);
+
+       x5r = -breapth_factor * reduced_ss + xpart center;
        y5r = .37 reduced_ss + ypart center;
+       penpos5 (thickness, upward_swoosh_angle);
 
        z6 = center + whatever * downstroke_dir;
        y6 = ypart center + 2 reduced_ss;
+       % penpos6 is computed later
 
        z7l - z6 = whatever * (z5 - z6) ;
        y7l = 3.5 reduced_ss;
+       penpos7 (thickness, upward_swoosh_angle);
 
        x9 = .7 [x10, x7r];
        top y9l = 5 reduced_ss;
+       penpos9 (1.45 thickness, -70);
 
-       y11 = ypart center  - 47/28 reduced_ss;
-       y12 = ypart center  - 71/28 reduced_ss;
-       y13 = .48 [y12,y4r];
-       x11 - x13r  = 1.5 reduced_ss + 0.5 thinnib;
-       x12r = xpart (.45 [z13r , z11] + .75 reduced_ss * downstroke_dir) ;
+       x11 - x13r = 1.5 reduced_ss + 0.5 thinnib;
+       y11 = ypart center - 47/28 reduced_ss;
+       y12 = ypart center - 71/28 reduced_ss;
+       y13 = .48 [y12, y4r];
+       x12r = xpart (.45 [z13r, z11] + .75 reduced_ss * downstroke_dir);
 
-%      z10=  center + whatever * dir (downstroke_angle - 1.5 );
+%      z10 = center + whatever * dir (downstroke_angle - 1.5);
        x10 = x6 - 2 thinnib;
-       y10 = ypart center + 3.5  reduced_ss;
-       y10l  - y10r = 1.2 thickness;
-       z10r - z10l =
-               .7 thinnib* dir (downstroke_angle + 90) + whatever * downstroke_dir;
-
+       y10 = ypart center + 3.5 reduced_ss;
+       y10l - y10r = 1.2 thickness;
+       z10r - z10l = .7 thinnib * dir (downstroke_angle + 90)
+                     + whatever * downstroke_dir;
        z10 = .5 [z10l, z10r];
-
-       z11 =  center + whatever * downstroke_dir +  ( .00 reduced_ss, 0);
-
-       penpos1(thinnib, inner_start_angle);
-       penpos2(thickness, 90);
-       penpos3(thinnib, -90 + inner_thick_end);
-       penpos4(thinnib, -90);
-
-
-       penpos9(1.45 thickness, -70);  
-       save lipje;
-       pair lipje;
-       lipje= .5 [z9l, z9r] +  .25 ((z9r- z9l)  rotated -90);
-       penpos13(thinnib + 0.14 staff_space, 180);
-
-       pickup pencircle scaled 1;
-
-       debugfill
-               z2l{right}
-               .. z3l
-               .. z4l{left}
-               .. z5l{up}
-               .. z7l{up} 
-               .. tension 1.2 
-               .. z9l -- lipje
-               --z9r % {dir (downstroke_angle+ 0)}
-               .. tension 0.8
-               .. z7r{down} .. z5r{down} .. z4r{right}
-               .. z3r .. z2r{left} .. 
-               tension .95 .. 
-               z1r -- simple_serif(z1r, z1l, 80) -- z1l 
-               .. tension 0.85 ..cycle;
-
-       save p, staffline_time, staff_line_path, down_staff_line_intersection;
-       path p, staff_line_path;
-       pair down_staff_line_intersection;
-       p := z4{left} .. z5{up} .. z7{up} ;
-
-       staff_line_path := (-reduced_ss, 2 reduced_ss) ..  (2 reduced_ss,2 reduced_ss);
-
-       draw p;
-
-
-       % we don't do this with a path: variations in thickness
-       % are  very easily made and look very ugh.
-       pickup pencircle scaled thinnib;
-       
-
-       save bot_angle;
-
-       bot_angle = -180; % downstroke_angle- 87;
-
-       penpos12(thinnib, bot_angle + 90);
-
-       p := z9 .. z10{down}
-               .. z6
-               .. z11{dir (-95) }
-               .. z12{dir(bot_angle)}
-               .. z13{up}
-       ;
-       save down_intersection_t;       
-       down_intersection_t :=  xpart (p intersectiontimes  staff_line_path) ;
-       down_staff_line_intersection = point down_intersection_t of p;
-       z14 = down_staff_line_intersection;
-       penpos14(thinnib, angle (direction down_intersection_t of p) + 90);
-
-       save start_angle;
-       start_angle=angle (direction xpart (p intersectiontimes z11) of p);
-       penpos11 (thinnib, start_angle+ 90);
-
-       save loop_end_dir;
-       pair loop_end_dir;
-       loop_end_dir = direction (xpart (p intersectiontimes staff_line_path)) of p;
-       draw p;
-
-       penpos6(thinnib, angle (loop_end_dir) + 90);
-       pickup pencircle scaled 1;
-       debugfill
-               z9l
-               .. {down}z10l
-               .. z14l{loop_end_dir} -- z14r{-loop_end_dir}
-               .. z10r{up}
-               .. tension .98
-               .. z9r
-               -- cycle;
-
-       pickup pencircle scaled 1;
-
-       debugfill
-               z11r{dir(start_angle)}
-               .. z12r{dir(bot_angle)}
-
-               ..new_bulb (z13r, 0.45 reduced_ss, 0.38 reduced_ss, thinnib
-                       + .15 staff_space
-                       ,  1, -1) {down}
-
-%              .. tension 0.98
-               .. z12l{-dir (bot_angle)}
-
-               .. z11l{-dir(start_angle)}
-               .. cycle;
-
-
-
-       penlabels(range 1 thru 16);
+       z11 = center + whatever * downstroke_dir + (0 reduced_ss, 0);
+
+       penpos11 (thinnib, start_angle + 90);
+       penpos12 (thinnib, bot_angle + 90);
+       penpos13 (thinnib + 0.14 staff_space, 180);
+
+       % this auxiliary point ensures good contour overlapping
+       z8 = .5 [z9l, z9r] + .25 ((z9r - z9l) rotated -90);
+
+       fill z2l{right}
+            .. z3l
+            .. z4l{left}
+            .. z5l{up}
+            .. z7l{up}
+            ..tension 1.2.. z9l
+            -- z8
+            -- z9r                     % {dir (downstroke_angle + 0)}
+            ..tension 0.8.. z7r{down}
+            .. z5r{down}
+            .. z4r{right}
+            .. z3r
+            .. z2r{left}
+            ..tension .95.. z1r
+            -- simple_serif (z1r, z1l, 80)
+            -- z1l
+            ..tension 0.85.. cycle;
+
+       p := z10{down}
+            .. z6
+            .. z11{dir (start_angle)};
+
+       penpos6 (thinnib, angle (direction 1 of p) + 90);
+
+       % two auxiliary points to simulate `draw' with `penstroke'
+       z10' = point 0.5 of p;
+       penpos10' (thinnib, angle (direction 0.5 of p) + 90);
+       z11' = point 1.5 of p;
+       penpos11' (thinnib, angle (direction 1.5 of p) + 90);
+
+       penstroke z9e
+                 .. z10e{down}
+                 .. z10'e
+                 .. z6e
+                 .. z11'e
+                 .. z11e{dir (-95)}
+                 .. z12e{dir (bot_angle)};
+
+       fill new_bulb (z12r, bot_angle, z13r, z12l, bot_angle + 180,
+                      0.45 reduced_ss, 0.38 reduced_ss,
+                      thinnib + .15 staff_space, 1, -1)
+            -- cycle;
+
+       penlabels (range 1 thru 16);
+       penlabels (10', 11');
 enddef;
 
 
-fet_beginchar("G clef", "G")
+fet_beginchar ("G clef", "G")
        if test_staff = 1:
-               draw_staff(-1,3, 0.0);
+               draw_staff (-1,3, 0.0);
        fi;
-       draw_gclef(1.0);
+
+       draw_gclef (1.0);
 fet_endchar;
 
-fet_beginchar("G clef", "G_change")
-       draw_gclef(0.8);
+
+fet_beginchar ("G clef", "G_change")
+       draw_gclef (0.8);
 fet_endchar;
 
+
 %%%%
-% PERCUSSION
 %
+% PERCUSSION
 %
 
-
-
-%%
 %
-% The perc clef extent is not coincident with its bbox, since 
-%  the perc clef needs more space in front than a normal clef.
+% The percussion clef extent is not coincident with its bbox, since
+% the percussion clef needs more space in front than a normal clef.
 %
 
-def draw_percussion_clef(expr reduction) =
+def draw_percussion_clef (expr reduction) =
        save reduced_ss, razt;
 
        reduced_ss# = staff_space# * reduction;
-       define_pixels(reduced_ss);
-       set_char_box(-.67reduced_ss#,2.0reduced_ss#,reduced_ss#,reduced_ss#);
-       razt := 0.45reduced_ss;
-       draw_block((-b,-d),(-b+razt,h));
-       draw_block((w-razt,-d),(w,h));
+       define_pixels (reduced_ss);
+
+       set_char_box (-.67 reduced_ss#, 2.0 reduced_ss#,
+                     reduced_ss#, reduced_ss#);
+
+       razt := 0.45 reduced_ss;
+
+       draw_block ((-b, -d), (-b + razt, h));
+       draw_block ((w - razt, -d), (w, h));
 enddef;
 
-fet_beginchar("percussion clef", "percussion")
-       draw_percussion_clef(1.0);
+
+fet_beginchar ("percussion clef", "percussion")
+       draw_percussion_clef (1.0);
 fet_endchar;
 
-fet_beginchar("percussion clef (reduced)", "percussion_change")
-       draw_percussion_clef(.8);
+
+fet_beginchar ("percussion clef (reduced)", "percussion_change")
+       draw_percussion_clef (.8);
 fet_endchar;
 
-def draw_tab_T(expr pos, siz, slant) =
-       begingroup;
-       clearxy;
+
+def draw_tab_T (expr pos, siz, slant) =
+begingroup;
        pair vx,vy;
-       vx=(xpart siz) * dir 0;
-       vy=(ypart siz) * dir 90;
-
-       penpos1(.75penh, 100);
-       z1=z2+(1/6*vx-.15*vy);
-       penpos2(.9penw, 0);
-       z2l = pos+.75vy;
-       penpos3(penh,-100);
-       z3l = pos+.4vx+vy;
-       penpos4(penh,-90);
-       z4=-.1vy+.5[z3,z5];
-       penpos5(.8penh,-30);
-       x5r=xpart (pos+siz);
-       y5l=ypart (pos+siz);
-
-       penpos10(penw,170);
-       z10=pos+.55vx+.85vy;
-       penpos11(.75[penh,penw],170);
-       z11=z10-.5vy+.025vx;
-       penpos12(penh,100);
-       z12l=(xpart .5[z13,z11],ypart (pos-.025*siz));
-       penpos13(.75penh,60);
-       z13=pos +.2vx+.15vy;
-       
-       % penlabels (1,2,3,4,5,10,11,12,13);
-
-       soft_penstroke (z1e..tension 1.1
-               ..z2e
-               ..z3e{right}..tension 1.5
-               ..z4e
-               ..z5e
-               ) slanted slant shifted (slant*-ypart pos,0);
-
-       soft_penstroke (z10e..tension 1.5
-               ..z11e
-               ..z12e..tension 1.1
-               ..z13e{(z13r-z13l) rotated 90}
-               ) slanted slant shifted (slant*-ypart pos,0);
-       endgroup;
-enddef;
-          
-def draw_tab_A(expr pos, siz, slant) =
-       begingroup;
+
        clearxy;
-       pair vx,vy;
-       vx=(xpart siz) * dir 0;
-       vy=(ypart siz) * dir 90;
+
+       vx = (xpart siz) * dir 0;
+       vy = (ypart siz) * dir 90;
+
+       penpos1 (.75 penh, 100);
+       z1 = z2 + (1/6 * vx - .15 * vy);
+       penpos2 (.9 penw, 0);
+       z2l = pos + .75 vy;
+       penpos3 (penh, -100);
+       z3l = pos + .4 vx + vy;
+       penpos4 (penh, -90);
+       z4 = -.1 vy + .5 [z3, z5];
+       penpos5 (.8 penh, -30);
+       x5r = xpart (pos + siz);
+       y5l = ypart (pos + siz);
+
+       penpos10 (penw, 170);
+       z10 = pos + .55 vx + .85 vy;
+       penpos11 (.75 [penh, penw], 170);
+       z11 = z10 - .5 vy + .025 vx;
+       penpos12 (penh, 100);
+       z12l = (xpart .5 [z13, z11], ypart (pos - .025 * siz));
+       penpos13 (.75 penh, 60);
+       z13 = pos + .2 vx + .15 vy;
+
+       % penlabels (range 1 thru 13);
+
+       soft_penstroke (z1e
+                       ..tension 1.1.. z2e
+                       .. z3e{right}
+                       ..tension 1.5.. z4e
+                       ..z5e)
+         slanted slant shifted (slant * -ypart pos, 0);
+
+       soft_penstroke (z10e
+                       ..tension 1.5.. z11e
+                       .. z12e
+                       ..tension 1.1.. z13e{(z13r - z13l) rotated 90})
+         slanted slant shifted (slant * -ypart pos, 0);
+endgroup;
+enddef;
+
        
-       penpos1(.75penh,-110);
-       z1r=pos+.07vy;
-       penpos2(penh,-75);
-       z2r=(.5[x1,x3],ypart pos);
-       penpos3(.25[penh,penw],-30);
-       z3=(.45[x2,x4],.15[y2,y4]);
-       penpos4(1[penh,penw],0);
-       z4=pos+.5vx+.975vy;
-
-       penpos5(1[penh,penw],-180);
-       z5=z4;
-       penpos6(.2[penh,penw],-150);
-       z6l=(.8[x5l,x7l],.9[y5l,y7l]);
-       penpos7(penh,-90);
-       z7r=(.5[x6,x8],ypart pos);
-       penpos8(.75penh,-70);
-       z8r=(xpart(pos+siz),y7r+.075ypart(siz));
-
-       penpos10(penh,-105);
-       z10=.2[z3,z4];
-       penpos11(.9penh,-90);
-       z11=.4[z10,z6]-0.05vy;
-       penpos12(.75penh,-75);
-       z12=.3[z11,z6]+0.02vy;
-
-       % penlabels(1,2,3,4,5,6,7,8,10,11,12);
-
-       soft_penstroke (z1e {(z1r-z1l) rotated 90}
-               ..z2e 
-               ..z3e
-               ..z4e
-               ) slanted slant shifted (slant*-ypart pos,0);
+def draw_tab_A (expr pos, siz, slant) =
+begingroup;
+       pair vx,vy;
+
+       clearxy;
+
+       vx = (xpart siz) * dir 0;
+       vy = (ypart siz) * dir 90;
+
+       penpos1 (.75 penh, -110);
+       z1r = pos + .07 vy;
+       penpos2 (penh, -75);
+       z2r = (.5 [x1, x3], ypart pos);
+       penpos3 (.25 [penh, penw], -30);
+       z3 = (.45 [x2, x4], .15 [y2, y4]);
+       penpos4 (1 [penh, penw], 0);
+       z4 = pos + .5 vx + .975 vy;
+
+       penpos5 (1 [penh, penw], -180);
+       z5 = z4;
+       penpos6 (.2 [penh, penw], -150);
+       z6l = (.8 [x5l, x7l], .9 [y5l, y7l]);
+       penpos7 (penh,-90);
+       z7r = (.5 [x6, x8], ypart pos);
+       penpos8 (.75 penh, -70);
+       z8r = (xpart (pos + siz), y7r + .075 ypart (siz));
+
+       penpos10 (penh, -105);
+       z10 = .2 [z3, z4];
+       penpos11 (.9 penh, -90);
+       z11 = .4 [z10, z6] - 0.05 vy;
+       penpos12 (.75 penh, -75);
+       z12 = .3 [z11, z6] + 0.02 vy;
+
+       % penlabels (range 1 thru 12);
+
+       soft_penstroke (z1e{(z1r - z1l) rotated 90}
+                       .. z2e
+                       .. z3e
+                       .. z4e)
+         slanted slant shifted (slant * -ypart pos, 0);
 
        soft_penstroke (z5e
-               ..z6e 
-               ..z7e
-               ..z8e {(z8r-z8l) rotated 90}
-               ) slanted slant shifted (slant*-ypart pos,0);
+                       .. z6e
+                       .. z7e
+                       .. z8e{(z8r - z8l) rotated 90})
+         slanted slant shifted (slant * -ypart pos, 0);
 
        soft_penstroke (z10e
-               ..z11e
-               ..z12e
-               ) slanted slant shifted (slant*-ypart pos,0);
-
-       endgroup;
+                       .. z11e
+                       .. z12e)
+         slanted slant shifted (slant * -ypart pos, 0);
+endgroup;
 enddef;
 
-def draw_tab_B(expr pos, siz, slant) =
-       begingroup;
-       clearxy;
+
+def draw_tab_B (expr pos, siz, slant) =
+begingroup;
        pair vx,vy;
-       vx=(xpart siz) * dir 0;
-       vy=(ypart siz) * dir 90;
-
-       penpos1(.75penh, 100);
-       z1=z2+(.15*vx-.1*vy);
-       penpos2(.9penw, 0);
-       z2l = pos+.75vy;
-       penpos3(penh,-100);
-       z3l = pos+.4vx+1.05vy;
-       penpos4(.8[penh,penw],-180);
-       z4=(xpart(pos+.75siz),.5[y3,y5]);
-       penpos5(.8penh,90);
-       z5=(.5[x10,x4],ypart (pos+.55siz));
-
-       penpos6(.8penh,270);
-       z6=z5;
-       penpos7(penw,180);
-       z7l=(xpart(pos+siz),.5[y6,y8]);
-       penpos8(.8penh,45);
-       z8=.5[z12l,z11l]+.15vx-.05vy;
-
-       penpos10(.75[penh,penw],170);
-       z10=pos+.375vx+.95vy;
-       penpos11(.8[penh,penw],150);
-       z11=z10-.5vy+.04vx;
-       penpos12(penh,100);
-       z12l=(xpart .5[z13,z11],ypart pos);
-       penpos13(.75penh,60);
-       z13=pos+.1vx+.15vy;
-       
-       % penlabels (1,2,3,4,5,6,7,8,10,11,12,13);
 
-       soft_penstroke (z1e..tension 1.1
-               ..z2e
-               ..z3e
-               ..z4e
-               ..z5e{left}
-               ) slanted slant shifted (slant*-ypart pos,0);
+       clearxy;
+
+       vx = (xpart siz) * dir 0;
+       vy = (ypart siz) * dir 90;
+
+       penpos1 (.75 penh, 100);
+       z1 = z2 + (.15 * vx - .1 * vy);
+       penpos2 (.9 penw, 0);
+       z2l = pos+.75 vy;
+       penpos3 (penh, -100);
+       z3l = pos + .4 vx + 1.05 vy;
+       penpos4 (.8 [penh, penw], -180);
+       z4 = (xpart (pos + .75 siz), .5 [y3, y5]);
+       penpos5 (.8 penh, 90);
+       z5 = (.5 [x10, x4], ypart (pos + .55 siz));
+
+       penpos6 (.8 penh, 270);
+       z6 = z5;
+       penpos7 (penw, 180);
+       z7l = (xpart (pos + siz), .5 [y6, y8]);
+       penpos8 (.8 penh, 45);
+       z8 = .5 [z12l, z11l] + .15 vx - .05 vy;
+
+       penpos10 (.75 [penh, penw], 170);
+       z10 = pos + .375 vx + .95 vy;
+       penpos 11 (.8 [penh, penw], 150);
+       z11 = z10 - .5 vy + .04 vx;
+       penpos12 (penh, 100);
+       z12l = (xpart .5 [z13, z11], ypart pos);
+       penpos13 (.75 penh, 60);
+       z13 = pos + .1 vx + .15 vy;
+
+       % penlabels (range 1 thru 13);
+
+       soft_penstroke (z1e
+                       ..tension 1.1.. z2e
+                       .. z3e
+                       .. z4e
+                       ..z5e {left})
+         slanted slant shifted (slant * -ypart pos, 0);
 
        soft_penstroke (z6e{right}
-               ..z7e
-               ..z8e{(z8r-z8l) rotated 90}
-               ) slanted slant shifted (slant*-ypart pos,0);
-
-       soft_penstroke (z10e.. tension 1.5
-               ..z11e
-               ..z12e..tension 1.1
-               ..z13e{(z13r-z13l) rotated 90}
-               ) slanted slant shifted (slant*-ypart pos,0);
-       endgroup;
+                       .. z7e
+                       .. z8e{(z8r - z8l) rotated 90})
+         slanted slant shifted (slant * -ypart pos, 0);
+
+       soft_penstroke (z10e
+                       ..tension 1.5.. z11e
+                       .. z12e
+                       ..tension 1.1.. z13e{(z13r - z13l) rotated 90})
+         slanted slant shifted (slant * -ypart pos, 0);
+endgroup;
 enddef;
 
-def draw_tab_clef(expr reduction) =
-        save reduced_ss,vx,vy,letterheight,penw,penh;
+
+def draw_tab_clef (expr reduction) =
+       save reduced_ss, letterheight, penw, penh;
+
        reduced_ss# = staff_space# * reduction;
-       letterheight# = 1.8*reduced_ss#;
-       define_pixels(reduced_ss,letterheight);
-       set_char_box(-.2*reduced_ss#,2.8*reduced_ss#,1.6*letterheight#,1.6*letterheight#);
+       letterheight# = 1.8 reduced_ss#;
+       define_pixels (reduced_ss, letterheight);
+
+       set_char_box (-.2 reduced_ss#, 2.8 reduced_ss#,
+                     1.6 letterheight#, 1.6 letterheight#);
 
-               %draw_staff (-3,2, 0.5);
+       draw_staff (-3,2, 0.5);
 
-       penw = .45reduced_ss;
-       penh = .2reduced_ss;
+       penw = .45 reduced_ss;
+       penh = .2 reduced_ss;
 
-       draw_tab_T((-b+.15reduced_ss,h-letterheight),
-         (2.1*reduced_ss,letterheight),0.2);
-       draw_tab_A((-b-.05reduced_ss,-.5letterheight +.15reduced_ss),
-         (2.2*reduced_ss,letterheight),0.4);
-       draw_tab_B((-b+.025reduced_ss,-d),
-         (2.1*reduced_ss,letterheight),0.25);
+       draw_tab_T ((-b + .15 reduced_ss, h - letterheight),
+                   (2.1 reduced_ss, letterheight), 0.2);
+       draw_tab_A ((-b - .05 reduced_ss, -.5 letterheight +.15 reduced_ss),
+                   (2.2 reduced_ss, letterheight), 0.4);
+       draw_tab_B ((-b + .025 reduced_ss, -d),
+                   (2.1 reduced_ss, letterheight), 0.25);
 enddef;
 
-fet_beginchar("tab clef", "tab")
-       draw_tab_clef(1.0);
-fet_endchar;
 
-fet_beginchar("tab clef (reduced)", "tab_change")
-       draw_tab_clef(.8);
+fet_beginchar ("tab clef", "tab")
+       draw_tab_clef (1.0);
 fet_endchar;
 
-fet_endgroup("clefs");
-
-if 0 = 1:
-
-%
-% testing unicode/gnome-canvas
-%
 
-savecode:=code;
-code:=97;
-fet_beginchar("Ascii b", "b")
-%%fet_beginchar("G clef", "G")
-       if test_staff = 1:
-               draw_staff(-1,3, 0.0);
-       fi;
-       draw_gclef(1.0);
-       %% charnamestr:="Ascii b";
+fet_beginchar ("tab clef (reduced)", "tab_change")
+       draw_tab_clef (.8);
 fet_endchar;
 
-code:=savecode;
-
-fi
+fet_endgroup ("clefs");
index 3140d6c6c8a28879871b2ffb8eb983a150861dff..d50946054dc381e80351dd181c3f4bad553b51ee 100644 (file)
@@ -1,63 +1,86 @@
 %
 % debugging
 %
+
+def print_penpos (suffix $) =
+       message
+         "z" & str$ & "l = (" & decimal x.$.l & ", " &decimal y.$.l & ");"
+         & " z" & str$ & "r = (" & decimal x.$.r & ", " & decimal y.$.r & ");";
+enddef;
+
+
 def test_grid =
-if test>1:
-       proofrulethickness 1pt#;
-       makegrid(0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor)
-               (0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor);
-       proofrulethickness .1pt#;
-       makegrid(0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor)
-               (0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor);
-fi
-       enddef;
+       if test > 1:
+               proofrulethickness 1pt#;
+
+               makegrid
+                 (0pt, 0pt for i := -5pt step 1pt until 5pt: , i endfor)
+                 (0pt, 0pt for i := -5pt step 1pt until 5pt: , i endfor);
+
+               proofrulethickness .1pt#;
+
+               makegrid
+                 (0pt, 0pt for i := -4.8pt step .2pt until 4.8pt: , i endfor)
+                 (0pt, 0pt for i := -4.8pt step .2pt until 4.8pt: , i endfor);
+       fi;
+enddef;
+
 
 def treq =
        tracingequations := tracingonline := 1;
 enddef;
 
 
-def draw_staff(expr first, last, offset)=
-if test <> 0:
-       pickup pencircle scaled stafflinethickness;
-       for i:= first step 1 until last:
-               draw (- staff_space, (i + offset) * staff_space) .. (4 staff_space,( i+ offset)* staff_space);
-       endfor
-fi;
+def draw_staff (expr first, last, offset) =
+       if test <> 0:
+               pickup pencircle scaled stafflinethickness;
 
+               for i := first step 1 until last:
+                       draw (-staff_space, (i + offset) * staff_space)
+                            .. (4 staff_space, (i + offset) * staff_space);
+               endfor;
+       fi;
 enddef;
 
-% draw the outline of the stafflines. For fine tuning. 
-def draw_staff_outline(expr first, last, offset)=
-if test <> 0:
-       save p;
-       path p;
-       pickup pencircle scaled 2;
-       for i:= first step 1 until last:
-               p := (- staff_space,  (i + offset) * staff_space) .. (4 staff_space,( i+ offset)* staff_space);
 
-               draw p shifted (0, .5 stafflinethickness);
-               draw p shifted (0, -.5 stafflinethickness);
-       endfor
-fi;
+%
+% Draw the outline of the stafflines.  For fine tuning.
+%
+
+def draw_staff_outline (expr first, last, offset) =
+       if test <> 0:
+               save p;
+               path p;
+
+               pickup pencircle scaled 2;
 
+               for i := first step 1 until last:
+                       p := (-staff_space, (i + offset) * staff_space)
+                            .. (4 staff_space, (i + offset) * staff_space);
+
+                       draw p shifted (0, .5 stafflinethickness);
+                       draw p shifted (0, -.5 stafflinethickness);
+               endfor;
+       fi;
 enddef;
 
+
 %
-% Transforms
+% Transformations
 %
 
-def scaledabout(expr point, scale) =
+def scaledabout (expr point, scale) =
        shifted -point scaled scale shifted point
 enddef;
 
 
 %
-% make a local (restored after endgroup) copy of t_var 
+% make a local (restored after endgroup) copy of t_var
 %
-def local_copy(text type, t_var)=
+
+def local_copy (text type, t_var) =
        save copy_temp;
-       type copy_temp; 
+       type copy_temp;
        copy_temp := t_var;
        save t_var;
        type t_var;
@@ -69,84 +92,101 @@ enddef;
 % Urgh! Want to do parametric types
 %
 
-def del_picture_stack=
+def del_picture_stack =
        save save_picture_stack, picture_stack_idx;
 enddef;
 
-% better versions of Taupin/Egler savepic cmds
+
 %
+% better versions of Taupin/Egler savepic cmds
 %
-def make_picture_stack = 
-       % override previous stack.
+
+def make_picture_stack =
+       % override previous stack
        del_picture_stack;
        picture save_picture_stack[];
        numeric picture_stack_idx;
        picture_stack_idx := 0;
-       def push_picture(expr p) = 
-               save_picture_stack[picture_stack_idx] := p ;
+
+       def push_picture (expr p) =
+               save_picture_stack[picture_stack_idx] := p;
                picture_stack_idx := picture_stack_idx + 1;
        enddef;
-       def pop_picture =  save_picture_stack[decr picture_stack_idx] enddef;
+
+       def pop_picture = save_picture_stack[decr picture_stack_idx] enddef;
        def top_picture = save_picture_stack[picture_stack_idx] enddef;
 enddef;
 
 
+%
 % save/restore pens
 % why can't I delete individual pens?
+%
+
 def make_pen_stack =
        del_pen_stack;
        pen save_pen_stack[];
        numeric pen_stack_idx;
        pen_stack_idx := 0;
-       def push_pen(expr p) = 
-               save_pen_stack[pen_stack_idx] := p ;
-               pen_stack_idx := pen_stack_idx +1;
+       def push_pen (expr p) =
+               save_pen_stack[pen_stack_idx] := p;
+               pen_stack_idx := pen_stack_idx + 1;
        enddef;
-       def pop_pen =  save_pen_stack[decr pen_stack_idx] enddef;
+       def pop_pen = save_pen_stack[decr pen_stack_idx] enddef;
        def top_pen = save_pen_stack[pen_stack_idx] enddef;
 enddef;
+
+
 def del_pen_stack=
        save save_pen_stack, pen_stack_idx;
 enddef;
 
+
 %
 % drawing
 %
 
 def soft_penstroke text t =
-       forsuffixes e = l,r: path_.e:=t; endfor
+       forsuffixes e = l, r:
+               path_.e := t;
+       endfor;
+
        if cycle path_.l:
-         cyclestroke_
+               cyclestroke_;
        else:
-         fill path_.l .. tension1.5 .. reverse path_.r .. tension1.5 .. cycle
-       fi
+               fill path_.l
+               ..tension1.5.. reverse path_.r
+               ..tension1.5.. cycle;
+       fi;
 enddef;
 
 
 %
-% make a round path segment going from P to Q. 2*A is the angle that the 
+% Make a round path segment going from P to Q.  2*A is the angle that the
 % path should take.
 %
 
-def simple_serif(expr p,q, a)= 
-       p{dir(angle(q-p) -a)} .. q{ - dir(angle(p -q) + a)}
+def simple_serif (expr p, q, a) =
+       p{dir (angle (q - p) - a)}
+       .. q{-dir (angle (p - q) + a)}
 enddef;
-%
+
 
 %
-% draw an axis aligned block making sure that edges are on pixels.
+% Draw an axis aligned block making sure that edges are on pixels.
 %
 
 def draw_rounded_block (expr bottom_left, top_right, roundness) =
 begingroup;
        save round;
+       save x, y;
+
        round = floor min (roundness,
-                          xpart (top_right-bottom_left),
-                          ypart (top_right-bottom_left));
+                          xpart (top_right - bottom_left),
+                          ypart (top_right - bottom_left));
 
        pickup pencircle scaled round;
 
-       save x, y;
        z2 + (round / 2, round / 2) = top_right;
        z4 - (round / 2, round / 2) = bottom_left;
        y3 = y2;
@@ -165,7 +205,7 @@ begingroup;
             --- cycle;
 endgroup;
 enddef;
-  
+
 
 def draw_block (expr bottom_left, top_right) =
        draw_rounded_block (bottom_left, top_right, blot_diameter);
@@ -173,13 +213,18 @@ enddef;
 
 
 def draw_square_block (expr bottom_left, top_right) =
-       save x,y;
+       save x, y;
+
        x1 = xpart bottom_left;
        y1 = ypart bottom_left;
        x2 = xpart top_right;
        y2 = ypart top_right;
 
-       fill (x1,y1) --- (x2,y1) --- (x2,y2) --- (x1,y2) --- cycle; 
+       fill (x1, y1)
+            --- (x2, y1)
+            --- (x2, y2)
+            --- (x1, y2)
+            --- cycle;
 enddef;
 
 
@@ -188,33 +233,44 @@ def draw_gridline (expr bottom_left, top_right, thickness) =
                            top_right + (thickness / 2, thickness / 2),
                            thickness);
 enddef;
-       
-
-def draw_brush(expr a,w,b,v) =
-       save x,y;
-       z1=a; z2=b;
-       penpos3(w,angle(z2-z1)+90);
-       penpos4(w,angle(z2-z1));
-       penpos5(v,angle(z1-z2)+90);
-       penpos6(v,angle(z1-z2));
+
+
+def draw_brush (expr a, w, b, v) =
+       save x, y;
+
+       z1 = a;
+       z2 = b;
        z3 = z4 = z1;
        z5 = z6 = z2;
 
-       fill z3r{z3r-z5l}..z4l..{z5r-z3l}z3l..z5r{z5r-z3l}..z6l..{z3r-z5l}z5l..cycle;
+       penpos3 (w, angle (z2 - z1) + 90);
+       penpos4 (w, angle (z2 - z1));
+       penpos5 (v, angle (z1 - z2) + 90);
+       penpos6 (v, angle (z1 - z2));
+
+       fill z3r{z3r - z5l}
+            .. z4l
+            .. {z5r - z3l}z3l
+            .. z5r{z5r - z3l}
+            .. z6l
+            .. {z3r - z5l}z5l
+            .. cycle;
 enddef;
 
 
-
 %
-% make a superellipsoid segment going from FROM to TO, with SUPERNESS.  
-% Take superness = sqrt(2)/2 to get a circle segment 
+% Make a superellipsoid segment going from FROM to TO, with SUPERNESS.
+% Take superness = sqrt(2)/2 to get a circle segment.
 %
-% see Knuth, p. 267 and p.126
-def super_curvelet(expr from, to, superness, dir) =
+% See Knuth, p. 267 and p.126.
+
+def super_curvelet (expr from, to, superness, dir) =
        if dir = 1:
-        (superness [xpart to, xpart from], superness [ypart from,ypart to]){to - from}
+               (superness [xpart to, xpart from],
+                superness [ypart from, ypart to]){to - from}
        else:
-        (superness [xpart from, xpart to], superness [ypart  to,ypart from]){to - from}
+               (superness [xpart from, xpart to],
+                superness [ypart to, ypart from]){to - from}
        fi
 enddef;
 
@@ -222,110 +278,142 @@ enddef;
 %
 % Bulb with smooth inside curve.
 %
-% alpha = start direction.
-% beta = which side to turn to.
+% alpha = start direction
+% beta = which side to turn to
 % flare = diameter of the bulb
 % line = diameter of line attachment
 % direction = is ink on left or right side (1 or -1)
 %
-def flare_path(expr pos,alpha,beta,line,flare, direction) =
-       begingroup;
+
+def flare_path (expr pos, alpha, beta, line, flare, direction) =
+begingroup;
        clearxy;
-       penpos1(line,180+beta+alpha);
-       z1r=pos;
-       penpos2(flare,180+beta+alpha);
-       z2=z3;
-       penpos3(flare,0+alpha);
-       z3l=z1r+(1/2+0.43)*flare*dir(alpha+beta) ;
-       save taille;
-       taille = 0.0;
-       z4=z2r-  line * dir(alpha);
-       penlabels(1,2,3,4);
-       pickup pencircle;
-       save t; t=0.833;
-       save p; 
+
+       penpos1 (line, 180 + beta + alpha);
+       z1r = pos;
+
+       penpos2 (flare, 180 + beta + alpha);
+       z2 = z3;
+
+       penpos3 (flare, 0 + alpha);
+       z3l = z1r + (1/2 + 0.43) * flare * dir (alpha + beta);
+
+       z4 = z2r - line * dir (alpha);
+
+       penlabels (1, 2, 3, 4);
+
+       save t, p;
+       t = 0.833;
        path p;
-       p:=z1r{dir(alpha)}..z3r{dir(180+alpha-beta)}..z2l{dir(alpha+180)}
-               ..z3l{dir(180+alpha+beta)}..tension t
-               ..z4{dir(180+alpha+beta)}..z1l{dir(alpha+180)};
 
-       if direction = 1:
-               p
-       else:
-               reverse p
-       fi
-       endgroup
-       enddef;
+       p := z1r{dir (alpha)}
+            .. z3r{dir (180 + alpha - beta)}
+            .. z2l{dir (alpha + 180)}
+            .. z3l{dir (180 + alpha + beta)}
+            ..tension t.. z4{dir (180 + alpha + beta)}
+            .. z1l{dir (alpha + 180)};
+
+       if direction <> 1:
+               p := reverse p;
+       fi;
 
+p
+endgroup
+enddef;
 
 
-def brush(expr a,w,b,v) =
-       begingroup;
-       draw_brush(a,w,b,v);    
-       penlabels(3,4,5,6);
-       endgroup;
+def brush (expr a, w, b, v) =
+begingroup;
+       draw_brush (a, w, b, v);
+       penlabels (3, 4, 5, 6);
+endgroup;
 enddef;
 
+
 %
 % Draw a (rest) crook, starting at thickness STEM in point A,
-% ending a ball W to the left, diameter BALLDIAM
-% ypart of the center of the ball is BALLDIAM/4 lower than ypart A
+% ending a ball W to the left, diameter BALLDIAM.
+% ypart of the center of the ball is BALLDIAM/4 lower than ypart A.
 %
-def balled_crook(expr a, w, balldiam, stem) =
+
+def balled_crook (expr a, w, balldiam, stem) =
 begingroup;
-       save x,y;
-       penpos1(balldiam/2,-90);
-       penpos2(balldiam/2,0);
-       penpos3(balldiam/2,90);
-       penpos4(balldiam/2,180);
-       x4r=xpart a-w; y3r=ypart a+balldiam/4;
-       x1l=x2l=x3l=x4l;
-       y1l=y2l=y3l=y4l;
-       penpos5(stem,250);
-       x5=x4r+9/8balldiam; y5r=y1r;
-       penpos6(stem,260);
-       x6l=xpart a; y6l=ypart a;
-       penstroke z1e..z2e..z3e..z4e..z1e..z5e{right}..z6e;
-       penlabels(1,2,3,4,5,6);
+       save x, y;
+
+       penpos1 (balldiam / 2, -90);
+       penpos2 (balldiam / 2, 0);
+       penpos3 (balldiam / 2, 90);
+       penpos4 (balldiam / 2, 180);
+
+       x4r = xpart a - w;
+       y3r = ypart a + balldiam / 4;
+       x1l = x2l = x3l = x4l;
+       y1l = y2l = y3l = y4l;
+
+       penpos5 (stem, 250);
+       x5 = x4r + 9/8 balldiam;
+       y5r = y1r;
+
+       penpos6 (stem, 260);
+       x6l = xpart a;
+       y6l = ypart a;
+
+       penstroke z1e
+                 .. z2e
+                 .. z3e
+                 .. z4e
+                 .. z1e
+                 .. z5e{right}
+                 .. z6e;
+
+       penlabels (1, 2, 3, 4, 5, 6);
 endgroup;
 enddef;
 
 
 def y_mirror_char =
        currentpicture := currentpicture yscaled -1;
-       set_char_box(charbp, charwd, charht, chardp);
+
+       set_char_box (charbp, charwd, charht, chardp);
 enddef;
 
 
 def xy_mirror_char =
        currentpicture := currentpicture scaled -1;
-       set_char_box(charwd, charbp, charht, chardp);
+
+       set_char_box (charwd, charbp, charht, chardp);
 enddef;
 
+
 %
-% center_factor: typically .5, the larger, the larger the radius of the bulb
+% center_factor: typically .5; the larger, the larger the radius of the bulb
 % radius factor: how much the bulb curves inward
 %
-def draw_bulb(expr turndir, zl, zr, bulb_rad, radius_factor)=
-       begingroup;
-       clearxy;
+
+def draw_bulb (expr turndir, zl, zr, bulb_rad, radius_factor)=
+begingroup;
        save rad, ang;
 
-       ang = angle(zr-zl);
+       clearxy;
+
+       ang = angle (zr - zl);
 
        % don't get near infinity
-       %z0 = zr + bulb_rad * (zl-zr)/length(zr -zl);
-       z0 = zr + bulb_rad /length(zr -zl) * (zl-zr);
+       % z0 = zr + bulb_rad * (zl - zr) / length (zr - zl);
+       z0' = zr + bulb_rad / length (zr - zl) * (zl - zr);
+
+       rad = bulb_rad;
 
-       rad =  bulb_rad;
+       z1' = z0' + radius_factor* rad * dir (ang + turndir * 100);
+       z2' = z0' + rad * dir (ang + turndir * 300);
 
-       z1 = z0 + radius_factor* rad * dir(ang + turndir* 100);
-       z2 = z0 + rad * dir(ang  + turndir*300);
-       labels(0,1,2);
-       fill zr{dir (ang + turndir* 90)} .. z1 .. z2 -- cycle;
+       labels (0', 1', 2');
 
-       endgroup
+       fill zr{dir (ang + turndir * 90)}
+            .. z1'
+            .. z2'
+            -- cycle;
+endgroup
 enddef;
 
-pi:=3.14159;
+pi := 3.14159;
index 4b362ef84941e2ed9c4ace7f317d6be34caa438a..3b0cd296cc61f7aab5d0f6ac29e3345d5fe837ac 100644 (file)
@@ -4,7 +4,7 @@
 % part of LilyPond's pretty-but-neat music font
 %
 % source file of the Feta (not the Font-En-Tja) music font
-% 
+%
 % (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 %
 % Voor Cup
 % Pe = -0.034 pedalh == -0.07 staff-space
 % ed = -0.27 pedalh == -0.53 staff-space
 
-fet_begingroup("pedal")
+
+fet_begingroup ("pedal")
 
 pedalpha = 40;
 pedbeta = 25;
 
-penh#=0.7linethickness#;
+penh# = 0.7 linethickness#;
+penw# = 2 penh# + 0.14 staff_space#;
+define_pixels (penh, penw);
 
-penw# = 2penh# + 0.14 staff_space#;
+pedalh# = 2 staff_space#;
+pedalbh# = 4/7 pedalh#;
+define_pixels (pedalh, pedalbh);
 
-define_pixels (penh,penw);
 
-pedalh# = 2staff_space#;
-pedalbh# = 4/7pedalh#;
-define_pixels (pedalh,pedalbh);
+fet_beginchar ("Pedal asterisk", "*")
+       save bulb, p, radius, thin, inner_r;
+       path p;
 
-% code values for own pedal font commented out
-% code := 41;  % * = 42
+       set_char_box (0, 7/9 pedalh#, 0, pedalh#);
 
-fet_beginchar("Pedal asterisk", "*")
-       set_char_box(0, 7/9pedalh#, 0, pedalh#);
-       z0 = (1/2w, h - 1/2w);
-       save bulb, p, radius, thin;
-       path p;
+       z0 = (1/2 w, h - 1/2 w);
 
        thin = 0.8 linethickness;
 
        bulb + 2 radius = w;
-       0.9 thin +  bulb = (radius * pi * 2) / 8;
+       0.9 thin + bulb = (radius * pi * 2) / 8;
 
        pickup pencircle scaled penh;
+
        penpos 1 (bulb, 180);
        penpos 2 (bulb, 0);
        penpos 3 (thin, 0);
 
-       z1 = z0 + (0,radius);
+       z1 = z0 + (0, radius);
        z2 = z1;
 
-       save inner_r ;
-       inner_r = .45 radius ;
+       inner_r = .45 radius;
 
        z4l = z0 + inner_r * dir (90 + 360/16);
        z4r = z0 + inner_r * dir (90 - 360/16);
 
-       z4 = .5 [z4l,z4r];
-       z3 = .75 [z1,z4];
-
+       z4 = .5 [z4l, z4r];
+       z3 = .75 [z1, z4];
 
-       penlabels (1,2,3,4);
+       penlabels (1, 2, 3, 4);
 
-       %% what is empty path? 
-       p = z3r{up} ..  z1l{up}..z2l{down}..z3l{down} .. z4l{dir (180 + 360/16)}; 
+       p := z3r{up}
+            .. z1l{up}
+            .. z2l{down}
+            .. z3l{down}
+            .. z4l{dir (180 + 360/16)};
        for i = 1 upto 7:
-               p := p ... ((z3r{up}.. z1l{up}..z2l{down}..z3l{down}..z4l{dir (180 + 360/16)}) 
-               rotatedaround (z0, 360/8i));
-               endfor
-
-       p := p .. cycle;
+               p := p
+                    .. ((z3r{up}
+                        .. z1l{up}
+                        .. z2l{down}
+                        .. z3l{down}
+                        .. z4l{dir (180 + 360/16)}) rotatedaround (z0,
+                                                                   360/8 i));
+       endfor;
+
+       p := p
+            .. cycle;
        fill p;
+
        pickup pencircle scaled (7/8 inner_r);
-       undraw z0;
-fet_endchar;
 
-% skip + and ,
+       undrawdot z0;
+fet_endchar;
 
-% code := 44;  % - = 45
 
 %% ugh. rounded corners!
 
-fet_beginchar("Pedal dash", "-")
-       set_char_box(0, 3penw#, 0, pedalbh#);
+fet_beginchar ("Pedal dash", "-")
+       set_char_box (0, 3 penw#, 0, pedalbh#);
+
        pickup pencircle scaled penh;
 
-       penpos 1 (penw, 60);
-       penpos 2 (penw, 60);
-       z1l = (0, 2/3h - 1/2penw);
-       z2r = (w, y1l + 1.2penw);
-       penlabels (1,2);
-       penstroke z1e{dir 40}..tension 1.2 ..z2e{dir 40};
+       penpos1 (penw, 60);
+       penpos2 (penw, 60);
+
+       z1l = (0, 2/3 h - 1/2 penw);
+       z2r = (w, y1l + 1.2 penw);
+
+       penlabels (1, 2);
+
+       penstroke z1e{dir 40}
+                 ..tension 1.2.. z2e{dir 40};
 fet_endchar;
 
-fet_beginchar("Pedal dot", ".")
-       set_char_box(0, penw#, 0, penw#);
+
+fet_beginchar ("Pedal dot", ".")
+       set_char_box (0, penw#, 0, penw#);
+
        pickup pencircle scaled penw;
-       draw (1/2penw,1/2penw);
+
+       drawdot (1/2 penw, 1/2 penw);
 fet_endchar;
 
-def draw_pedal_P =
-       begingroup;
+
+def draw_pedal_P (expr show_labels) =
+begingroup;
        clearxy;
-       pickup pencircle scaled penh;
 
-       penpos 1 (penh, 0);
-       penpos 2 (penw, 55);
-       penpos 3 (penw, pedalpha);
-       penpos 4 (1.2penh, -pedalpha);
-       penpos 5 (penh, -pedalpha);
-       penpos 6 (penh, 180-pedalpha);
-       penpos 7 (2penh, 180-pedalpha);
-       penpos 8 (penh, 90);
-       penpos 9 (4/3penw,50);
-       penpos 10 (1.4penw,50);
-       penpos 11 (penh, 90+pedalpha);
-
-       z1r = (0.6w, h);
+       penpos1 (penh, 0);
+       penpos2 (penw, 55);
+       penpos3 (penw, pedalpha);
+       penpos4 (1.2 penh, -pedalpha);
+       penpos5 (penh, -pedalpha);
+       penpos6 (penh, 180 - pedalpha);
+       penpos7 (2 penh, 180 - pedalpha);
+       penpos8 (penh, 90);
+       penpos9 (4/3 penw, 50);
+       penpos10 (1.4 penw, 50);
+       penpos11 (penh, 90 + pedalpha);
+
+       z1r = (0.6 w, h);
        x2l = x1l - penw;
-       y2 = 0.7h;
-       x3r = x2l + 2penw;
-       y3r = 0.4h;
-       z4l = z5r + 1/4(z3r - z5r);
-       x5 = 1/4w;
+       y2 = 0.7 h;
+       x3r = x2l + 2 penw;
+       y3r = 0.4 h;
+       z4l = z5r + 1/4 (z3r - z5r);
+       x5 = 1/4 w;
        y5r = 0;
        z6 = z5;
-       z7 = z6r + 1/3(z8r - z6r);
-       z8r = z5r + 3/5(z3r - z5r);
+       z7 = z6r + 1/3 (z8r - z6r);
+       z8r = z5r + 3/5 (z3r - z5r);
        x9l = x10l - penh;
-       y9l = 1/4penh;
-       x10l = w - tand (90-pedalpha)*y11l;
-       y10l = 1/4penh;
+       y9l = 1/4 penh;
+       x10l = w - tand (90 - pedalpha) * y11l;
+       y10l = 1/4 penh;
        x11l = w;
-       y11 = 1/5h;
-
-       penlabels (1,2,3,4,5,6,7,8,9,10,11);
-       soft_penstroke z1e..tension 2.5 .. z2e.. tension 1.5 .. z3e ..tension 2.5
-               ..z4e..tension 1.5
-               ..z5e..z6e..tension 1.5
-               ..z7e..tension 1.5
-               ..z8e{right}..tension 1.5
-               ..z9e{dir -pedalpha}
-               ..z10e..tension 2.5..z11e;
-
-       penpos 12 (penh, 0);
-       penpos 13 (penw, -90-pedbeta);
-       penpos 14 (penh, 90);
-       penpos 15 (penw, -90+pedbeta);
-       penpos 16 (penh, 180+pedbeta);
-       z12 = (5/9x1, y2);
-       z13l = (1/2x12r, y15r);
+       y11 = 1/5 h;
+
+       z1' = 0.9 [z2, z1];
+       penpos1' (penh, 0);
+
+       if show_labels = 1:
+               penlabels (range 1 thru 11);
+               penlabels (1');
+       fi;
+
+       soft_penstroke z1'e
+                      ..tension 2.5.. z2e
+                      ..tension 1.5.. z3e
+                      ..tension 2.5.. z4e
+                      ..tension 1.5.. z5e
+                      .. z6e
+                      ..tension 1.5.. z7e
+                      ..tension 1.5.. z8e{right}
+                      ..tension 1.5.. z9e{dir - pedalpha}
+                      .. z10e
+                      ..tension 2.5.. z11e;
+
+       penpos12 (penh, 0);
+       penpos13 (penw, -90 - pedbeta);
+       penpos14 (penh, 90);
+       penpos15 (penw, -90 + pedbeta);
+       penpos16 (penh, 180 + pedbeta);
+
+       z12 = (5/9 x1, y2);
+       z13l = (1/2 x12r, y15r);
        z14r = z1r;
-       z15l = (1/2[x16,w], y2l + 0.5penw);
-       x16 = 1/4[x1, w];
+       z15l = (1/2 [x16, w], y2l + 0.5 penw);
+       x16 = 1/4 [x1, w];
        y16r = y2r;
 
-       penlabels (12,13,14,15,16);
-       soft_penstroke z12e{down}..tension 1.1
-               ..z13e{dir (180-pedbeta)}..tension 1.1
-               ..z14e{right}..tension 1.1
-               ..z15e{dir (180+pedbeta)}..tension 1.1
-               ..z16e{dir (90+pedbeta)};
-       endgroup;
-       enddef;
-
+       if show_labels = 1:
+               penlabels (range 12 thru 16);
+       fi;
 
-def draw_pedal_d =
-       begingroup;
-       clearxy;
-       pickup pencircle scaled penh;
+       soft_penstroke z12e{down}
+                      ..tension 1.1.. z13e{dir (180 - pedbeta)}
+                      ..tension 1.1.. z14e{right}
+                      ..tension 1.1.. z15e{dir (180 + pedbeta)}
+                      ..tension 1.1.. z16e{dir (90 + pedbeta)};
+endgroup;
+enddef;
 
-       penpos 1 (penh, -70);
-       penpos 2 (3/4penw, 0);
-       penpos 3 (2penh, 90);
-       penpos 4 (penw, 190);
-       penpos 5 (penh, -10-90);
 
-       z1l = (2/3w, pedalbh);
-       z2l = (1/3w, 1/2pedalbh);
-       z3l = (x1l, 0);
-       z4 = (w - 1/2penw, 1/2pedalbh + penh);
-       x5r = 0;
-       y5l = h;
-
-       penlabels (1,2,3,4,5);
-
-       soft_penstroke z1e{dir (-70-90)}..tension 1.1
-               ..z2e{down}..tension 1.1
-               ..z3e{right}..tension 1.1
-               ..z4e{dir (90+10)}..tension 1.1
-               ..z5e{dir (180-10)};
-       endgroup;
-       enddef;
+def draw_pedal_d (expr show_labels) =
+begingroup;
+       clearxy;
 
-def draw_pedal_e =
-       begingroup;
+       penpos1 (penh, -10 - 90);
+       penpos2 (penw, 190);
+       penpos3 (2 penh, 90);
+       penpos4 (3/4 penw, 0);
+       penpos5 (penh, -70);
+
+       x1r = 0;
+       y1l = h;
+       z2 = (w - 1/2 penw, 1/2 pedalbh + penh);
+       z3l = (x5l, 0);
+       z4l = (1/3 w, 1/2 pedalbh);
+       z5l = (2/3 w, pedalbh);
+
+       if show_labels = 1:
+               penlabels (1, 2, 3, 4, 5);
+       fi;
+
+       soft_penstroke z1e{dir (-10)}
+                      ..tension 1.1.. z2e{dir (-90 + 10)}
+                      ..tension 1.1.. z3e{left}
+                      ..tension 1.1.. z4e{up}
+                      ..tension 1.1.. z5e{dir (-70 + 90)};
+endgroup;
+enddef;
+
+
+def draw_pedal_e (expr show_labels) =
+begingroup;
        clearxy;
-       pickup pencircle scaled penh;
 
-       penpos 1 (penh, pedalpha-90);
-       penpos 2 (penh, pedalpha-90);
-       penpos 3 (3/5penw, pedalpha);
-       penpos 4 (1.2penh, 90+pedalpha);
-       penpos 5 (2/3penw, 180);
-       penpos 6 (penw, 180+pedalpha);
-       penpos 7 (2/3penw, -90-20);
-       penpos 8 (penh, pedalpha-90);
+       penpos1 (penh, pedalpha - 90);
+       penpos2 (penh, pedalpha - 90);
+       penpos3 (3/5 penw, pedalpha);
+       penpos4 (1.2 penh, 90 + pedalpha);
+       penpos5 (2/3 penw, 180);
+       penpos6 (penw, 180 + pedalpha);
+       penpos7 (2/3 penw, -90 - 20);
+       penpos8 (penh, pedalpha - 90);
 
-       z1l = (0, 1/5pedalh);
+       z1l = (0, 1/5 pedalh);
        z2 = z1 + dir pedalpha * penw;
-       z3 = (3/5w, 8/9h);
-
-       z4 = (2/9w,  y3);
-
+       z3 = (3/5 w, 8/9 h);
+       z4 = (2/9 w,  y3);
        x5r = 0;
        y5 = y2;
+       x6 = 3/8 w;
+       y6r = 1/2 penh;
+       z7l = (x6l + penh, y6l);
+       x8r = w;
+       y8 = 1/5 pedalh;
 
-       x6 = 3/8w;
-       y6r = 1/2penh;
+       if show_labels = 1:
+               penlabels (range 1 thru 8);
+       fi;
 
-       z7l = (x6l+penh, y6l);
+       soft_penstroke z1e
+                      --- z2e
+                      ..tension 1.1.. z3e
+                      ..tension 1.05.. z4e
+                      ..tension 1.1.. z5e
+                      ..tension 1.5.. z6e{dir - pedalpha}
+                      ..tension 1.1.. z7e
+                      ..tension 2.5.. z8e;
+endgroup;
+enddef;
 
-       x8r = w;
-       y8 = 1/5pedalh;
-
-       penlabels (1,2,3,4,5,6,7,8);
-       soft_penstroke z1e{dir pedalpha}
-               ..z2e{dir pedalpha}.. tension 1.1
-               %urg
-               ..z3e..tension 1.05
-               ..z4e..tension 1.1
-               ..z5e..tension 1.5
-               ..z6e{dir -pedalpha}..tension 1.1
-               ..z7e.. tension 2.5
-               ..z8e;
-       endgroup;
-       enddef;
-
-
-% code := 79;  % P = 80
-
-fet_beginchar("Pedal P", "P")
-       set_char_box(0, 5/6pedalh#, 0, pedalh#);
-       draw_pedal_P;
+
+fet_beginchar ("Pedal P", "P")
+       set_char_box (0, 5/6 pedalh#, 0, pedalh#);
+
+       draw_pedal_P (1);
 fet_endchar;
 
-% code := 99;  % d = 100
 
-fet_beginchar("Pedal d", "d")
-       set_char_box(0, 2/3pedalh#, 0, 7/8pedalh#);
-       draw_pedal_d;
+fet_beginchar ("Pedal d", "d")
+       set_char_box (0, 2/3 pedalh#, 0, 7/8 pedalh#);
+
+       draw_pedal_d (1);
 fet_endchar;
 
-fet_beginchar("Pedal e", "e")
-       set_char_box(0, 2/5pedalh#, 0, pedalbh#);
-       draw_pedal_e;
+
+fet_beginchar ("Pedal e", "e")
+       set_char_box (0, 2/5 pedalh#, 0, pedalbh#);
+
+       draw_pedal_e (1);
 fet_endchar;
 
-%
-% Han-Wen insists on having a `Ped' symbol, ready-kerned in mf.
-% The pre 1.3.59 user-scm kerning sucks, but I'm not struck by
-% the looks of this either.
-%
-fet_beginchar("Pedal Ped", "Ped")
-       P_width# = 5/6pedalh#;
-       e_width# = 2/5pedalh#;
-       d_width# = 2/3pedalh#;
+
+fet_beginchar ("Pedal Ped", "Ped")
+       P_width# = 5/6 pedalh#;
+       e_width# = 2/5 pedalh#;
+       d_width# = 2/3 pedalh#;
        define_pixels (P_width, e_width, d_width);
 
        e_height# = pedalbh#;
-       d_height# = 7/8pedalh#;
+       d_height# = 7/8 pedalh#;
        define_pixels (e_height, d_height);
 
        % Pe = -0.034 pedalh == -0.07 staff-space
@@ -281,19 +305,21 @@ fet_beginchar("Pedal Ped", "Ped")
 
        w := d_width;
        h := d_height;
-       draw_pedal_d;
+       draw_pedal_d (0);
        currentpicture := currentpicture shifted (e_width + ed_kern, 0);
+
        w := e_width;
        h := e_height;
-       draw_pedal_e;
+       draw_pedal_e (0);
        currentpicture := currentpicture shifted (P_width + Pe_kern, 0);
+
        w := P_width;
        h := pedalh;
-       draw_pedal_P;
-       set_char_box(0, P_width# + Pe_kern# + e_width# + ed_kern# + d_width#,
-               0, pedalh#);
-fet_endchar;
+       draw_pedal_P (0);
 
+       set_char_box (0, P_width# + Pe_kern# + e_width# + ed_kern# + d_width#,
+                     0, pedalh#);
+fet_endchar;
 
-fet_endgroup("pedal")
 
+fet_endgroup ("pedal")
index a971a5b4b48831fef5e953c7da9dca6752d2b9b5..5822941af2179d7f807619e7d8c714f9be7d7a96 100644 (file)
@@ -1,73 +1,85 @@
 % -*- Fundamental -*-  (emacs-20 mf mode mucks
 % feta-schrift.mf --  implement scripts
-% 
+%
 % source file of the Feta (defintively not an abbreviation for Font-En-Tja)
 % music font
-% 
+%
 % (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 %      Jan Nieuwenhuizen <janneke@gnu.org>
-% 
+%
 
 
-fet_begingroup("scripts")
+fet_begingroup ("scripts")
 
 def draw_fermata =
-  save alpha, radius, crook_thinness, crook_fatness, dot_radius;
-  
-       % [Wanske] and some  Baerenreiter editions
-       % suggest ca 80 degrees iso half-circle
-  alpha := 10;
-
-  radius# = 1.25 staff_space#;
-  crook_thinness# = 1.5linethickness#;
-  crook_fatness# = 0.25 staff_space# +  1.5 linethickness#;
-
-  radius# + crook_fatness#/2 = h#;
-  radius# + crook_thinness#/2 = w#;
-  set_char_box(w#, w#, crook_thinness#/2, h#);
-  
-  define_pixels(radius, crook_thinness, crook_fatness);
-  dot_radius = round (4/6 crook_fatness);
-
-
-  penpos1(crook_thinness, 0);
-  penpos2(crook_fatness, -90);
-  z1 = (-radius,0);
-  z2 = (0, radius);
-
-  fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
-  {right}z2r -- z2l{left} .. cycle;
-
-  addto currentpicture also 
-  currentpicture xscaled -1;
-
-  pickup pencircle scaled 2dot_radius;
-  x4 =0;
-  bot y4 = - crook_thinness/2;
-  drawdot z4;
+       save alpha, radius, crook_thinness, crook_fatness, dot_radius;
+       save pat;
+       path pat;
+
+       % [Wanske] and some Baerenreiter editions
+       % suggest about 80 degrees instead of a half-circle
+       alpha := 10;
+
+       radius# = 1.25 staff_space#;
+       crook_thinness# = 1.5 linethickness#;
+       crook_fatness# = 0.25 staff_space# + 1.5 linethickness#;
+
+       radius# + crook_fatness# / 2 = h#;
+       radius# + crook_thinness# / 2 = w#;
+
+       set_char_box (w#, w#, crook_thinness# / 2, h#);
+
+       define_pixels (radius, crook_thinness, crook_fatness);
+       dot_radius = round (4/6 crook_fatness);
+
+       penpos1 (crook_thinness, 0);
+       penpos2 (crook_fatness, -90);
+       z1 = (-radius, 0);
+       z2 = (0, radius);
+
+       pat := z2l{left}
+              .. z1l{dir (-alpha - 90)}
+              .. {dir (90 - alpha)}z1r
+              .. {right}z2r;
+       pat := pat
+              & reverse pat xscaled -1
+              & cycle;
+       fill pat;
+
+       pickup pencircle scaled 2 dot_radius;
+       x4 = 0;
+       bot y4 = -crook_thinness / 2;
+       drawdot z4;
 enddef;
 
-fet_beginchar("fermata up", "ufermata")
-       draw_fermata;   
-       penlabels(1,2,4);
+
+fet_beginchar ("fermata up", "ufermata")
+       draw_fermata;
+       penlabels (1, 2, 4);
 fet_endchar;
 
-fet_beginchar("fermata down", "dfermata")
+
+fet_beginchar ("fermata down", "dfermata")
        draw_fermata;
        y_mirror_char;
 fet_endchar;
 
+
 def draw_short_fermata =
        save fat_factor, thinness, dot_radius;
-       set_char_box(staff_space#, staff_space#, 0, 2.2 staff_space#);
+       save left_dist, right_dist;
+       pair left_dist, right_dist;
+
+       set_char_box (staff_space#, staff_space#, 0, 2.2 staff_space#);
 
        dot_radius# = 0.133 staff_space# + 1.33 linethickness#;
-       define_pixels(dot_radius)
+       define_pixels (dot_radius)
 
        fat_factor = .11;
        thinness = 1.5 linethickness;
 
        pickup pencircle scaled thinness;
+
        rt x2 = w;
        lft x5 = -b;
        bot y5 = 0;
@@ -78,58 +90,117 @@ def draw_short_fermata =
        z1 - z4 = whatever * (charwd, -charht);
        z4 = fat_factor [z3, z5];
 
-       filldraw z1 -- z2 -- z3 -- z4 -- cycle;
-       draw z3 .. z5;
+       left_dist = (unitvector (z3 - z5) rotated 90) * 0.5 thinness;
+       right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 thinness;
+
+       fill bot z5
+            .. (z5 - left_dist)
+            --- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
+                  ((z1 - right_dist) -- (z4 - right_dist)))
+            --- (z1 - right_dist)
+            .. bot z1
+            --- bot z2
+            .. (z2 + right_dist)
+            --- (z3 + right_dist)
+            .. top z3
+            .. (z3 + left_dist)
+            --- (z5 + left_dist)
+            .. cycle;
+
+       pickup pencircle scaled 2 dot_radius;
 
-       pickup pencircle scaled 2dot_radius;
        x1 - 2x6 = x2;
        bot y6 = -d;
+
        drawdot z6;
 enddef;
 
-fet_beginchar("short fermata up", "ushortfermata")
-       draw_short_fermata;     
+fet_beginchar ("short fermata up", "ushortfermata")
+       draw_short_fermata;
+       labels (1, 2, 3, 4, 5, 6);
 fet_endchar;
 
-fet_beginchar("short fermata down", "dshortfermata")
+
+fet_beginchar ("short fermata down", "dshortfermata")
        draw_short_fermata;
        xy_mirror_char;
 fet_endchar;
 
+
 def draw_long_fermata =
        save stemthick, beamheight, dot_radius, wd;
-       define_pixels(wd, dot_radius)
+       save pat;
+       path pat;
+
+       define_pixels (wd, dot_radius);
 
        wd# = 2.5 staff_space#;
        stemthick = 1.5 linethickness;
-       beamheight = 0.3 staff_space+  linethickness;
-       dot_radius# = 0.133 staff_space#+ + 1.333 *linethickness#;
-       set_char_box(wd#/2, wd#/2, 0, 3/2 staff_space#);
+       beamheight = 0.3 staff_space + linethickness;
+       dot_radius# = 0.133 staff_space# + 1.333 * linethickness#;
 
-       draw_rounded_block((-b, h-beamheight), (w, h), blot_diameter);
-       draw_rounded_block((-b, -d),(-b+stemthick, h-stemthick), stemthick);
-       addto currentpicture also currentpicture xscaled -1;
+       set_char_box (wd# / 2, wd# / 2, 0, 3/2 staff_space#);
 
-       pickup pencircle scaled 2dot_radius;
-       x4 = 0;
-       bot y4 = -d;
-       drawdot z4;
+       pickup pencircle scaled blot_diameter;
+
+       top y1 = h;
+       lft x1 = -b;
+       x2 = x3 = 0;
+       y2 = h;
+       y3 = h - beamheight;
+
+       pat := z2
+              --- top z1
+              .. lft z1;
+
+       pickup pencircle scaled stemthick;
+
+       x4 = -b + stemthick;
+       y4 = y3;
+       lft x5 = -b;
+       bot y5 = -d;
+
+       pat := pat
+              --- lft z5
+              .. bot z5
+              .. rt z5
+              --- z4
+              --- z3;
+       pat := pat
+              & reverse pat xscaled -1
+              & cycle;
+
+       fill pat;
+
+       pickup pencircle scaled 2 dot_radius;
+
+       x6 = 0;
+       bot y6 = -d;
+
+       drawdot z6;
 enddef;
 
-fet_beginchar("long fermata up", "ulongfermata")
-       draw_long_fermata;      
+
+fet_beginchar ("long fermata up", "ulongfermata")
+       draw_long_fermata;
+       labels (1, 2, 3, 4, 5, 6);
 fet_endchar;
 
-fet_beginchar("long fermata down", "dlongfermata")
+
+fet_beginchar ("long fermata down", "dlongfermata")
        draw_long_fermata;
        y_mirror_char;
 fet_endchar;
 
+
 def draw_very_long_fermata =
        save ibeamheight, obeamheight;
-       save ihwd, ohwd, iht, oht; % inner/outer half_width/height
+       save ihwd, ohwd, iht, oht;      % inner/outer half_width/height
        save stemthick, dot_radius;
-       define_pixels(ihwd, ohwd, iht, oht)
+       save opat, ipat;
+       path opat, ipat;
+
+       define_pixels (ihwd, ohwd, iht, oht)
 
        ihwd# = 1.0 staff_space#;
        ohwd# = 1.5 staff_space#;
@@ -139,201 +210,289 @@ def draw_very_long_fermata =
        stemthick = 1.5 linethickness;
        ibeamheight = 0.3 staff_space;
        obeamheight = 0.5 staff_space;
-       dot_radius = ((iht - ibeamheight) * 4/10)  ;
-
-       set_char_box(ohwd#, ohwd#, 0, oht#);
-
-       draw_rounded_block((-ohwd, oht-obeamheight), (ohwd, oht), blot_diameter);
-       draw_rounded_block((-ohwd, 0),(-ohwd+stemthick, ohwd-stemthick), stemthick);
-       draw_rounded_block((-ihwd, iht-ibeamheight), (ihwd, iht), blot_diameter);
-       draw_rounded_block((-ihwd, 0),(-ihwd+stemthick, ihwd-stemthick), stemthick);
-       addto currentpicture also currentpicture xscaled -1;
+       dot_radius = (iht - ibeamheight) * 4/10;
+
+       set_char_box (ohwd#, ohwd#, 0, oht#);
+
+       pickup pencircle scaled blot_diameter;
+
+       top y1 = oht;
+       lft x1 = -ohwd;
+       x2 = x3 = 0;
+       y2 = oht;
+       y3 = oht - obeamheight;
+       top y11 = iht;
+       lft x11 = -ihwd;
+       x12 = x13 = 0;
+       y12 = iht;
+       y13 = iht - ibeamheight;
+
+       opat := z2
+               --- top z1
+               .. lft z1;
+       ipat := z12
+               --- top z11
+               .. lft z11;
+
+       pickup pencircle scaled stemthick;
+
+       x4 = -ohwd + stemthick;
+       y4 = y3;
+       lft x5 = -ohwd;
+       bot y5 = 0;
+       x14 = -ihwd + stemthick;
+       y14 = y13;
+       lft x15 = -ihwd;
+       bot y15 = 0;
+
+       opat := opat
+               --- lft z5
+               .. bot z5
+               .. rt z5
+               --- z4
+               --- z3;
+       opat := opat
+               & reverse opat xscaled -1
+               & cycle;
+       ipat := ipat
+               --- lft z15
+               .. bot z15
+               .. rt z15
+               --- z14
+               --- z13;
+       ipat := ipat
+               & reverse ipat xscaled -1
+               & cycle;
+
+       fill opat;
+       fill ipat;
+
+       pickup pencircle scaled 2 dot_radius;
+
+       x6 = 0;
+       bot y6 = -d;
 
-       pickup pencircle scaled 2dot_radius;
-       x4 = 0;
-       bot y4 = -d;
-       drawdot z4;
+       drawdot z6;
 enddef;
 
-fet_beginchar("very long fermata up", "uverylongfermata")
-       draw_very_long_fermata; 
+
+fet_beginchar ("very long fermata up", "uverylongfermata")
+       draw_very_long_fermata;
+       labels (1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 6);
 fet_endchar;
 
-fet_beginchar("very long fermata down", "dverylongfermata")
+
+fet_beginchar ("very long fermata down", "dverylongfermata")
        draw_very_long_fermata;
        y_mirror_char;
 fet_endchar;
 
+
 %
 % Thumbs are used in cello music.
 % TODO : thumbs should look like the finger-font and should be placed in
 % the same way in the score.
 %
 
-fet_beginchar("Thumb", "thumb")
-        save thin, height, width, thick, depth;
-        height# = 5/4 width#;
-        height# = staff_space#;
-       depth# = 1.6 (height# / 2); 
-        set_char_box(width#/2, width#/2, depth#, height#/2);
-       define_pixels (height, width)
+fet_beginchar ("Thumb", "thumb")
+       save thin, height, width, thick, depth;
+       height# = 5/4 width#;
+       height# = staff_space#;
+       depth# = 1.6 (height# / 2);
+
+       set_char_box (width# / 2, width# / 2, depth#, height# / 2);
 
-        thin = .6  linethickness + 0.06 staff_space;
+       define_pixels (height, width);
+
+       thin = .6 linethickness + 0.06 staff_space;
        2 thick + 0.5 (height - 2 thin) = width;
 
-       penpos1(thick, 0);
-        penpos2(thin, 90);
-        z1r = (w, 0);
-        z2r = (0, h);
-        penlabels(1,2);
-        penstroke z1e{up} .. {left}z2e;
-        addto currentpicture also currentpicture xscaled -1;
-        addto currentpicture also currentpicture yscaled -1;
+       penpos1 (thick, 0);
+       penpos2 (thin, 90);
+       penpos3 (thick, 180);
+       penpos4 (thin, 270);
+       z1r = (w, 0);
+       z2r = (0, h);
+       z3r = (-w, 0);
+       z4r = (0, -h);
+
+       penlabels (1, 2, 3, 4);
+
+       penstroke z1e{up}
+                 .. z2e{left}
+                 .. z3e{down}
+                 .. z4e{right}
+                 .. cycle;
 
-       z3 = (0, -h);
        save brush_thick;
-       y4 = - d + brush_thick / 2;
-       brush_thick = 0.9*thick;
-       x4 = 0;
-       penlabels(3,4);
-       draw_brush(z3,1.4*thin, z4, brush_thick);
+       y5 = -d + brush_thick / 2;
+       brush_thick = 0.9 thick;
+       x5 = 0;
+
+       labels (5);
+
+       draw_brush (z4r, 1.4 thin, z5, brush_thick);
 fet_endchar;
 
+
 %
 % FIXME: rounded endings
 %
 % `\accent' is TeX reserved.
-fet_beginchar("> accent", "sforzato")
-       set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
-       save thickness, diminish;
+%
 
-       thickness = 0.05 staff_space + linethickness;
+def draw_accent (expr bottom_left, top_right, thickness, diminish) =
        pickup pencircle scaled thickness;
 
-       % prevent blobs at crossing lines
-       diminish = .75;
-
-       top y1 = h;
-       lft x1 = -b;
-       rt x2 = w;
-       y2 = .25 thickness* diminish;
+       lft x1 = xpart bottom_left;
+       top y1 = ypart top_right;
+       lft x6 = xpart bottom_left;
+       bot y6 = ypart bottom_left;
 
-       rt z4 = (w,0);
-       x3 = - linethickness + 0.1 staff_space;
+       rt z4 = (xpart top_right, (ypart top_right + ypart bottom_left) / 2);
+       x5 = x3 = (xpart top_right + xpart bottom_left) / 2
+                 - linethickness + 0.1 staff_space;
        z3 = whatever [z1, z4];
+       z5 = whatever [z6, z4];
+
+       penpos1 (thickness, angle (z3 - z1) + 90);
+       penpos3 (thickness, angle (z3 - z1) + 90);
+       penpos4 (thickness, 90);
+       penpos5 (thickness, angle (z6 - z5) + 90);
+       penpos6 (thickness, angle (z6 - z5) + 90);
+
+       x4 - x7 = diminish * thickness;
+       y7 = y4;
+
+       fill z1l
+            --- z3l
+            --- z7
+            --- z5l
+            --- z6l
+            .. lft z6{down}
+            .. bot z6
+            .. z6r
+            --- z4l
+            ..tension 0.8.. rt z4
+            ..tension 0.8.. z4r
+            --- z1r
+            .. top z1
+            .. lft z1{down}
+            .. cycle;
+enddef;
 
-       penpos2(thickness*(2 - diminish)/2 , 90);
-       penpos1(thickness, 90);
-       penpos3(thickness, 90);
 
-       draw z1 .. z3;
-       draw (z1 .. z3) yscaled -1;
-       draw z4;
-       penstroke z3e .. z2e;
-       penstroke (z3e .. z2e) yscaled -1;
+fet_beginchar ("> accent", "sforzato")
+       set_char_box (.9 staff_space#, .9 staff_space#,
+                     .5 staff_space#, .5 staff_space#);
 
-       penlabels(1,2,3);
-       labels(4);
+       draw_accent ((-w, -d), (w, h),
+                    0.05 staff_space + linethickness, 0.6);
+       penlabels (1, 3, 4, 5, 6);
+       labels (7);
 fet_endchar;
 
-fet_beginchar("espr", "espr")
-       set_char_box(1.9 staff_space#, 1.9 staff_space#, .5 staff_space#, .5 staff_space#);
-       save thickness, diminish;
-       thickness = 0.05 staff_space + linethickness;
-       pickup pencircle scaled thickness;
-       t = thickness;
-       diminish = .75;
-       top z1 =(0.2 staff_space,h);
-       rt z3 =(w,0);
-       x4 = x3;
-       y4 = y3 + .25 t * diminish;
-       x2 = .5[x1,x3];
-       z2 = whatever[z1,z3];
-       penpos1(t,90);
-       penpos2(t,90);
-       penpos4((2-diminish)*t*.5,90);
-       draw z1 .. z2;
-       penstroke z2e .. z4e;
-       penlabels(1,2,4);
-       labels(3);
-       draw z3;
-       addto currentpicture also currentpicture xscaled -1;
-       addto currentpicture also currentpicture yscaled -1;
 
+fet_beginchar ("espr", "espr")
+       set_char_box (1.9 staff_space#, 1.9 staff_space#,
+                     .5 staff_space#, .5 staff_space#);
+
+       draw_accent ((w - 1.78 staff_space, -d), (w, h),
+                    0.05 staff_space + linethickness, 0.6);
+       addto currentpicture also currentpicture xscaled -1;
 fet_endchar;
 
-fet_beginchar("staccato dot", "staccato")
+
+fet_beginchar ("staccato dot", "staccato")
        save radius;
-       radius# =   0.20 * staff_space#;
-       define_whole_pixels(radius);
+       radius# = 0.20 * staff_space#;
+       define_whole_pixels (radius);
+
        pickup pencircle scaled 2 radius;
-       drawdot (0,0);
-       set_char_box(radius#, radius#, radius#, radius#);
+       drawdot (0, 0);
+
+       set_char_box (radius#, radius#, radius#, radius#);
 fet_endchar;
 
+
 def draw_staccatissimo =
        save radius, height;
        height# = .8 staff_space#;
        radius# = linethickness# + .1 staff_space#;
-       define_whole_pixels(radius);
-       define_pixels(height);
+       define_whole_pixels (radius);
+       define_pixels (height);
 
-       draw_brush((0,0), linethickness, (0, height),2 radius);
-       set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
+       draw_brush ((0, 0), linethickness, (0, height), 2 radius);
+
+       set_char_box (radius#, radius#,
+                     blot_diameter# / 2, height# + radius#);
 enddef;
 
-fet_beginchar("staccatissimo/martellato up", "ustaccatissimo") 
+
+fet_beginchar ("staccatissimo/martellato up", "ustaccatissimo")
        draw_staccatissimo;
 fet_endchar;
 
-fet_beginchar("staccatissimo/martellato down", "dstaccatissimo")
+
+fet_beginchar ("staccatissimo/martellato down", "dstaccatissimo")
        draw_staccatissimo;
        y_mirror_char;
 fet_endchar;
 
-fet_beginchar("portato/single tenuto", "tenuto")
+
+fet_beginchar ("portato/single tenuto", "tenuto")
        save thick;
        thick# = 1.6 linethickness#;
-       define_whole_pixels(thick);
+       define_whole_pixels (thick);
+
+       set_char_box (.6 staff_space#, .6 staff_space#,
+                     thick# / 2,thick# / 2);
 
-       set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
        pickup pencircle scaled thick;
-       draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
+       draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
 fet_endchar;
 
-def draw_portato = 
+
+def draw_portato =
        save thick, radius;
        thick# = 1.4 linethickness#;
        radius# = 1.2 linethickness# + 0.04 staff_space#;
-       define_whole_pixels(thick,radius);
-       
-       set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,.5 staff_space#+ radius#);
-       draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
+       define_whole_pixels (thick, radius);
+
+       set_char_box (.6 staff_space#, .6 staff_space#,
+                     thick# / 2, .5 staff_space# + radius#);
+
+       draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
 
        pickup pencircle scaled 2 radius;
-       drawdot (0,h);
+       drawdot (0, h);
 enddef;
 
 
-fet_beginchar("portato/tenuto with staccato", "uportato")
+fet_beginchar ("portato/tenuto with staccato", "uportato")
        draw_portato;
 fet_endchar;
 
 
-fet_beginchar("portato/tenuto with staccato", "dportato")
+fet_beginchar ("portato/tenuto with staccato", "dportato")
        draw_portato;
        y_mirror_char
 fet_endchar;
 
 
-def draw_marcato = 
+def draw_marcato =
        save fat_factor, thinness;
-       set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
+       save left_dist, right_dist;
+       pair left_dist, right_dist;
+
+       set_char_box (staff_space# / 2, staff_space# / 2,
+                     0, 1.1 staff_space#);
 
        fat_factor = .3;
-       thinness =  linethickness;
+       thinness = linethickness;
 
        pickup pencircle scaled thinness;
+
        rt x2 = w;
        lft x5 = -b;
        bot y5 = 0;
@@ -344,125 +503,156 @@ def draw_marcato =
        z1 - z4 = whatever * (charwd, -charht);
        z4 = fat_factor [z3, z5];
 
-       filldraw z1 -- z2 -- z3 -- z4 -- cycle;
-       draw z3 .. z5;
+       left_dist = (unitvector (z3 - z5) rotated 90) * 0.5 thinness;
+       right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 thinness;
+
+       fill bot z5
+            .. (z5 - left_dist)
+            --- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
+                  ((z1 - right_dist) -- (z4 - right_dist)))
+            --- (z1 - right_dist)
+            .. bot z1
+            --- bot z2
+            .. (z2 + right_dist)
+            --- (z3 + right_dist)
+            .. top z3
+            .. (z3 + left_dist)
+            --- (z5 + left_dist)
+            .. cycle;
 enddef;
 
-fet_beginchar("marcato up", "umarcato")
+
+fet_beginchar ("marcato up", "umarcato")
        draw_marcato;
-       labels(1,2,3,4,5);
+       labels (1, 2, 3, 4, 5);
 fet_endchar;
 
 
 %
-% The down marcato char (not very much used). 
+% The down marcato char (not very much used).
 % Contrary to what some MF/TeX `gurus' believe
 % it is *point*-symmetric with the "up" version
 %
-fet_beginchar("marcato down", "dmarcato")
+
+fet_beginchar ("marcato down", "dmarcato")
        draw_marcato;
        xy_mirror_char;
 fet_endchar;
+
 
 %
 % used in french horn music todo
 %
 % TODO: too light at 20pt
-fet_beginchar("open (unstopped)", "open")
+%
+
+fet_beginchar ("open (unstopped)", "open")
        save thin, height, width, thick;
+
        height# = 5/4 width#;
        height# = staff_space#;
-        thin = .6  linethickness + 0.06 staff_space;
-       set_char_box(width#/2, width#/2, height#/2, height#/2);
-       define_pixels (width,height);
+       thin = .6 linethickness + 0.06 staff_space;
+
+       set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
+
+       define_pixels (width, height);
+
        2 thick + 0.6 (height - 2 thin) = width;
-       
-       penpos1(thick, 0);
-       penpos2(thin, 90);
+
+       penpos1 (thick, 0);
+       penpos2 (thin, 90);
+       penpos3 (thick, 180);
+       penpos4 (thin, 270);
        z1r = (w, 0);
        z2r = (0, h);
-       penlabels(1,2);
-       penstroke z1e{up} .. {left}z2e;
-       addto currentpicture also currentpicture xscaled -1;
-       addto currentpicture also currentpicture yscaled -1;
+       z3r = (-w, 0);
+       z4r = (0, -h);
+
+       penlabels (1, 2, 3, 4);
+
+       penstroke z1e{up}
+                 .. z2e{left}
+                 .. z3e{down}
+                 .. z4e{right}
+                 .. cycle;
 fet_endchar;
 
 
-fet_beginchar("plus (stopped)", "stopped")
+fet_beginchar ("plus (stopped)", "stopped")
        save thick, size;
+
        thick = 2 linethickness;
        size# = 1.1 staff_space#;
 
-       set_char_box(size#/2, size#/2, size#/2, size#/2);
-       draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
+       set_char_box (size# / 2, size# / 2, size# / 2, size# / 2);
+
+       draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
        addto currentpicture also currentpicture rotated 90;
 fet_endchar;
 
 
-%
-% A vee with tapered insides to prevent visual blotting
-%
-
-def draw_vee (expr width, height, thickness) =
-begingroup
-       save diminish;
-
-       diminish = 0.75;
-
-       pickup pencircle scaled thickness;
-       
-       x1 = 0;
-       bot y1 = 0;
-       rt x2 =  w;
-       top y2 = h;
-
-       z3 = whatever [z2, z1];
-       y3 = 0.6 [y2, y1] + thickness;
+fet_beginchar ("Upbow", "upbow")
+       save ht, wd, thick;
 
-       penpos3(thickness, 0);
-       penpos4(thickness * diminish, 0);
-       x4r = thickness/2;
-       y4 = thickness/2;
-       labels(1,2);
-       penlabels(3,4);
-
-       draw z1;
-       draw z3 -- z2;
-       penstroke z3e .. z4e;
-       addto currentpicture also currentpicture xscaled -1;
-endgroup;
-enddef;
-
-fet_beginchar("Upbow", "upbow")
-       save ht, wd, thick, diminish;
-       
        thick = 1.4 linethickness;
        wd# = 1.3 staff_space#;
-       ht# = 1.6 wd#; 
-       set_char_box(wd#/2, wd#/2, 0, ht#);
-       draw_vee (wd, ht, thick);
+       ht# = 1.6 wd#;
+
+       set_char_box (wd# / 2, wd# / 2, 0, ht#);
+
+       draw_accent ((-h, -w), (0, w), thick, 0.9);
+       currentpicture := currentpicture rotated -90;
 fet_endchar;
 
 
-fet_beginchar("Downbow", "downbow")
-       save stemthick, beamheight;
-       save wd,round;
-       define_pixels(wd)
+fet_beginchar ("Downbow", "downbow")
+       save stemthick, beamheight, wd;
+       save pat;
+       path pat;
+
+       define_pixels (wd);
 
        wd# = 1.5 staff_space#;
        stemthick = 1.2 linethickness;
-       set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
+
+       set_char_box (wd# / 2, wd# / 2, 0, 4/3 staff_space#);
 
        beamheight = 4/10 h;
 
-       draw_rounded_block((-b,h-beamheight),(w,h),blot_diameter);
-       draw_rounded_block((-b,-d),(-b+stemthick,h-stemthick),stemthick);
-       addto currentpicture also currentpicture xscaled -1;
+       pickup pencircle scaled blot_diameter;
+
+       top y1 = h;
+       lft x1 = -b;
+       x2 = x3 = 0;
+       y2 = h;
+       y3 = h - beamheight;
+
+       pat := z2
+              --- top z1
+              .. lft z1;
+
+       pickup pencircle scaled stemthick;
+
+       x4 = -b + stemthick;
+       y4 = y3;
+       lft x5 = -b;
+       bot y5 = -d;
+
+       pat := pat
+              --- lft z5
+              .. bot z5
+              .. rt z5
+              --- z4
+              --- z3;
+       pat := pat
+              & reverse pat xscaled -1
+              & cycle;
+
+       fill pat;
 fet_endchar;
 
 %
-% Inspired by a computer-set version of Auf dem Strom by Baerenreiter. 
+% Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
 %
 
 def draw_turn =
@@ -475,7 +665,7 @@ def draw_turn =
        ht# = 18/17 staff_space#;
        darkness = 0.3 linethickness + 0.09 staff_space;
 
-       set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
+       set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
 
        thick_nibangle = 60;
        thick = 3 darkness;
@@ -483,77 +673,81 @@ def draw_turn =
        ball_nib_thick = 2.7 darkness;
        ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
 
-       
        x3l = w;
        y3 = 0;
        y4l = h;
        x4 = x2;
-       x2l = w/2;
+       x2l = w / 2;
        y2l = -d;
        z1 = (0,0);
 
-       penpos1(1.1 thick, thick_nibangle);
-       penpos2(thick, thick_nibangle);
-       penpos3(thin, 180);
-       penpos4(ball_nib_thick, -90);
+       penpos1 (1.1 thick, thick_nibangle);
+       penpos2 (thick, thick_nibangle);
+       penpos3 (thin, 180);
+       penpos4 (ball_nib_thick, -90);
 
        path swoosh, ploop;
-       swoosh :=  z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l 
-         -- z4r .. z3r{down} .. z2r{left} ;
-       fill swoosh .. (swoosh scaled -1) .. cycle;
+       swoosh := z1l{curl 0}
+                 .. z2l
+                 .. z3l{up}
+                 .. {left}z4l
+                 -- z4r
+                 .. z3r{down}
+                 .. z2r{left};
+       fill swoosh
+            .. (swoosh scaled -1)
+            .. cycle;
 
        x5r = x4;
-       y5r = y4l - ball_diam /2;
+       y5r = y4l - ball_diam / 2;
        z6r = z5r;
 
-       penpos5(1.6 ball_diam/2, 10);
-       penpos6(ball_diam/2, 150);
+       penpos5 (1.6 ball_diam / 2, 10);
+       penpos6 (ball_diam / 2, 150);
 
-       ploop := z4l{left} .. z5l .. z6l -- cycle;
+       ploop := z4l{left}
+                .. z5l
+                .. z6l
+                -- cycle;
        fill ploop;
        fill ploop scaled -1;
-
-
 enddef;
 
-fet_beginchar("Reverse turn","reverseturn")
+
+fet_beginchar ("Reverse turn","reverseturn")
        draw_turn;
        currentpicture := currentpicture yscaled -1;
 fet_endchar;
 
 
-fet_beginchar("Turn","turn")
+fet_beginchar ("Turn","turn")
        draw_turn;
-       penlabels(1,2,3,4,5,6,7);
+       penlabels (1, 2, 3, 4, 5, 6, 7);
 fet_endchar;
 
 
-
 %
-% Inspired by a (by now) PD edition of Durand & C'ie edition of 
-% Saint-Saens' Celloconcerto no. 1 
+% Inspired by a (by now) PD edition of Durand & C'ie edition of
+% Saint-Saens' Celloconcerto no. 1
 %
 % FIXME take out hardcoded vars.
 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
 % FIXME generic macros for serifs: top of the t and bottom of r
 %
-% 
 
-fet_beginchar("Trill (`tr')","trill")
-       
-       save start_nib_angle,  ascender_extra, ex, hair_thick, fatness,
-         slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot, 
-         uitschieter, bulb_size;
-       ;
-       pair slant_vec;
+fet_beginchar ("Trill (`tr')", "trill")
+       save start_nib_angle, ascender_extra, ex, hair_thick, fatness;
+       save slant, t_fatness, r_fatness, kerning, t_overshoot;
+       save uitschieter, bulb_size, krul_ang;
+       save u, v;
 
        ascender_extra# = 1/2 ex#;
        ascender# = ascender_extra# + ex#;
        ex# = 1.4 staff_space#;
-       kerning# = .60 ex#;
+       kerning# = 0.6 ex#;
        start_nib_angle = 20;
-       bulb_size = 0.80;
-       define_pixels(ex, ascender_extra, ascender, kerning);
+       bulb_size = 0.8;
+       define_pixels (ex, ascender_extra, ascender, kerning);
 
        t_overshoot = 0.03 ex;
        fatness = 12/40 ex;
@@ -561,15 +755,16 @@ fet_beginchar("Trill (`tr')","trill")
        t_width =  1.9 t_fatness;
        r_fatness = 0.78 fatness;
        uitschieter = 0.48 ex;
-       hair_thick =  linethickness;
+       hair_thick = linethickness;
        r_flare = .5 hair_thick + 0.25 r_fatness;
        r_width =  2 r_fatness + 0.25 kerning;
        slant = .2;
 
-%      slant = .0;
+       local_copy (transform)(currenttransform);
+       currenttransform := currenttransform slanted slant
+                                            shifted (-staff_space, 0);
 
-       local_copy(transform)(currenttransform);
-       currenttransform := currenttransform slanted slant shifted (- staff_space, 0)  ;
+       set_char_box (.85 staff_space#, .85 staff_space#, 0, ascender#);
 
        y1 = ascender;
 
@@ -578,186 +773,250 @@ fet_beginchar("Trill (`tr')","trill")
 
        x1l = 0.2 staff_space;
        x1r - x1l = t_fatness;
-       penpos1(start_nib_wid, start_nib_angle);
-       
+       penpos1 (start_nib_wid, start_nib_angle);
+
        z2 = (x1, 7/18 ex);
-       penpos2(start_nib_wid, start_nib_angle);
+       penpos2 (start_nib_wid, start_nib_angle);
 
        z3l = (x2l + 0.5 t_width, - t_overshoot);
 
        z4l = (x2l + t_width, 0.23 ex);
-       penpos4(whatever, 200);
+       penpos4 (whatever, 180);        % 200
        x4l - x4r = hair_thick;
 
        x3r = 0.5 [x4r, x2r];
 %      1.7 [x3l, x3r] = x4r;
        y3r - y3l = 0.6 t_fatness;
 
-       
-       save t_p, krul_p;
-       path t_p, krul_p, r_p;
-
-       z5 = (x2l + t_fatness/2, 2/3 ex);
-%      penpos5(hair_thick, ); 
-
-       t_p := z1r{dir (angle(z1l-z1r) + 30)} .. z1l{-dir (angle(z1r-z1l) - 45)}
-               -- z2l {down}
-               .. tension (1 + .5 slant)
-               .. z3l{right} 
-               
-               .. z4l{up} -- z4r{down} 
-               .. z3r{left}
-               .. tension (1.5 + .7 slant)
-               .. z2r{up} .. z1r -- cycle;
-       fill t_p ;
+       save krul_p;
+       path krul_p;
 
        krul_ang = 32;
 
        pickup pencircle scaled hair_thick;
-       
-       lft x6 = x2l - uitschieter;
-       y6 =  y5 ; % - 1/20 ex;
 
-       z7 = z5 + whatever*dir krul_ang;
-       up_angle = krul_ang;
-       % angle (z7-z5)
+       z5 = (x2l + t_fatness / 2, 2/3 ex);
+       lft x6 = x2l - uitschieter;
+       y6 = y5;                                % - 1/20 ex;
+       z7 = z5 + whatever * dir krul_ang;
+       up_angle = krul_ang;                    % = angle (z7-z5)
        x7 = 5/10 kerning + x5;
-       
-       penpos7(hair_thick, up_angle + 90);
 
-       
+       krul_p := z4{up}
+                 ..tension 0.98.. z5
+                 .. z6
+                 .. z5
+                 --- z7;
+
+       z4' = point 0.85 of krul_p;
+       penpos4' (hair_thick, angle (direction 0.85 of krul_p) + 90);
+
+       % the body of the `t' and the bottom loop
+       fill z1r{dir (angle (z1l - z1r) + 30)}
+            .. z1l{-dir (angle (z1r - z1l) - 45)}
+            -- z2l{down}
+            ..tension (1 + .5 slant).. z3l{right}
+            .. z4l{up}
+            .. z4'l{direction 0.85 of krul_p}
+            -- z4'r{-direction 0.85 of krul_p}
+            .. z4r{down}
+            .. z3r{left}
+            ..tension (1.5 + .7 slant).. z2r{up}
+            .. z1r
+            -- cycle;
+
+       z5' = point 1.1 of krul_p;
+       penpos5' (hair_thick, angle (direction 1.1 of krul_p) + 90);
+       z5'' = point 1.5 of krul_p;
+       penpos5'' (hair_thick, angle (direction 1.5 of krul_p) + 90);
+       z5''' = point 1.8 of krul_p;
+       penpos5''' (hair_thick, angle (direction 1.8 of krul_p) + 90);
+       z6 = point 2 of krul_p;
+       penpos6 (hair_thick, angle (direction 2 of krul_p) + 90);
+       z6' = point 2.3 of krul_p;
+       penpos6' (hair_thick, angle (direction 2.3 of krul_p) + 90);
+       z6'' = point 2.6 of krul_p;
+       penpos6'' (hair_thick, angle (direction 2.6 of krul_p) + 90);
+       z6''' = point 2.9 of krul_p;
+       penpos6''' (hair_thick, angle (direction 2.9 of krul_p) + 90);
+       penpos7 (hair_thick, up_angle + 90);
+       z7' = point 3.3 of krul_p;
+       penpos7' (hair_thick, angle (direction 3.3 of krul_p) + 90);
+
+       % the left loop
+       penstroke z5'e{direction 1.1 of krul_p}
+                 .. z5''e{direction 1.5 of krul_p}
+                 .. z5'''e{direction 1.8 of krul_p}
+                 .. z6e{direction 2 of krul_p}
+                 .. z6'e{direction 2.3 of krul_p}
+                 .. z6''e{direction 2.6 of krul_p}
+                 .. {direction 2.9 of krul_p}z6'''e;
+
        y9 = 3/4 ex;
        x9 = x1 + kerning;
-       penpos9(r_fatness, 0);
+       penpos9 (r_fatness, 0);
 
        x10 = x9;
-       y10 =  -0.3 linethickness;
-       penpos10(r_fatness, 0);
-
-       krul_p := z4{up}
-               .. tension 0.98
-               .. z5
-               .. z6
-               .. z5 --- z7;
-       draw krul_p;
-       r_p := z7l{z7-z5} .. z9l{down} --- simple_serif (z10l, z10r, -30)
-               --- z9r{up} 
-                ..  z7r{z5-z7} -- cycle;
-       fill r_p;
-
-       set_char_box(.85 staff_space# , .85 staff_space#, 0,ascender#);
+       y10 = -0.3 linethickness;
+       penpos10 (r_fatness, 0);
 
-
-       penpos11(hair_thick, -4);
+       penpos11 (hair_thick, -4);
        z11r = z9r;
-       
-       z13l = (x9l + r_width, y11 -  linethickness );
-       penpos13(r_flare, 180);
-
-       z15 = z13r  - ( bulb_size * r_fatness,0);
-       z14 = 0.5 [z13l, z15] - (0,bulb_size* r_fatness);
-       z16 = 0.5 [z13l, z15] + (0,bulb_size* r_fatness);
-
-
-       fill z11r{up} .. tension 0.94 .. z13r{down} -- z15{down}
-               .. tension 1.0 .. z13l{up}
-               .. z11l{down} -- cycle;
-
-       fill z15{up} .. tension 1.06 .. z13l{down} .. z14 .. cycle;
-
-
-
-       penlabels(range 1 thru 15);
 
+       z13l = (x9l + r_width, y11 -  linethickness);
+       penpos13 (r_flare, 180);
+
+       z15 = z13r - (bulb_size * r_fatness, 0);
+       z14 = 0.5 [z13l, z15] - (0, bulb_size * r_fatness);
+
+       save before, after;
+       path before, after;
+       before := z13l{up}
+                 .. {down}z11l;
+       after := z9r{up}
+                .. z7r
+                --- z7'r;
+       (u, v) = before intersectiontimes after;
+
+       % the connection between `t' and `r', the body of the `r',
+       % and part of the bulb
+       fill z7'l
+            --- z7l
+            .. z9l{down}
+            --- simple_serif (z10l, z10r, -30)
+            --- z9r{up}
+            ..tension 0.94.. z13r{down}
+            -- z15{down}
+            .. z13l{up}
+            .. subpath (0, u) of before
+            .. subpath (v, infinity) of after
+            -- cycle;
+
+       % the rest of the bulb
+       fill z15{up}
+            ..tension 1.06.. z13l{down}
+            .. z14
+            .. cycle;
+
+       penlabels (range 1 thru 15);
+       penlabels (4', 5', 5'', 5''', 6', 6'', 6''', 7');
 fet_endchar;
 
 
 def draw_heel =
-       save radius, thickness, wall;
+       save radius, thickness;
+       save pat;
+       path pat;
 
        radius# := .5 staff_space#;
+       define_pixels (radius);
 
-       define_pixels(radius);
-       set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
+       set_char_box (radius#, radius#, radius#, 2/3 staff_space#);
+
+       thickness := 1.5 linethickness;
 
-       thickness := 1.5 linethickness; 
        pickup pencircle scaled thickness;
+
        rt x1 = b;
        top y1 = h;
-       
+
        x2 =x1;
        y2 = 0;
 
        x3 = 0;
        bot y3 = -d;
 
-       draw z1{down} .. z2{down} .. z3{left};
-       addto currentpicture also currentpicture xscaled -1;
-       
+       pat := top z3{right}
+              .. lft z2{up}
+              .. lft z1{up}
+              .. top z1
+              .. rt z1{down}
+              .. rt z2{down}
+              .. bot z3{left};
+       pat := pat
+              & reverse pat xscaled -1
+              & cycle;
+       fill pat;
 enddef;
 
 
-fet_beginchar("left heel", "upedalheel")
+fet_beginchar ("left heel", "upedalheel")
        draw_heel;
-       labels(1,2,3);
+       labels (1, 2, 3);
 fet_endchar;
 
-fet_beginchar("right heel", "dpedalheel")
+
+fet_beginchar ("right heel", "dpedalheel")
        draw_heel;
        y_mirror_char;
 fet_endchar;
 
+
 def draw_toe =
-       save ht,wd;
+       save ht, wd, thickness;
 
        thickness := 1.5 linethickness;
        ht# := 1.5 staff_space#;
        wd# := 1/3 ht#;
-       define_pixels(ht,wd);
+       define_pixels (ht, wd);
 
-
-       set_char_box(wd#, wd#, 0, ht#);
-       draw_vee (wd, ht, thickness);
+       set_char_box (wd#, wd#, 0, ht#);
+       draw_accent ((-h, -w), (0, w), thickness, 0.9);
+       currentpicture := currentpicture rotated -90;
 enddef;
-       
-fet_beginchar("left toe", "upedaltoe")
+
+
+fet_beginchar ("left toe", "upedaltoe")
        draw_toe;
-       labels(1,2,3);
 fet_endchar;
-fet_beginchar("right toe", "dpedaltoe")
+
+
+fet_beginchar ("right toe", "dpedaltoe")
        draw_toe;
        y_mirror_char;
 fet_endchar;
 
-fet_beginchar("Flageolet", "flageolet")
-       save height,width,thickness;
-       height#=4/15 staffsize#;
-       width#=height#;
-       thickness#=blot_diameter#;
-       define_pixels(height,width,thickness);
-       set_char_box(width#/2,width#/2,height#/2,height#/2);
-       
+
+fet_beginchar ("Flageolet", "flageolet")
+       save height, width, thickness;
+       height #= 4/15 staffsize#;
+       width #= height#;
+       thickness #= blot_diameter#;
+       define_pixels (height, width, thickness);
+
+       set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
+
        pickup pencircle scaled thickness;
+
+       penpos1 (thickness, 90);
+       penpos2 (thickness, 180);
+       penpos3 (thickness, 270);
+       penpos4 (thickness, 0);
+
        x1= .5 [x2, x4];
        x1 = 0;
-       top y1=height/2;
-       rt x4  - lft x2 =width; 
+       top y1 = height / 2;
+       rt x4 - lft x2 = width;
        y2 = 0;
-       y4=y2;
-       x3=x1;
-       bot y3=-height/2;
+       y4 = y2;
+       x3 = x1;
+       bot y3 = -height / 2;
+
+       penlabels (1, 2, 3, 4);
 
-       penlabels(1,2,3,4);
-       draw z1..z2..z3..z4..cycle;
+       penstroke z1e
+                 .. z2e
+                 .. z3e
+                 .. z4e
+                 .. cycle;
 fet_endchar;
 
-%%
-%
-%TODO:  ARGRGHGH code dup.
+
 %
+% TODO:  ARGRGHGH code dup.
 %
 
-fet_beginchar("Segno", "segno")
+fet_beginchar ("Segno", "segno")
        save thin, thick, ball_diam, darkness, pointheight;
        save wd, ht, thick_nibangle, ball_nib_thick;
        save turndir;
@@ -765,9 +1024,9 @@ fet_beginchar("Segno", "segno")
 
        ht# = 3 staff_space#;
        wd# = 2 staff_space#;
-       darkness = .08 staff_space + 0.4  linethickness;
+       darkness = .08 staff_space + 0.4 linethickness;
 
-       set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
+       set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
 
        thick_nibangle = 30;
        thick = 3 darkness;
@@ -775,233 +1034,297 @@ fet_beginchar("Segno", "segno")
        ball_nib_thick = 2.7 darkness;
        ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
        pointheight = 2 linethickness;
-       
+
        y3l = h;
        2 x3 = x2 + x4;
        x4 = 0;
        y4 = y2;
        y2l = .6 h;
        x2l = -b;
-       z1 = (0,0);
+       z1 = (0, 0);
 
-       penpos1(thick, 2 thick_nibangle);
-       penpos2(thick, thick_nibangle);
-       penpos3(thin, -90);
-       penpos4(ball_nib_thick, 180-thick_nibangle);
+       penpos1 (thick, 2 thick_nibangle);
+       penpos2 (thick, thick_nibangle);
+       penpos3 (thin, -90);
+       penpos4 (ball_nib_thick, 180 - thick_nibangle);
 
+       save swoosh, ploop;
        path swoosh, ploop;
-       swoosh :=  z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l 
-         -- z4r .. z3r{left} .. z2r{down} ;
-       fill swoosh .. (swoosh scaled -1) .. cycle;
-       penlabels(1,2,3,4);
+
+       swoosh := z1l{curl 0}
+                 .. z2l
+                 .. z3l{right}
+                 .. {down}z4l
+                 -- z4r
+                 .. z3r{left}
+                 .. z2r{down};
+       fill swoosh
+            .. (swoosh scaled -1)
+            .. cycle;
 
        y5r = y4;
-       x5r = x4l - ball_diam /2;
+       x5r = x4l - ball_diam / 2;
        z6r = z5r;
 
-       penpos5(1.6 ball_diam/2, 100);
-       penpos6(ball_diam/2, 240);
+       penpos5 (1.6 ball_diam / 2, 100);
+       penpos6 (ball_diam / 2, 240);
 
-       ploop := z4l{down} .. z5l .. z6l -- cycle;
+       ploop := z4l{down}
+                .. z5l
+                .. z6l
+                -- cycle;
        fill ploop;
        fill ploop scaled -1;
-       penlabels(4,5,6);
 
-       penpos7(2 thin,0);
-       z7l=(-b,-d);
-       penpos8(2 thin,0);
-       z8r=(w,h);
-       filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
+       penpos7 (2 thin, 0);
+       z7l = (-b, -d);
+       penpos8 (2 thin, 0);
+       z8r = (w, h);
+
+       penstroke z7e
+                 -- z8e;
+
        pickup pencircle scaled 2 thin;
-       draw (-x2r,pointheight);
-       draw (x2r,-pointheight);
+       drawdot (-x2r, pointheight);
+       drawdot (x2r, -pointheight);
+
+       penlabels (range 1 thru 8);
 fet_endchar;
 
-fet_beginchar("Coda", "coda")
+
+fet_beginchar ("Coda", "coda")
        save stickout, thin, thick, codawidth, codaheight;
 
        stickout# = 0.35 staff_space#;
        codawidth# = 2/3 staff_space#;
-       codaheight# = 1 staff_space#;
+       codaheight# = staff_space#;
+       define_pixels (codawidth, codaheight);
 
-       set_char_box(codawidth#+stickout#, codawidth#+stickout#,
-               codaheight#+stickout#, codaheight#+stickout#);
+       set_char_box (codawidth# + stickout#, codawidth# + stickout#,
+                     codaheight# + stickout#, codaheight# + stickout#);
 
-       define_pixels(codawidth, codaheight);
        thin = 1.2 linethickness;
-       0.1 (codaheight - 2 thin)  = (codawidth - 2 thick);
-
-       penpos1(thick,0);
-       penpos2(thin,-90);
-       penpos3(thick,180);
-       x1l=-codawidth;
-       y2l=codaheight;
-       y1=0;
-       x2=0;
-       z3 = - z1;
-       penlabels(1,2,3);
-
-       path halfcoda;
-       halfcoda := z1l{up} .. z2l{right} .. z3l{down} -- 
-               z3r{up} .. z2r{left} .. z1r{down} .. cycle;
-       fill halfcoda;
-       fill (halfcoda scaled -1);
-
-       draw_gridline((0,-h),(0,h),thin);
-       draw_gridline((-w,0),(w,0),thin);
+       0.1 (codaheight - 2 thin) = (codawidth - 2 thick);
 
+       penpos1 (thick, 0);
+       penpos2 (thin, -90);
+       penpos3 (thick, -180);
+       penpos4 (thin, -270);
+
+       x1l = -codawidth;
+       y2l = codaheight;
+       y1 = 0;
+       x2 = 0;
+       z3 = -z1;
+       z4 = -z2;
+
+       penlabels (1, 2, 3, 4);
+
+       penstroke z1e{up}
+                 .. z2e{right}
+                 .. z3e{down}
+                 .. z4e{left}
+                 .. cycle;
+
+       draw_gridline ((0,-h),(0,h),thin);
+       draw_gridline ((-w,0),(w,0),thin);
 fet_endchar;
 
-fet_beginchar("Varied Coda", "varcoda")
+
+fet_beginchar ("Varied Coda", "varcoda")
        save thin, thick, codawidth, codaheight;
        thin# = 1.2 linethickness#;
        thick# = 1.0 linethickness# + 0.25 staff_space#;
        codawidth# = 2/3 staff_space#;
-       codaheight# = staff_space#;
-       define_pixels(thin, thick, codawidth, codaheight);
+       codaheight# = staff_space#;
+       define_pixels (thin, thick, codawidth, codaheight);
 
-       set_char_box(codawidth#+thick#, codawidth#+thick#,
-               codaheight#+thick#, codaheight#+thick#);
+       set_char_box (codawidth# + thick#, codawidth# + thick#,
+                     codaheight# + thick#, codaheight# + thick#);
 
        x1 = -codawidth;
        y1 = y2 - thin;
-       x2 = 0;
+       x2 = codawidth;
        y2 = codaheight;
-       draw_rounded_block(z1, z2, blot_diameter);
+       draw_rounded_block (z1, z2, blot_diameter);
 
        x3 = x1;
-       y3 = -blot_diameter;
+       y3 = -codaheight;
        x4 = x1 + thick;
        y4 = y2;
-       draw_rounded_block(z3, z4, blot_diameter);
-       labels(1,2,3,4);
+       draw_rounded_block (z3, z4, blot_diameter);
 
-       addto currentpicture also currentpicture xscaled -1;
-       addto currentpicture also currentpicture yscaled -1;
+       labels (1, 2, 3, 4);
+
+       addto currentpicture also currentpicture scaled -1;
 
-       draw_gridline((0,-h),(0,h),thin);
-       draw_gridline((-w,0),(w,0),thin);
+       draw_gridline ((0, -h), (0, h), thin);
+       draw_gridline ((-w, 0), (w, 0), thin);
 fet_endchar;
 
-def draw_comma = 
+
+def draw_comma =
        save alpha, thick, thin, ht;
-       alpha:=35;
+
+       alpha := 35;
        thin# = 1.2 linethickness#;
        thick# = 3 linethickness#;
-       ht# = .6staff_space#;
-       define_pixels(thin, thick,ht);
-       set_char_box(0, .5staff_space#, ht#, ht#);
-
-       penpos1(thick, alpha);
-       penpos2(thick, alpha+90);
-       penpos3(thin, 180-alpha);
-       penpos4(thin, 90-alpha);
-       x3r=0;
-       x1l=x3l;
-       y2r=-y4l=h;
-       z1=z2;
-       z3=z4;
-       penlabels(1,2,3,4);
-       fill z1l{dir (alpha+90)} .. z2r{dir alpha} .. z1r{dir (alpha-90)} .. 
-       z3l{dir (270-alpha)} .. z4l{dir (alpha+180)} .. 
-       z3r{dir (90-alpha)} .. cycle;
+       ht# = .6 staff_space#;
+       define_pixels (thin, thick, ht);
+
+       set_char_box (0, .5 staff_space#, ht#, ht#);
+
+       penpos1 (thick, alpha);
+       penpos2 (thick, alpha + 90);
+       penpos3 (thin, 180 - alpha);
+       penpos4 (thin, 90 - alpha);
+
+       x3r = 0;
+       x1l = x3l;
+       y2r = -y4l = h;
+       z1 = z2;
+       z3 = z4;
+
+       fill z1l{dir (alpha + 90)}
+            .. z2r{dir alpha}
+            .. z1r{dir (alpha - 90)}
+            .. z3l{dir (270 - alpha)}
+            .. z4l{dir (alpha + 180)}
+            .. z3r{dir (90-alpha)}
+            .. cycle;
 enddef;
 
-fet_beginchar("Right Comma","rcomma");
+
+fet_beginchar ("Right Comma", "rcomma");
        draw_comma;
+       penlabels (1, 2, 3, 4);
 fet_endchar;
 
-fet_beginchar("Left Comma","lcomma");
+
+fet_beginchar ("Left Comma", "lcomma");
        draw_comma;
        xy_mirror_char;
 fet_endchar;
 
-def draw_varcomma = 
+
+def draw_varcomma =
        save thick, thin, ht, wd, alpha;
-       alpha:=35;
+
+       alpha := 35;
        thin# = 1.2 linethickness#;
        thick# = 3 linethickness#;
        ht# = .6 staff_space#;
        wd# = .25 staff_space#;
-       define_pixels(thin, thick, ht, alpha);
-       set_char_box(wd#, wd#, ht#, ht#);
+       define_pixels (thin, thick, ht, alpha);
+
+       set_char_box (wd#, wd#, ht#, ht#);
+
        z1 = (-b, -d);
        z2 = (w, h);
-       draw_brush(z1, thin, z2, thick);
+
+       draw_brush (z1, thin, z2, thick);
 enddef;
 
-fet_beginchar("Right Varied Comma","rvarcomma");
+
+fet_beginchar ("Right Varied Comma", "rvarcomma");
        draw_varcomma;
+       labels (1, 2);
 fet_endchar;
 
-fet_beginchar("Left Varied Comma","lvarcomma");
+
+fet_beginchar ("Left Varied Comma", "lvarcomma");
        draw_varcomma;
        xy_mirror_char;
 fet_endchar;
 
-thick#:=1/24designsize;
-define_blacker_pixels(thick);
 
-rthin:= 0.075 *staff_space + 0.5 linethickness;
-rthick:=2thick+rthin;
+thick# := 1/24 designsize;
+define_blacker_pixels (thick);
+
+rthin := 0.075 * staff_space + 0.5 linethickness;
+rthick := 2 thick + rthin;
+
 
 def draw_arpeggio =
        save alpha;
-       alpha:=-40;
-       save ne,nw,se,sw; pair ne,nw,se,sw;
-       save x,y;
-       
-       se=dir alpha; nw=dir (alpha+180);
-       ne=dir (alpha+90); sw=dir (alpha-90);
-       penpos1(rthin,alpha+90);
-       penpos2(5/4rthick,alpha);
-       penpos4(5/4rthick,alpha);
-       penpos5(rthin,alpha+90);
-       penpos3(3/4rthick,alpha);
-
-       z1=(width/2, height) - overshoot*se;
-       z2=2[z4,(width/2,height/2)];
-       z3=1/2[z2,z4];
-       x4=2/8staff_space;
-       y4=rthin;
-
-       z5=2[z1,(width/2,height/2)];
-       z6=z2l+1/2rthin*sw;
-       z7=z4l+1/2rthin*sw+1/2rthin*se;
-       z8=2[z6,(width/2,height/2)];
-       z9=2[z7,(width/2,height/2)];
-       
-       fill z1l{se}..{se}z6..z3l..z7{se}..{se}z5l..z5r{nw}..{nw}z8..z3r..z9{nw}..{nw}z1r.. cycle;
-       penlabels(1,2,3,4,5,6,7,8,9);
-       enddef;
-
-fet_beginchar("Arpeggio","arpeggio");
-       %draw_staff (-2, 2, 0.0);       
+       save ne, nw, se, sw;
+       save x, y;
+       pair ne,nw,se,sw;
+
+       alpha := -40;
+
+       nw = dir (alpha + 180);
+       ne = dir (alpha + 90);
+       se = dir alpha;
+       sw = dir (alpha - 90);
+
+       penpos1 (rthin, alpha + 90);
+       penpos2 (5/4 rthick, alpha);
+       penpos3 (3/4 rthick, alpha);
+       penpos4 (5/4 rthick, alpha);
+       penpos5 (rthin, alpha + 90);
+
+       z1 = (width / 2, height) - overshoot * se;
+       z2 = 2 [z4, (width / 2, height / 2)];
+       z3 = 1/2 [z2, z4];
+       x4 = 2/8 staff_space;
+       y4 = rthin;
+
+       z5 = 2 [z1, (width / 2, height / 2)];
+       z6 = z2l + 1/2 rthin * sw;
+       z7 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
+       z8 = 2 [z6, (width / 2, height / 2)];
+       z9 = 2 [z7, (width / 2, height / 2)];
+
+       fill z1l{se}
+            --- z6
+            .. z3l
+            .. z7{se}
+            --- z5l
+            .. z5r{nw}
+            --- z8
+            .. z3r
+            .. z9{nw}
+            --- z1r
+            .. cycle;
+enddef;
+
+
+fet_beginchar ("Arpeggio", "arpeggio");
+%      draw_staff (-2, 2, 0.0);
+
        save height, overshoot, width;
        height# = staff_space#;
-       width# = 0.8height#;
-        overshoot# = 0.25 staff_space#;
-       define_pixels (height,overshoot,width);
-       set_char_box(0, width#, 0, height#);
+       width# = 0.8 height#;
+       overshoot# = 0.25 staff_space#;
+       define_pixels (height, overshoot, width);
+
+       set_char_box (0, width#, 0, height#);
        draw_arpeggio;
-       fet_endchar;
+       penlabels (range 1 thru 9);
+fet_endchar;
 
+
+%
 % Extendable Trill symbol.
 % Not yet used
 % Rename me to Trill, rename Trill to Tr?
-fet_beginchar("Trill_element","trill_element");
+%
+
+fet_beginchar ("Trill_element", "trill_element");
        save height, overshoot;
        height# = staff_space#;
-       width# = 0.8height#;
-        overshoot# = 0.25 staff_space#;
-       define_pixels (height,overshoot,width);
-       set_char_box(0, height#, 0, width#);
+       width# = 0.8 height#;
+       overshoot# = 0.25 staff_space#;
+       define_pixels (height, overshoot, width);
+
+       set_char_box (0, height#, 0, width#);
        draw_arpeggio;
-       currentpicture := currentpicture shifted -(width/2, height/2);
-       currentpicture := currentpicture rotated 90;
-       currentpicture := currentpicture shifted (height/2, width/2);
-       fet_endchar;
 
+       currentpicture := currentpicture shifted -(width / 2, height / 2);
+       currentpicture := currentpicture rotated 90;
+       currentpicture := currentpicture shifted (height / 2, width / 2);
+fet_endchar;
 
 
 %
@@ -1009,101 +1332,165 @@ fet_beginchar("Trill_element","trill_element");
 %
 
 def draw_arpeggio_arrow =
-        save thinness, height, width, overshoot, se, sw, ne, nw, alpha;
-       pair ne, nw, se, sw;
-        height# = staff_space#;
-        width# = 0.8height#;
-        overshoot# = 0.25 staff_space#;
-        define_pixels (height,overshoot,width);
-       set_char_box(0, width#, 0, height#);
-        alpha := -40;
-       nw = dir (alpha+180);
-        sw = dir (alpha-90); se = dir alpha;
-
-        penpos1(rthin,     alpha+90);
-       penpos2(5/4 rthick, alpha);
-        penpos3(5/4 rthick,     0);
-
-        z1 = (width/2, height) - overshoot*se; % numbering is consistent with the arpeggio symbol
-        z2 = 2[z4,(width/2,height/2)];
-        z3 = (0.5 width, 0.5 height);
-        z4 = (0.25 staff_space, rthin);
-       z6 = z2l + 1/2rthin*sw;
-        z9 = (width/2, height) + overshoot*se;
-        fill z1l {se}..{se} z6 .. z3l .. z3r.. z9{nw} ..{nw} z1r.. cycle;
-
-       bot z10 = ( 0.5w,  0   );
-       lft z11 = (-0.3w,  0.8h);
-       rt z12  = ( 1.3w,  0.8h);
+       save thinness, height, width, overshoot;
+       save nw, ne, se, sw;
+       save alpha;
+       save before_left, before_right, after_left, after_right;
+       save u_left, v_left, u_right, v_right;
+       pair nw, ne, se, sw;
+       path before_left, before_right, after_left, after_right;
+
+       height# = staff_space#;
+       width# = 0.8 height#;
+       overshoot# = 0.25 staff_space#;
+       define_pixels (height, overshoot, width);
+
+       set_char_box (0, width#, 0, height#);
+
+       alpha := -40;
+       nw = dir (alpha + 180);
+       ne = dir (alpha + 90);
+       se = dir alpha;
+       sw = dir (alpha - 90);
+
+       penpos1 (rthin, alpha + 90);
+       penpos2 (5/4 rthick, alpha);
+       penpos3 (5/4 rthick, 0);
+
+       z1 = (width / 2, height) - overshoot * se; % numbering is consistent
+                                                  % with the arpeggio symbol
+       z2 = 2 [z4, (width / 2, height / 2)];
+       z3 = (0.5 width, 0.5 height);
+       z4 = (0.25 staff_space, rthin);
+       z6 = z2l + 1/2 rthin * sw;
+       z9 = (width / 2, height) + overshoot * se;
+
+       bot z10 = (0.5 w, 0);
+       lft z11 = (-0.3 w, 0.8 h);
+       rt z12 = (1.3 w, 0.8 h);
+
        pickup pencircle scaled 0.5 rthin;
-       filldraw z3 -- z12 {dir -130} ..  {dir -110} z10 {dir 110} ..  {dir 130} z11 -- cycle;
+
+       before_left := z1l
+                      --- z6
+                      .. {down}z3l;
+       after_left := (z3 + (0, -0.25 rthin / cosd (angle (nw))))
+                     -- (z11 + 0.25 rthin * ne);
+       (u_left, v_left) = before_left intersectiontimes after_left;
+
+       before_right := (z12 + 0.25 rthin * nw)
+                       -- (z3 + (0, -0.25 rthin / cosd (angle (nw))));
+       after_right := z3r{up}
+                      .. z9
+                      --- z1r;
+       (u_right, v_right) = before_right intersectiontimes after_right;
+
+       fill subpath (0, u_left) of before_left
+            .. subpath (v_left, infinity) of after_left
+            .. top z11
+            .. lft z11
+            .. {dir -50}(z11 + 0.25 rthin * sw)
+            .. (z10 + 0.25 rthin * sw){dir -70}
+            .. bot z10
+            .. {dir 70}(z10 + 0.25 rthin * se)
+            .. (z12 + 0.25 rthin * se){dir 50}
+            .. rt z12
+            .. top z12
+            .. subpath (0, u_right) of before_right
+            .. subpath (v_right, infinity) of after_right
+            .. cycle;
+
+%      fill (z3 + (0, -0.25 rthin / cosd (angle (nw))))
+%           -- (z12 + 0.25 rthin * nw)
+%           .. top z12
+%           .. rt z12
+%           .. (z12 + 0.25 rthin * se){dir -130}
+%           .. {dir -110}(z10 + 0.25 rthin * se)
+%           .. bot z10
+%           .. (z10 + 0.25 rthin * sw){dir 110}
+%           .. {dir 130}(z11 + 0.25 rthin * sw)
+%           .. lft z11
+%           .. top z11
+%           .. (z11 + 0.25 rthin * ne)
+%           -- cycle;
 enddef;
 
-fet_beginchar("Arpeggio arrow down", "arpeggio.arrow.M1");
+
+fet_beginchar ("Arpeggio arrow down", "arpeggio.arrow.M1");
        draw_arpeggio_arrow;
+       penlabels (range 1 thru 12);
 fet_endchar;
 
 
-fet_beginchar("Arpeggio arrow up", "arpeggio.arrow.1");
-        draw_arpeggio_arrow;
-        currentpicture := currentpicture scaled -1 shifted (0.8 staff_space, staff_space);
+fet_beginchar ("Arpeggio arrow up", "arpeggio.arrow.1");
+       draw_arpeggio_arrow;
+       currentpicture := currentpicture scaled -1
+                                        shifted (0.8 staff_space,
+                                                 staff_space);
 fet_endchar;
 
 
-
-
 % Hmm
 input feta-slag;
 
+
 % railroad tracks.
 %
-% I actually have no clue how they should look, so we use a slightly curvy  
-% and tapered shape. 
+% I actually have no clue how they should look, so we use a slightly curvy
+% and tapered shape.
 %
-fet_beginchar("Caesura", "caesura");
-  save slant, space_between, clearance;
-  save alpha, p;
-  save botthick, topthick;
-  save krom ;
 
-  path p;
+fet_beginchar ("Caesura", "caesura");
+       save slant, space_between, clearance;
+       save alpha, p;
+       save botthick, topthick;
+       save krom;
+       path p;
 
-  botthick = 1.5 linethickness;
-  topthick = 2.5 linethickness;
-  pickup pencircle scaled botthick;
+       botthick = 1.5 linethickness;
+       topthick = 2.5 linethickness;
 
+       pickup pencircle scaled botthick;
 
-  slant = 3.5 ;
-  space_between# = 0.6 staff_space#;
-  clearance# = 0.2 staff_space#;
-  height# = 1.2 staff_space#;
+       slant = 3.5;
+       space_between# = 0.6 staff_space#;
+       clearance# = 0.2 staff_space#;
+       height# = 1.2 staff_space#;
 
-  set_char_box(0, 2.0 staff_space#, staff_space# - clearance#, height#);
-  define_pixels (space_between, clearance, height);
+       set_char_box (0, 2.0 staff_space#,
+                     staff_space# - clearance#, height#);
+       define_pixels (space_between, clearance, height);
 
-  bot y1 = -d;
-  top y2 = h;
-  lft x1 = 0;
-  x2 = (y2 - y1) / slant;
+       bot y1 = -d;
+       top y2 = h;
+
+       lft x1 = 0;
+       x2 = (y2 - y1) / slant;
 
-  krom = 10;
+       krom = 10;
 
-  alpha = angle (z2 - z1);
-  penpos1 (botthick, alpha - krom);
-  penpos3 (botthick, alpha - krom + 90);
+       alpha = angle (z2 - z1);
+       penpos1 (botthick, alpha - krom);
+       penpos3 (botthick, alpha - krom + 90);
 
-  penpos2 (topthick, alpha + krom );
-  penpos4 (topthick, alpha + krom + 90);
-  z3 = z1; z4 = z2; 
-  penlabels (1,2,3,4);
+       penpos2 (topthick, alpha + krom);
+       penpos4 (topthick, alpha + krom + 90);
 
-  p  := z3r{(z1r - z1l)} .. z4r{z2r-z2l} .. z2r{z4l-z4r} .. z4l{z2l-z2r} .. z3l{z1l-z1r} .. z1l{z3r-z3l} .. cycle;
-  fill p;
-  fill p shifted (space_between , 0);
+       z3 = z1;
+       z4 = z2;
 
-fet_endchar; 
+       penlabels (1, 2, 3, 4);
 
+       p := z3r{(z1r - z1l)}
+            .. z4r{z2r-z2l}
+            .. z2r{z4l-z4r}
+            .. z4l{z2l-z2r}
+            .. z3l{z1l-z1r}
+            .. z1l{z3r-z3l}
+            .. cycle;
+       fill p;
+       fill p shifted (space_between, 0);
+fet_endchar;
 
-fet_endgroup("scripts");
 
+fet_endgroup ("scripts");
index 367b1dc9ca81ac1c0b24687b45909f9ea2f97d28..bc23437c2125a439d577a089f8ad6f86b382ae00 100644 (file)
-% -*- Fundamental -*-  (emacs-20 mf mode mucks
+% -*- Fundamental -*-  (emacs-20 mf mode sucks)
 % feta-slag.mf --  implement trill symbols
-% 
-% source file of the Feta (defintively not an abbreviation for Font-En-Tja)
+%
+% source file of the Feta (definitely not an abbreviation for Font-En-Tja)
 % music font
-% 
+%
 % (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
-% 
+%
 
 % this file is included by feta-scripts.mf
 
 trill_thin# = 0.1 staff_space# + 0.6 stafflinethickness#;
 trill_thick# = 1/2 staff_space#;
 trill_width# = 5/12 staff_space#;
-trill_height# = 1/2staff_space#;
+trill_height# = 1/2 staff_space#;
 trill_overlap# = 1/6 staff_space#;
 
 pair trill_ne;
-trill_ne := unitvector ((6,9));
+trill_ne := unitvector ((2, 3));
 
-define_pixels (trill_thick, trill_thin, 
-               trill_width, trill_overlap, trill_height);
+define_pixels (trill_thick, trill_thin,
+              trill_width, trill_overlap, trill_height);
 
 
 %
-% the trill element sticks out on both the left and right side
-% out of the normal bbox, so you can glue them together easily.
+% The trill element sticks out on both the left and right side
+% of the normal bbox, so you can glue them together easily.
 %
-def draw_trillelement (expr startx) =
-begingroup
+
+def draw_trillelement (expr offset) =
        clearxy;
-       save x, y, p;
+
+begingroup;
+       save nw, p;
+       pair nw;
+       path p;
 
        pickup pencircle scaled trill_thin;
-       
-       x1 = - trill_width;
+
+       x1 = -trill_width;
        y1 = 0;
        z3 = whatever * trill_ne + z1;
        top y3 = trill_height;
-       z2 =  z3 - (trill_thick - trill_thin) * trill_ne;
+       z2 = z3 - (trill_thick - trill_thin) * trill_ne;
 
        z4 = z1 - trill_ne * trill_overlap;
+       x5 = x2;
+       y5 = 0;
+
+       z3' = z3 scaled -1;
+       z5' = z5 scaled -1;
+
+       nw := unitvector (z2 - z3');
 
        path p;
-       p = z3 -- z2 -- z4 -- z2;
-       p := p -- (p scaled -1) -- cycle;
-       %pickup pencircle scaled 2;
-       filldraw (p shifted (startx + trill_width,0)) ;
-       %draw p;
-       labels(1,2,3,4);
+       p := z5
+            --- (z4 - 0.5 trill_thin * nw)
+            .. bot z4
+            .. lft z4
+            .. (z4 + 0.5 trill_thin * nw)
+            --- (z3 + 0.5 trill_thin * nw)
+            .. top z3
+            .. (z3 + 0.5 trill_thin * trill_ne)
+            --- z5';
+       p := p
+            & p scaled -1
+            & cycle;
+       p := p shifted (offset, 0);
+       fill p;
 endgroup;
 enddef;
 
 
+fet_beginchar ("trilelement", "trilelement")
+       set_char_box (trill_width#, trill_width#,
+                     trill_height#, trill_height#);
 
-
-fet_beginchar("trilelement", "trilelement")
-       set_char_box(trill_width#, trill_width#,
-                               trill_height#, trill_height#);
-       draw_trillelement(-trill_width);
+       draw_trillelement (0);
+       labels (1, 2, 3, 3', 4, 5, 5');
 fet_endchar;
 
-fet_beginchar("prall", "prall")
-       set_char_box(2 trill_width#, 2 trill_width#,
-                    trill_height#, trill_height#);
-       draw_trillelement(-2 trill_width);
-       draw_trillelement(0);
+
+fet_beginchar ("prall", "prall")
+       set_char_box (2 trill_width#, 2 trill_width#,
+                     trill_height#, trill_height#);
+
+       draw_trillelement (-trill_width);
+       draw_trillelement (trill_width);
 fet_endchar;
 
-fet_beginchar("mordent", "mordent")
-       set_char_box(2 trill_width#, 2 trill_width#,
-                       4/3 trill_height#, 4/3 trill_height#);
-       draw_trillelement(-2 trill_width);
-       draw_trillelement(0);
 
+fet_beginchar ("mordent", "mordent")
+       set_char_box (2 trill_width#, 2 trill_width#,
+                     4/3 trill_height#, 4/3 trill_height#);
+
+       draw_trillelement (-trill_width);
+       draw_trillelement (trill_width);
+
+       clearxy;
        pickup pencircle scaled trill_thin;
+
        top y1 = h;
        bot y2 = -d;
-       x1 = x2 ;
+       x1 = x2;
        x2 = 0;
-       draw z1 -- z2;
+
+       draw_gridline (z2, z1, trill_thin);
+
+       labels (1, 2);
 fet_endchar;
 
-fet_beginchar("prallprall", "prallprall")
-       set_char_box(3 trill_width#, 3 trill_width#,
-                    trill_height#, trill_height#);
-       draw_trillelement(-3 trill_width);
-       draw_trillelement(-1 trill_width);
-       draw_trillelement(1 trill_width);
+
+fet_beginchar ("prallprall", "prallprall")
+       set_char_box (3 trill_width#, 3 trill_width#,
+                     trill_height#, trill_height#);
+
+       draw_trillelement (-2 trill_width);
+       draw_trillelement (0);
+       draw_trillelement (2 trill_width);
 fet_endchar;
 
-fet_beginchar("prallmordent", "prallmordent")
 
-       set_char_box(3 trill_width#, 3 trill_width#,
-                    4/3 trill_height#, 4/3trill_height#);
-       draw_trillelement(-3 trill_width);
-       draw_trillelement(-1 trill_width);
-       draw_trillelement(1 trill_width);
+fet_beginchar ("prallmordent", "prallmordent")
+       set_char_box (3 trill_width#, 3 trill_width#,
+                     4/3 trill_height#, 4/3 trill_height#);
+       draw_trillelement (-2 trill_width);
+       draw_trillelement (0);
+       draw_trillelement (2 trill_width);
 
+       clearxy;
        pickup pencircle scaled trill_thin;
+
        top y1 = h;
        bot y2 = -d;
        x1 = x2 ;
        x2 = trill_width;
-       draw z1 -- z2;
+
+       draw_gridline (z2, z1, trill_thin);
+
+       labels (1, 2);
 fet_endchar;
 
+
 save remember_pic;
 picture remember_pic;
 
-fet_beginchar("upprall", "upprall")
-       set_char_box(3 trill_width#, 3 trill_width#,
+
+fet_beginchar ("upprall", "upprall")
+       set_char_box (3 trill_width#, 3 trill_width#,
                      trill_height#, trill_height#);
-       draw_trillelement(-3 trill_width);
-       draw_trillelement(-1 trill_width);
-       draw_trillelement(1 trill_width);
+       draw_trillelement (-2 trill_width);
+       draw_trillelement (0);
+       draw_trillelement (2 trill_width);
+
+       clearxy;
 
+       z1 = (-b, 0) - trill_overlap * trill_ne;
+       z2 = z1 + (0, -2 trill_height);
 
-       z1 = (- b,0) - trill_overlap * trill_ne ;
-       z4 = z1 + (0, - 2 trill_height);
-       labels (1,4);
-       draw z1{-trill_ne} .. z4{trill_ne yscaled  -1};
-       remember_pic := currentpicture ;
+       penpos1 (trill_thin, angle (trill_ne) - 90);
+       penpos2 (trill_thin, angle (trill_ne yscaled -1) + 90);
+       penlabels (1, 2);
+
+       pickup pencircle scaled trill_thin;
+
+       fill z1l{-trill_ne}
+            .. z2l{trill_ne yscaled -1}
+            .. bot z2
+            .. rt z2
+            .. z2r{-trill_ne yscaled -1}
+            .. z1r{trill_ne}
+            -- cycle;
+
+       remember_pic := currentpicture;
 fet_endchar;
 
-fet_beginchar("upmordent", "upmordent")
-       set_char_box(3 trill_width#, 3 trill_width#,
+
+fet_beginchar ("upmordent", "upmordent")
+       set_char_box (3 trill_width#, 3 trill_width#,
                      4/3 trill_height#, 4/3 trill_height#);
 
        currentpicture := remember_pic;
 
+       clearxy;
        pickup pencircle scaled trill_thin;
+
        top y1 = h;
        bot y2 = -d;
        x1 = x2 ;
        x2 = trill_width;
-       draw z1 -- z2;
+
+       draw_gridline (z2, z1, trill_thin);
+
+       labels (1, 2);
 fet_endchar;
 
-fet_beginchar("pralldown", "pralldown")
-       set_char_box(3 trill_width#, 3 trill_width#,
+
+fet_beginchar ("pralldown", "pralldown")
+       set_char_box (3 trill_width#, 3 trill_width#,
                      trill_height#, trill_height#);
+
        currentpicture := remember_pic xscaled -1;
 fet_endchar;
 
-fet_beginchar("downprall", "downprall")
-       set_char_box(3 trill_width#, 3 trill_width#,
+
+fet_beginchar ("downprall", "downprall")
+       set_char_box (3 trill_width#, 3 trill_width#,
                      trill_height#, trill_height#);
+
        remember_pic := currentpicture;
-       draw_trillelement(-3 trill_width);
-       draw_trillelement(-1 trill_width);
-       draw_trillelement(1 trill_width);
 
+       draw_trillelement (-2 trill_width);
+       draw_trillelement (0);
+       draw_trillelement (2 trill_width);
+
+       clearxy;
+       z1 = (-b, 0) - trill_overlap * trill_ne;
+       z2 = z1 + (0, 2 trill_height);
+
+       penpos1 (trill_thin, angle (trill_ne xscaled -1) - 90);
+       penpos2 (trill_thin, angle (trill_ne) - 90);
+       penlabels (1, 2);
 
-       z1 = (- b,0) - trill_overlap * trill_ne ;
-       z4 = z1 + (0, 2 trill_height);
-       labels (1,4);
-       draw z1{trill_ne xscaled -1} .. z4{trill_ne};
-       remember_pic := currentpicture ;
+       pickup pencircle scaled trill_thin;
+
+       fill z1l{trill_ne xscaled -1}
+            .. z2l{trill_ne}
+            .. top z2
+            .. rt z2
+            .. z2r{-trill_ne}
+            .. z1r{-trill_ne xscaled -1}
+            -- cycle;
 
+       remember_pic := currentpicture;
 fet_endchar;
 
-fet_beginchar("downmordent", "downmordent")
-       set_char_box(3 trill_width#, 3 trill_width#,
-                   4/3  trill_height#, 4/3trill_height#);
+
+fet_beginchar ("downmordent", "downmordent")
+       set_char_box (3 trill_width#, 3 trill_width#,
+                     4/3 trill_height#, 4/3 trill_height#);
 
        currentpicture := remember_pic;
 
+       clearxy;
        pickup pencircle scaled trill_thin;
+
        top y1 = h;
        bot y2 = -d;
        x1 = x2 ;
        x2 = trill_width;
-       draw z1 -- z2;
+
+       draw_gridline (z2, z1, trill_thin);
+
+       labels (1, 2);
 fet_endchar;
 
-fet_beginchar("prallup", "prallup")
-       set_char_box(3 trill_width#, 3 trill_width#,
+
+fet_beginchar ("prallup", "prallup")
+       set_char_box (3 trill_width#, 3 trill_width#,
                      trill_height#, trill_height#);
+
        currentpicture := remember_pic xscaled -1;
 fet_endchar;
 
 
-fet_beginchar("lineprall", "lineprall")
-       set_char_box(3 trill_width#, 3 trill_width#,
-                     trill_height#, 4trill_height#);
+fet_beginchar ("lineprall", "lineprall")
+       set_char_box (3 trill_width#, 3 trill_width#,
+                     trill_height#, 4 trill_height#);
+
        remember_pic := currentpicture;
-       draw_trillelement(-3 trill_width);
-       draw_trillelement(-1 trill_width);
-       draw_trillelement(1 trill_width);
-
-       
-       z1 = (- b,0) - trill_overlap * trill_ne ;
-       z4 = z1 + (0, h);
-       labels (1,4);
-       draw z1 -- z4;
-fet_endchar;
 
+       draw_trillelement (-2 trill_width);
+       draw_trillelement (0);
+       draw_trillelement (2 trill_width);
 
+       clearxy;
+       z1 = (-b, 0) - trill_overlap * trill_ne ;
+       z2 = z1 + (0, h);
+
+       labels (1, 2);
+
+       draw_gridline (z1, z2, trill_thin);
+fet_endchar;
index 39435bfa7d3d982d820881a8a218ac2a148356ca..26f177075905f8b7af3e36043d2d6dce89913c21 100644 (file)
@@ -1,44 +1,43 @@
-% 
+%
 % feta-timesig.mf --  implement Time Signatures
-% 
+%
 % source file of the Feta (not an abbreviation of Font-En-Tja) music font
-% 
+%
 % (c) 1998--2004 Mats Bengtsson <matsb@s3.kth.se>,
 %               Christian Mondrup <scancm@biobase.dk>
 
-fet_begingroup("timesig");
+fet_begingroup ("timesig");
 
 
 %
-% originally by Mats B. nuked by Han-Wen, inspired by
-% Baerenreiter BA320 (Bach Cello Suites, Suite III)
+% Originally by Mats B. nuked by Han-Wen, inspired by
+% Baerenreiter BA320 (Bach Cello Suites, Suite III).
 %
 % Notes:
-% 
-%  * the inside curve of the C is rather straight.
-%  * the outside curve of the C is rather round.
-%  * right tips of the C point slightly outward
-%  * lower tip protudes to the right very slightly.
 %
-
+%  * The inside curve of the C is rather straight.
+%  * The outside curve of the C is rather round.
+%  * Right tips of the C point slightly outward.
+%  * Lower tip protudes to the right very slightly.
+%
 
 def draw_C =
-       save hair, bulb_rad, left_fatness;
+       save hair, bulb_rad, left_fatness;
        save left_width, right_width;
        save width;
 
-       width# := 1.8 staff_space#- stafflinethickness#;
+       width# := 1.8 staff_space# - stafflinethickness#;
        define_pixels (width);
 
        left_width# := 1.0 staff_space#;
        right_width# := 0.8 staff_space#;
-       define_pixels(left_width,right_width);
-  
+       define_pixels (left_width, right_width);
+
        hair# := stafflinethickness#;
        bulb_rad# := 0.4 staff_space#;
-       define_pixels(hair, bulb_rad);
+       define_pixels (hair, bulb_rad);
        left_fatness = 0.55;
-       
+
        x1r - x3r = width;
        x3r = 0.0;
        y1r = .45 staff_space;
@@ -49,53 +48,56 @@ def draw_C =
 
        x5r = x1r + 0.3 stafflinethickness;
        y5r = -0.37 staff_space;
-       z6l = z1l;
-
-       penpos1(hair, 10);
-       penpos2(stafflinethickness, 90);
-       penpos3(left_fatness * staff_space, 180);
-       penpos4(stafflinethickness, -90);
-       penpos5(hair, -13);
-       penpos6(hair, 10);
-       
-       draw_bulb(-1, z6l,  z6r, bulb_rad, .8);
-
-       save s ;
+
+       penpos1 (hair, 10);
+       penpos2 (stafflinethickness, 90);
+       penpos3 (left_fatness * staff_space, 180);
+       penpos4 (stafflinethickness, -90);
+       penpos5 (hair, -13);
+
+       draw_bulb (-1, z1l,  z1r, bulb_rad, .8);
+
+       save s;
        s := 0.735;
+
        fill z1l{dir (100)}
-               .. z2l{left}
-                       .. tension 0.8
-               .. z3l{down} .. tension 0.8 .. z4l{right} ..
-               simple_serif(z5l, z5r, -90) .. 
-               z4r{left}
-                       .. super_curvelet (z4r,z3r,s,-1)
-                       ..  z3r{up}
-                       .. super_curvelet (z3r,z2r,s, 1)
-                       .. z2r{right} .. {dir (-80)}z1r -- cycle;
-       
-       set_char_box(0, width#, staff_space#, staff_space#);
-
-       penlabels(1,2,3,4,5,6);
+            .. z2l{left}
+            ..tension 0.8.. z3l{down}
+            ..tension 0.8.. z4l{right}
+            .. simple_serif (z5l, z5r, -90)
+            .. z4r{left}
+            .. super_curvelet (z4r, z3r, s, -1)
+            .. z3r{up}
+            .. super_curvelet (z3r, z2r, s, 1)
+            .. z2r{right}
+            .. {dir (-80)}z1r
+            -- cycle;
+
+       set_char_box (0, width#, staff_space#, staff_space#);
+
+       penlabels (1, 2, 3, 4, 5);
 enddef;
 
+
 fet_beginchar ("4/4 meter", "C44")
        draw_C;
 fet_endchar;
 
+
 fet_beginchar ("2/2 meter", "C22")
-       draw_C;
-       save excentricity;
+       save excentricity, stemlen, thick;
        pair excentricity;
 
-       xpart excentricity = x2 -1.25 stafflinethickness;
+       draw_C;
+
+       xpart excentricity = x2 - 1.25 stafflinethickness;
        ypart excentricity = 0;
 
-       save stemlen ;
        stemlen = 1.4 staff_space;
-       save thick;
        thick = stafflinethickness / 2 + 0.025 staff_space;
 
-       draw_block((- thick, - stemlen) + excentricity, (thick , stemlen) + excentricity);
+       draw_block ((-thick, -stemlen) + excentricity,
+                   (thick, stemlen) + excentricity);
 fet_endchar;
 
-fet_endgroup("timesig");
+fet_endgroup ("timesig");
index 360643f0bc88f1b0b5c4b7f6c08f2f4d6a9ea56f..99d5d0b5efa397fbe7411549be3e0cc18aba1ad6 100644 (file)
@@ -294,8 +294,6 @@ def draw_meta_flat (expr xcenter, w, crook_fatness) =
             + crook_thinness * (bot_crook_dir rotated 90);
        x7 = .1 [x3r, x8];
 
-       penlabels (range 0 thru 11);
-
        y10 = -1/10 staff_space;
 %      draw_staff (-2, 2, 0.5);
 %      draw_staff (-2, 2, 0.0);
@@ -325,14 +323,17 @@ enddef;
 fet_beginchar ("Flat", "-2")
        set_char_box (1.2 stafflinethickness#, .8 staff_space#,
                      0.6 staff_space#, 1.9 staff_space#);
+
        draw_meta_flat (0, w, 0.31 staff_space);
+       penlabels (range 0 thru 11);
 fet_endchar;
 
 
 fet_beginchar ("Semi flat", "-1")
        set_char_box (1.2 stafflinethickness#, .8 staff_space#,
                      0.6 staff_space#, 1.9 staff_space#);
-       draw_meta_flat(0, w, 0.31 staff_space);
+
+       draw_meta_flat (0, w, 0.31 staff_space);
        currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
 fet_endchar;
 
@@ -403,7 +404,7 @@ fet_beginchar ("Double Sharp", "4")
        z4 = z2 reflectedabout ((0, 0), (1, 1));
        z5 = z1 reflectedabout ((0, 0), (1, 1));
 
-       labels (1, 2, 3, 4, 5);
+       labels (1, 2, 3, 4, 5);
 
        save pat;
        path pat;
@@ -445,8 +446,6 @@ def draw_paren =
        penpos2 (.1 staff_space + stafflinethickness, 0);
        penpos3 (stafflinethickness, -35);
 
-       penlabels (1, 2, 3);
-
        fill z2l{down}
             .. simple_serif (z3l, z3r, 90)
             .. z2r{up}
@@ -458,6 +457,7 @@ enddef;
 
 fet_beginchar ("Right Parenthesis", "rightparen")
        draw_paren;
+       penlabels (1, 2, 3);
 fet_endchar;