]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-pendaal.mf
Run `make grand-replace'.
[lilypond.git] / mf / feta-pendaal.mf
index e2db728882e0f28bffff400ee50cd609352c644d..202a96dea43dc5c013d4dc38a0e1867cb747fb6a 100644 (file)
@@ -4,8 +4,8 @@
 % part of LilyPond's pretty-but-neat music font
 %
 % source file of the Feta (not the Font-En-Tja) music font
-% 
-% (c)  2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
+%
+% (c) 2000--2008 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.7stafflinethickness#;
+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 pat;
 
-% code values for own pedal font commented out
-% code := 41;  % * = 42
+       set_char_box (0, 7/9 pedalh#, 0, pedalh#);
 
-fet_beginchar("Pedal asterisk", "*", "pedalasterisk")
-       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 stafflinethickness;
+       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);
+       penpos1 (bulb, 180);
+       penpos2 (bulb, 0);
+       penpos3 (thin, 0);
+
+       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 (0, 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)}; 
+       pat := 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
+               pat := pat
+                      .. ((z3r{up}
+                          .. z1l{up}
+                          .. z2l{down}
+                          .. z3l{down}
+                          .. z4l{dir (180 + 360/16)})
+                               rotatedaround (z0, 360/8 i));
+       endfor;
+
+       pat := pat
+              .. cycle;
+       fill pat;
 
-       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", "-", "pedaldash")
-       set_char_box(0, 3penw#, 0, pedalbh#);
-       pickup pencircle scaled penh;
+fet_beginchar ("Pedal dash", "M");
+       save dash_thickness;
+
+       dash_thickness# := penw#;
+       define_whole_vertical_blacker_pixels (dash_thickness);
+
+       set_char_box (0, 3 penw#, 0, pedalbh#);
+
+       penpos1 (dash_thickness, 60);
+       penpos2 (dash_thickness, 60);
+
+       z1l = (0, vround (2/3 h - 1/2 penw));
+       z2r = (w, vround (y1l + 1.2 penw));
 
-       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};
+       penlabels (1, 2, 3);
+
+       penstroke z1e{dir 40}
+                 ..tension 1.2.. z2e{dir 40};
 fet_endchar;
 
-fet_beginchar("Pedal dot", ".", "pedaldot")
-       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 (hround (1/2 penw), vround (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);
-       x2l = x1l - penw;
-       y2 = 0.7h;
-       x3r = x2l + 2penw;
-       y3r = 0.4h;
-       z4l = z5r + 1/4(z3r - z5r);
-       x5 = 1/4w;
+       penpos1 (hround penh, 0);
+       penpos2 (penw, 55);
+       penpos3 (penw, pedalpha);
+       penpos4 (1.2 penh, -pedalpha);
+       penpos5 (penh, -pedalpha);
+       penpos6 (penh, 180 - pedalpha);
+       penpos7 (penh, 180 - pedalpha);
+       penpos8 (penh, 90);
+       penpos9 (4/3 penw, 50);
+       penpos10 (1.4 penw, 50);
+       penpos11 (penh, 90 + pedalpha);
+
+       z1r = (hround 0.6 w, h);
+       x2l = hround (x1l - penw) + xpart feta_offset;
+       y2 = vround (0.7 h) + ypart feta_offset;
+       x3r = hround (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);
+       z7l = 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);
-       z14r = z1r;
-       z15l = (1/2[x16,w], y2l + 0.5penw);
-       x16 = 1/4[x1, w];
-       y16r = y2r;
+       y11 = 1/5 h;
 
-       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;
+       % don't stick out at the top
+       z1' = round (0.9 [z2, z1]) + (xpart feta_offset, 0);
+       penpos1' (penh, 0);
 
+       % shift start point of pen stroke to avoid overlapping contours
+       z8'l = z8l;
+       y8'r = y8r;
+       z8'r = z8l + whatever * (z3r - z8l);
 
-def draw_pedal_d =
-       begingroup;
-       clearxy;
-       pickup pencircle scaled penh;
+       penpos12 (hround penh, 0);
+       penpos13 (penw, -90 - pedbeta);
+       penpos14 (vround penh, 90);
+       penpos15 (penw, -90 + pedbeta);
+       penpos16 (penh, 180 + pedbeta);
 
-       penpos 1 (penh, -70);
-       penpos 2 (3/4penw, 0);
-       penpos 3 (2penh, 90);
-       penpos 4 (penw, 190);
-       penpos 5 (penh, -10-90);
+       z12r = (hround (5/9 x1 + 1/2 hround penh), y2);
+       z13l = (1/2 x12r, y15r);
+       z14r = z1r;
+       z15l = (1/2 [x16, w], y2l + 0.5 penw);
+       x16 = 1/4 [x1, w];
+       y16r = y2r;
 
-       z1l = (2/3w, pedalbh);
-       z2l = (1/3w, 1/2pedalbh);
-       z3l = (x1l, 0);
-       z4 = (w - 1/2penw, 1/2pedalbh + penh);
-       x5r = 0;
-       y5l = h;
+       % We now do a correction to `center' the stem horizontally.  While
+       % this is not the most elegant solution, it is definitely the
+       % easiest...
+
+       save horz_corr;
+       horz_corr = 1/5 [x12, x16] - x2l;
+       x2 := x2 + horz_corr;
+       x2l := x2l + horz_corr;
+       x2r := x2r + horz_corr; 
+
+       penstroke z1'e
+                 ..tension 2.5.. z2e
+                 ..tension 1.5.. z3e
+                 ..tension 2.5.. {dir (225)}z4e;
+
+       soft_end_penstroke z8'e{right}
+                          ..tension 1.5.. z9e{dir (-pedalpha)}
+                          .. z10e
+                          ..tension 2.5.. z11e;
+
+       fill z4r{dir (225)}
+            ..tension 1.5.. z5r{left}
+            .. z6r
+            ..tension 1.5.. z7r
+            ..tension 1.5.. z8r{right}
+            -- cycle;
+
+       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)};
+
+       if show_labels = 1:
+               penlabels (range 1 thru 16);
+               penlabels (1', 8');
+       fi;
+endgroup;
+enddef;
+
+
+def draw_pedal_d (expr show_labels) =
+begingroup;
+       clearxy;
 
-       penlabels (1,2,3,4,5);
+       penpos1 (vround penh, -10 - 90);
+       penpos2 (hround penw, 190);
+       penpos3 (vround (2 penh), 90);
+       penpos4 (hround (3/4 penw), 0);
+       penpos5 (penh, -70);
+
+       x1r = 0;
+       y1l = h;
+       z2 = (w - 1/2 hround penw, 1/2 pedalbh + penh);
+       z4l = (hround (1/3 w), 1/2 pedalbh);
+       z5l = (2/3 w, pedalbh);
+       z3l = (hround x5l, 0);
+
+       if show_labels = 1:
+               penlabels (1, 2, 3, 4, 5);
+       fi;
+
+       soft_start_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;
 
-       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;
+       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/5 pedalh);
+       % this helps to make the path go through z2 at low resolutions
+       z2 = round (z1 + dir pedalpha * penw) + feta_offset;
+       z3 = (3/5 w, 8/9 h);
+       z4 = (2/9 w,  y3);
+       x4r := hround x4r;
+       x5r = 0;
+       y5 = y2;
+       x6 = 3/8 w;
+       y6r = 1/2 penh;
+       z7l = (x6l + penh, y6l);
+       x8r = w;
+       y8 = 1/5 pedalh;
 
-def draw_pedal_e =
-       begingroup;
-       clearxy;
-       pickup pencircle scaled penh;
+       soft_penstroke z1e
+                      -- z2e{z2 - z1}
+                      ..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;
 
-       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);
+       if show_labels = 1:
+               penlabels (range 1 thru 8);
+       fi;
+endgroup;
+enddef;
 
-       z1l = (0, 1/5pedalh);
-       z2 = z1 + dir pedalpha * penw;
-       z3 = (3/5w, 8/9h);
 
-       z4 = (2/9w,  y3);
+fet_beginchar ("Pedal P", "P");
+       set_char_box (0, 5/6 pedalh#, 0, pedalh#);
 
-       x5r = 0;
-       y5 = y2;
+       draw_pedal_P (1);
+fet_endchar;
 
-       x6 = 3/8w;
-       y6r = 1/2penh;
 
-       z7l = (x6l+penh, y6l);
+fet_beginchar ("Pedal d", "d");
+       set_char_box (0, 2/3 pedalh#, 0, 7/8 pedalh#);
 
-       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", "pedalP")
-       set_char_box(0, 5/6pedalh#, 0, pedalh#);
-       draw_pedal_P;
+       draw_pedal_d (1);
 fet_endchar;
 
-% code := 99;  % d = 100
 
-fet_beginchar("Pedal d", "d", "pedald")
-       set_char_box(0, 2/3pedalh#, 0, 7/8pedalh#);
-       draw_pedal_d;
-fet_endchar;
+fet_beginchar ("Pedal e", "e");
+       set_char_box (0, 2/5 pedalh#, 0, pedalbh#);
 
-fet_beginchar("Pedal e", "e", "pedale")
-       set_char_box(0, 2/5pedalh#, 0, pedalbh#);
-       draw_pedal_e;
+       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", "pedalPed")
-       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#;
-       define_pixels (e_height, d_height);
+       e_height = pedalbh;
+       d_height = 7/8 pedalh;
 
        % Pe = -0.034 pedalh == -0.07 staff-space
        % ed = -0.27 pedalh == -0.53 staff-space
@@ -279,21 +324,25 @@ fet_beginchar("Pedal Ped", "Ped", "pedalPed")
        ed_kern# = -0.27 pedalh#;
        define_pixels (Pe_kern, ed_kern);
 
-       w := d_width;
-       h := d_height;
-       draw_pedal_d;
-       currentpicture := currentpicture shifted (e_width + ed_kern, 0);
-       w := e_width;
-       h := e_height;
-       draw_pedal_e;
-       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;
+       w := hround d_width;
+       h := vround d_height;
+       draw_pedal_d (0);
+       currentpicture := currentpicture
+                           shifted (hround (e_width + ed_kern), 0);
+
+       w := hround e_width;
+       h := vround e_height;
+       draw_pedal_e (0);
+       currentpicture := currentpicture
+                           shifted (hround (P_width + Pe_kern), 0);
 
+       w := hround P_width;
+       h := vround pedalh;
+       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");