]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-klef.mf
2003 -> 2004
[lilypond.git] / mf / feta-klef.mf
index 1ed1d987ea58da1894f637e0f1c592adfda97893..0f9df26550b92114e7364063d50f79a01ef4c23d 100644 (file)
@@ -4,24 +4,13 @@
 %
 % source file of the Feta (not the Font-En-Tja) music font
 % 
-% (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
+% (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>,
 % Jan Nieuwenhuizen <janneke@gnu.org>,
 % Juergen Reuter <reuter@ipd.uka.de>
 
 
 fet_begingroup("clefs");
-
-%
-% [Ross] says that clefs take 1 staff_space space on the left and right
-%
-% this is now handled in the lilypond spacing engine. 
-%
-
-def set_horizontal_spacing =
-       save left_space ,right_space;
-       left_space# = 0;
-       right_space# = 0;
-enddef;
+test_staff = 0;
 
 
 % [Wanske] says the bulbs should be positioned about 1/4 right of the
@@ -33,21 +22,24 @@ def draw_c_clef (expr reduction) =
        save hair, norm, reduced_ss, right_edge;
        reduced_ss#=staff_space#*reduction;
        norm#:=2/3reduced_ss#;
-       hair#:=1/6norm#;
+       hair#:=0.06 reduced_ss# + 0.5 linethickness# ;
 
-       set_horizontal_spacing;
        right_edge# = 15/4norm#+2hair#;
 
-       set_char_box (left_space#, right_edge# + right_space#
+       set_char_box (0, right_edge# + 0
                2 reduced_ss#, 2 reduced_ss#);
        define_pixels (hair,norm,reduced_ss, right_edge);
 
        draw_block ((0,-d), (3/4norm+1/2hair,h));
        draw_block ((3/4norm+2hair,-d), 
                (3/4norm+7/2hair,h));
+
        
        save xoff;
        xoff=3/4norm+7/2hair;
+       z5l = (xoff - 3/4 hair, 0);
+       z5r = (x4, 0);
+
        penpos1(hair,-90);
        z1l=(xoff+norm+hair,h);
        penpos2(norm-3/2hair,180);
@@ -56,10 +48,7 @@ def draw_c_clef (expr reduction) =
        z3=(((right_edge -xoff)/2)+xoff,2hair);
 
        penpos4(hair,0);
-       z4=(xoff+1/2norm+1/2hair,reduced_ss-hair);
-       
-       penpos5(4hair,0);
-       z5=(xoff+5/4hair,0);
+       z4=(xoff+1/2norm+1/2hair, reduced_ss - linethickness - .2 hair);
 
        penpos6(norm-hair,90);
        z6=(xoff+3/4norm,0);
@@ -81,14 +70,14 @@ def draw_c_clef (expr reduction) =
        enddef;
 
 fet_beginchar ("C clef", "C", "altoclef")
-       if test = 1:
+       if test_staff = 1:
                draw_staff (-2,2, 0.0);
        fi;
        draw_c_clef (1.0);
 fet_endchar;
 
 fet_beginchar ("C clef", "C_change", "caltoclef")
-       if test = 1:
+       if test_staff = 1:
                draw_staff (-2,2, 0.0);
        fi;
        draw_c_clef (.8);
@@ -183,21 +172,18 @@ def draw_bass_clef(expr exact_center, reduction) =
         save dot_diam;
         reduced_ss# = staff_space# * reduction;
 
-
         2.2 dot_diam = round reduction* (staff_space - stafflinethickness);
-       right_thickness = 0.48;
-        left_thick = .25;
+       right_thickness = 0.37 staff_space + 1.2 linethickness ;
         swoosh_width# = 2.1 reduced_ss#;
-%      tip_protude := (-stafflinethickness, -.2 staff_space);
+%      tip_protude := (-linethickness, -.2 staff_space);
        tip_protude := (0, 0);  
-        set_horizontal_spacing;
        bulb_y_offset := 0.15 staff_space;
        overshoot_top := 0.0;
        %% 
 
-        set_char_box(left_space# +
+        set_char_box(0 +
                 - xpart exact_center,
-                right_space# +
+                0 +
                 xpart exact_center + swoosh_width# + 7/12 reduced_ss#, 
                 - ypart exact_center + 2.5 reduced_ss#, 
                 ypart exact_center +reduced_ss#);
@@ -212,12 +198,11 @@ def draw_bass_clef(expr exact_center, reduction) =
         x2 = .5 [x1,x3];
        x2l = x2r = x2;
 
-       y2l := vround_pixels (reduced_ss#  + 0.5 stafflinethickness#);
-       y2l - y2r = (1.0 + overshoot_top) * stafflinethickness;
-       y2 = .5 [y2l, y2r];
+       y2l := vround_pixels (reduced_ss#  + 0.5 linethickness#);
+       y2l - y2r = (1.0 + overshoot_top) * linethickness;
 
         x3l - x1 =  swoosh_width;
-        x3l - x3r = right_thickness * reduced_ss;
+        x3l - x3r = right_thickness;
 
        % try to correct: the top dot seems farther away if y3l = 0.
         y3l = 0.05 staff_space;
@@ -227,12 +212,12 @@ def draw_bass_clef(expr exact_center, reduction) =
         z5 = (x3l +  1/3 reduced_ss, .5 reduced_ss);
 
         penpos3(whatever,  185);
-        penpos4(stafflinethickness, 135);
+        penpos4(linethickness, 135);
 
        pickup pencircle scaled 1; 
 %      draw
        fill
-           new_bulb (z1, 0.45 reduced_ss, 0.4 reduced_ss, 2.5 stafflinethickness,  1, 1)
+           new_bulb (z1, 0.45 reduced_ss, 0.4 reduced_ss, 2.5 linethickness,  1, 1)
 
 {dir (90)}
                .. z2r{right} .. tension 1.0 .. z3r{down}  .. {curl 0} 
@@ -254,7 +239,7 @@ enddef;
 
 
 fet_beginchar("F clef ", "F", "bassclef")
-       if test = 1:
+       if test_staff = 1:
                draw_staff(-3,1, 0.0);
        fi;
        draw_bass_clef((0, 0), 1.0);
@@ -281,7 +266,7 @@ fet_endchar;
 %  -- vrij naar Van Kooten & De Bie
 %
 def debugfill = fill enddef;
-def draw_gclef (expr exact_center, 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;
@@ -289,10 +274,7 @@ def draw_gclef (expr exact_center, reduction)=
        define_pixels(reduced_ss);
        pair downstroke_dir, center;
 
-       center := (hround_pixels(xpart exact_center), 
-               vround_pixels(ypart exact_center));
-
-       thinness = 1.4 stafflinethickness;
+       thinness = 0.08 staff_space + 0.7 linethickness;
        downstroke_dir = unitvector (14, -75);
        downstroke_angle = angle downstroke_dir;
 
@@ -300,23 +282,20 @@ def draw_gclef (expr exact_center, reduction)=
        breapth_factor = 21.0 /14;
        inner_thick_end = 45;
        inner_start_angle = downstroke_angle - 43;
-       thickness = .4 reduced_ss;
+       thickness = .32 reduced_ss + 1.1 linethickness;
 
        thinnib = thinness;
 
-       set_horizontal_spacing;
        
-       set_char_box(
-               left_space# +
-               -xpart exact_center + 1.0 * breapth_factor* reduced_ss#, 
-               right_space# +
-               xpart exact_center + .66 breapth_factor* reduced_ss#,
-               -ypart exact_center + 2.6 * reduced_ss#,
-               ypart exact_center + 5 * reduced_ss#);
+       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);
 
        save upward_swoosh_angle;
-       upward_swoosh_angle =130 ;
+       upward_swoosh_angle = 132;
        penpos7(thickness, upward_swoosh_angle);
        penpos5(thickness, upward_swoosh_angle);
 
@@ -357,7 +336,7 @@ def draw_gclef (expr exact_center, reduction)=
 
        z10 = .5 [z10l, z10r];
 
-       z11 =  center + whatever * downstroke_dir +  ( .05 reduced_ss, 0);
+       z11 =  center + whatever * downstroke_dir +  ( .00 reduced_ss, 0);
 
        penpos1(thinnib, inner_start_angle);
        penpos2(thickness, 90);
@@ -369,7 +348,7 @@ def draw_gclef (expr exact_center, reduction)=
        save lipje;
        pair lipje;
        lipje= .5 [z9l, z9r] +  .25 ((z9r- z9l)  rotated -90);
-       penpos13(2 thinnib, 180);
+       penpos13(thinnib + 0.14 staff_space, 180);
 
        pickup pencircle scaled 1;
 
@@ -379,16 +358,14 @@ def draw_gclef (expr exact_center, reduction)=
                .. z4l{left}
                .. z5l{up}
                .. z7l{up} 
-               %.. z8l 
                .. tension 1.2 
                .. z9l -- lipje
                --z9r % {dir (downstroke_angle+ 0)}
                .. tension 0.8
-               %.. z8r
                .. z7r{down} .. z5r{down} .. z4r{right}
                .. z3r .. z2r{left} .. 
                tension .95 .. 
-               z1r -- z1l 
+               z1r -- simple_serif(z1r, z1l, 80) -- z1l 
                .. tension 0.85 ..cycle;
 
        save p, staffline_time, staff_line_path, down_staff_line_intersection;
@@ -414,8 +391,7 @@ def draw_gclef (expr exact_center, reduction)=
 
        p := z9 .. z10{down}
                .. z6
-               .. (.52 [z4, z3])
-               .. z11{down}
+               .. z11{dir (-95) }
                .. z12{dir(bot_angle)}
                .. z13{up}
        ;
@@ -447,13 +423,13 @@ def draw_gclef (expr exact_center, reduction)=
 
        pickup pencircle scaled 1;
 
-       fill simple_serif(z1r, z1l, 80)  -- cycle;
-
        debugfill
                z11r{dir(start_angle)}
                .. z12r{dir(bot_angle)}
 
-               ..new_bulb (z13r, 0.45 reduced_ss, 0.38 reduced_ss, 3 stafflinethickness,  1, -1) {down}
+               ..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)}
@@ -468,13 +444,13 @@ enddef;
 
 
 fet_beginchar("G clef", "G", "trebleclef")
-       if test = 1:
+       if test_staff = 1:
                draw_staff(-1,3, 0.0);
        fi;
-       draw_gclef((1.7 staff_space#,0), 1.0);
+       draw_gclef(1.0);
 fet_endchar;
 fet_beginchar("G clef", "G_change", "ctrebleclef")
-       draw_gclef((1.3 staff_space#,0), .8);
+       draw_gclef(0.8);
 fet_endchar;
 
 %%%%
@@ -483,8 +459,16 @@ fet_endchar;
 %
 
 
+
+%%
+%
+% The perc clef extent is not coincident with its bbox, since 
+%  the perc clef needs more space in front than a normal clef.
+%
+
 def draw_percussion_clef(expr reduction) =
-       save reduced_ss;
+       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#);