]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-klef.mf
* scripts/ly2dvi.py (include_path): bugfix: use outbase
[lilypond.git] / mf / feta-klef.mf
index eeb9bc097fed8b58467e116d35de60e174e9b74a..3fcb0ef8761558a36bf4bace12b22304818d3017 100644 (file)
@@ -4,25 +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--2003 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;
-
 
 % [Wanske] says the bulbs should be positioned about 1/4 right of the
 % "arrow"
@@ -35,10 +23,9 @@ def draw_c_clef (expr reduction) =
        norm#:=2/3reduced_ss#;
        hair#:=1/6norm#;
 
-       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);
 
@@ -190,14 +177,13 @@ def draw_bass_clef(expr exact_center, reduction) =
         swoosh_width# = 2.1 reduced_ss#;
 %      tip_protude := (-stafflinethickness, -.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#);
@@ -269,12 +255,6 @@ fet_endchar;
 %
 % Inspired by Baerenreiter
 % 
-% FIXME bulb should curve (see bass clef)
-% FIXME start (inside) should be little thinner
-%
-
-
-
 
 % Beste lezers, kijk,
 %
@@ -286,19 +266,16 @@ fet_endchar;
 %
 %  -- vrij naar Van Kooten & De Bie
 %
-
-def draw_gclef (expr exact_center, reduction)=
+def debugfill = fill enddef;
+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, thinpen;
+       save inner_start_angle, thinness;
        reduced_ss# = staff_space# * reduction;
        define_pixels(reduced_ss);
        pair downstroke_dir, center;
 
-       center := (hround_pixels(xpart exact_center), 
-               vround_pixels(ypart exact_center));
-
-       thinness = 1.3 stafflinethickness;
+       thinness = 1.4 stafflinethickness;
        downstroke_dir = unitvector (14, -75);
        downstroke_angle = angle downstroke_dir;
 
@@ -309,17 +286,14 @@ def draw_gclef (expr exact_center, reduction)=
        thickness = .4 reduced_ss;
 
        thinnib = thinness;
-       thinpen = 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 ;
@@ -342,29 +316,28 @@ def draw_gclef (expr exact_center, reduction)=
        z6 = center + whatever * downstroke_dir;
        y6 = ypart center + 2 reduced_ss;
 
-       z7l - z6 = whatever *(z5- z6) ;
+       z7l - z6 = whatever * (z5 - z6) ;
        y7l = 3.5 reduced_ss;
 
        x9 = .7 [x10, x7r];
        top y9l = 5 reduced_ss;
 
-       y11 = ypart center  -20/14 reduced_ss;
-       y12 = ypart center  - 34/14 reduced_ss;
-       y13 = y12 + .65 reduced_ss;
-       x11 - x13r  = 1.25 reduced_ss + 0.5 thinnib;
+       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) ;
 
-       x12r = xpart (.52 [z13r , z11] + .75 reduced_ss * downstroke_dir) ;
-       
-       z10=  center + whatever * dir (downstroke_angle + .5);
-       y10 = ypart center + 3.35  reduced_ss;
+%      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 =
-               .9 thinnib* dir (downstroke_angle + 90) + whatever *downstroke_dir;
+               .7 thinnib* dir (downstroke_angle + 90) + whatever * downstroke_dir;
 
        z10 = .5 [z10l, z10r];
 
-
-       z11 =  center + whatever * downstroke_dir;
+       z11 =  center + whatever * downstroke_dir +  ( .05 reduced_ss, 0);
 
        penpos1(thinnib, inner_start_angle);
        penpos2(thickness, 90);
@@ -372,14 +345,15 @@ def draw_gclef (expr exact_center, reduction)=
        penpos4(thinnib, -90);
 
 
-       penpos9(1.4 thickness, -70);  
-
-       penpos13(3 thinnib, 180);
+       penpos9(1.45 thickness, -70);  
+       save lipje;
+       pair lipje;
+       lipje= .5 [z9l, z9r] +  .25 ((z9r- z9l)  rotated -90);
+       penpos13(2 thinnib, 180);
 
        pickup pencircle scaled 1;
 
-       fill
-%      draw 
+       debugfill
                z2l{right}
                .. z3l
                .. z4l{left}
@@ -387,24 +361,24 @@ def draw_gclef (expr exact_center, reduction)=
                .. z7l{up} 
                %.. z8l 
                .. tension 1.2 
-               .. z9l
+               .. 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, q;
-       path p,q;
+       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} ;
 
-       q := (-reduced_ss, 2 reduced_ss) ..  (2 reduced_ss,2 reduced_ss);
+       staff_line_path := (-reduced_ss, 2 reduced_ss) ..  (2 reduced_ss,2 reduced_ss);
 
        draw p;
-%      z14 = point xpart (p intersectiontimes  q) of p;
 
 
        % we don't do this with a path: variations in thickness
@@ -413,16 +387,23 @@ def draw_gclef (expr exact_center, reduction)=
        
 
        save bot_angle;
-       bot_angle = downstroke_angle- 87;
+
+       bot_angle = -180; % downstroke_angle- 87;
 
        penpos12(thinnib, bot_angle + 90);
 
        p := z9 .. z10{down}
-               .. z6 
-               ..  z11{dir (-93)} 
+               .. z6
+               .. (.52 [z4, z3])
+               .. z11{down}
                .. 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);
@@ -430,15 +411,15 @@ def draw_gclef (expr exact_center, reduction)=
 
        save loop_end_dir;
        pair loop_end_dir;
-       loop_end_dir = direction (xpart (p intersectiontimes q)) of p;
+       loop_end_dir = direction (xpart (p intersectiontimes staff_line_path)) of p;
        draw p;
 
        penpos6(thinnib, angle (loop_end_dir) + 90);
-       fill
-%      draw
+       pickup pencircle scaled 1;
+       debugfill
                z9l
                .. {down}z10l
-               .. z6l{loop_end_dir} -- z6r{-loop_end_dir}
+               .. z14l{loop_end_dir} -- z14r{-loop_end_dir}
                .. z10r{up}
                .. tension .98
                .. z9r
@@ -446,16 +427,13 @@ def draw_gclef (expr exact_center, reduction)=
 
        pickup pencircle scaled 1;
 
-       fill simple_serif(z1r, z1l, 80)  -- cycle;
-
-%      draw
-       fill
+       debugfill
                z11r{dir(start_angle)}
                .. z12r{dir(bot_angle)}
 
-               ..new_bulb (z13r, 0.45 reduced_ss, 0.38 reduced_ss, 2.5 stafflinethickness,  1, -1) {down}
+               ..new_bulb (z13r, 0.45 reduced_ss, 0.38 reduced_ss, 3 stafflinethickness,  1, -1) {down}
 
-               % z13r{up} -- z13l{down}
+%              .. tension 0.98
                .. z12l{-dir (bot_angle)}
 
                .. z11l{-dir(start_angle)}
@@ -471,10 +449,10 @@ fet_beginchar("G clef", "G", "trebleclef")
        if test = 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 +461,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#);