]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-toevallig.mf
* Documentation/topdocs/NEWS.texi (Top): add quarter tones.
[lilypond.git] / mf / feta-toevallig.mf
index 4d0150d02a40992ca400f223029cf37846881244..c6812f4f05e1d8edf57b839084238d51ab8317bf 100644 (file)
@@ -3,7 +3,7 @@
 % 
 % source file of the Feta (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>
 % 
 
 
@@ -26,31 +26,26 @@ fet_begingroup("accidentals");
 % a square pen).  [Wanske] does not mention this, so we'll just ignore 
 % this fact
 %
-fet_beginchar("Sharp" , "1", "sharp");
-       set_char_box(0, 1.1 staff_space#, 1.5 staff_space#, 
-               1.5 staff_space#);
 
+def draw_meta_sharp (expr width) =
        save interbeam, interstem, beamheight, beamwidth, 
                stemwidth, beamslope;
+       save spanwidth, spanheight;
+       
+       save center;
+       pair center;
 
        interbeam := 1.05 staff_space;
-       interstem := 7/16 ;
        beamheight := 4 stafflinethickness;
-       beamwidth := w;
+       beamwidth := width;
        stemwidth := 1.5 stafflinethickness;
        roundness := 2 blot_diameter;
 
-       pair center;
        center := (.5 w, 0);
        
        roundness + 2 spanwidth = beamwidth;
        roundness + 2 spanheight = beamheight;
 
-       2 horizontal_protrusion  + interstem * beamwidth + stemwidth
-               = beamwidth;
-       
-% wanske: whole beamheight; or ca 18 degrees
-%      z2 - z1 = (beamwidth - roundness, beamheight/2);
        z2 - z1 = (beamwidth - roundness, beamheight);
        z1 + z2 = 2*center;
        beamslope = (y2-y1)/(x2-x1);
@@ -58,7 +53,6 @@ fet_beginchar("Sharp" , "1", "sharp");
        pair hspan, vspan;
        hspan = (spanwidth, beamslope * spanwidth);
        vspan = (0, spanheight);
-
        
        path beam;
        beam := (hspan + vspan -- -hspan 
@@ -71,32 +65,70 @@ fet_beginchar("Sharp" , "1", "sharp");
        pickup pencircle scaled stemwidth;
        x3 = x4 = xpart center;
 
-       numeric xs;
-       xs := interstem* beamwidth / 2;
 
-       (bot y3) + -xs * beamslope = -1.5 staff_space + ypart center;
-       top y4  + xs * beamslope = 1.5 staff_space + ypart center;
+       enddef;
+
+fet_beginchar("Sharp" , "2", "sharp");
+       set_char_box(0, 1.1 staff_space#, 1.5 staff_space#, 
+               1.5 staff_space#);
+       draw_meta_sharp (w);
+
+       save stemx;
+       stemx := 7 / 32 * w;
+
+       (bot y3) + - stemx * beamslope = -1.5 staff_space + ypart center;
+       top y4  + stemx * beamslope = 1.5 staff_space + ypart center;
 
-       draw_gridline (z3-(xs,xs* beamslope),z4-(xs,xs*beamslope),stemwidth);
-       addto currentpicture also currentpicture rotated 180 shifted (w,0);
        labels(1,2,3,4);
 
+       draw_gridline (z3-(stemx,stemx* beamslope),z4-(stemx, stemx*beamslope), stemwidth);
+       addto currentpicture also currentpicture rotated 180 shifted (w,0);
 
-% to check that it doesn't overshoot staffline.
-%
-%      pickup pencircle scaled stafflinethickness;
-%      draw (0, 1.5 staff_space ) ..  (1 staff_space, 1.5 staff_space);
+       fet_endchar;
+
+fet_beginchar("1/2 Sharp" , "1", "semisharp");
+       set_char_box(0, 0.7 staff_space#, 1.5 staff_space#, 
+               1.5 staff_space#);
+
+       draw_meta_sharp (w);
+       stemx := 7 / 32 * w;
+
+       (bot y3) + - stemx * beamslope = -1.5 staff_space + ypart center;
+       top y4  + stemx * beamslope = 1.5 staff_space + ypart center;
+
+       labels(1,2,3,4);
+
+       draw_gridline (z3, z4, stemwidth);
+       addto currentpicture also currentpicture rotated 180 shifted (w,0);
 
        fet_endchar;
 
 
+fet_beginchar("3/4 Sharp" , "3", "threequartersharp");
+       set_char_box(0, 1.6 staff_space#, 1.5 staff_space#, 
+               1.5 staff_space#);
+
+       draw_meta_sharp (w);
+       stemx := 9 / 32 * w;
+
+       (bot y3) + - stemx * beamslope = -1.5 staff_space + ypart center;
+       top y4  + stemx * beamslope = 1.5 staff_space + ypart center;
+
+       labels(1,2,3,4);
+
+       draw_gridline (z3-(stemx,stemx* beamslope),z4-(stemx, stemx*beamslope), stemwidth);
+       draw_gridline (z3, z4, stemwidth);
+       addto currentpicture also currentpicture rotated 180 shifted (w,0);
+
+       fet_endchar;
+
 %
 % The stems of the natural are brushed (at least, in Barenreiter SCS )
 %
 %
 
 fet_beginchar( "Natural", "0", "natural")
-       save height;    
+       save height, xcenter;
        save interbeam, interstem, beamheight, beamwidth, 
        stemwidth;
        save top_stem_thick;
@@ -108,8 +140,10 @@ fet_beginchar( "Natural", "0", "natural")
        define_pixels(height);
        define_blacker_pixels(beamheight);
 
-       % perhaps we should have a lowres fix?
-       top_stem_thick = 1.9 stafflinethickness;
+       % The +0.4  is a lowres fix to ensure that
+       % the brush doesn't turn into a knob on 600dpi or lower.
+       top_stem_thick = round (1.9 stafflinethickness) + 0.4;
+       
 
        interstem + stemwidth =  w;
        stemwidth = 1.3 stafflinethickness;
@@ -163,21 +197,45 @@ fet_beginchar( "Natural", "0", "natural")
 %
 
 % TODO: remove crook_fatness
+% TODO: document, simplify!
+%
 def draw_meta_flat(expr xcenter, w, crook_fatness) =
        clearxy;
        save crook_thinness;
-       save top_stem_thick, bottom_stem_thick, hair;
+       save bottom_overshoot;
+       save top_stem_thick, bottom_stem_thick, hair, smaller_hole;
+       save top_crook_thinness;
+       save zwiep; 
        save center;
        pair center;
+       save clearing;
        center = (xcenter, 0);
 
-       crook_thinness = 1.25 stafflinethickness;
-       top_stem_thick = 2 stafflinethickness;
-       bottom_stem_thick = 1.2 stafflinethickness;
+% the shouldn't reach to the top staff line.
+%% TODO: should take from height.
+       clearing = 1.2 stafflinethickness; 
 
+%
+%  TODO: parameterize  this
+%
+       if w >= 0.75 staff_space:
+               smaller_hole = 0.35 stafflinethickness;
+       else:
+               smaller_hole = 0.0 stafflinethickness;
+       fi
+       crook_thinness = 1.3 stafflinethickness;
+       top_crook_thinness = 1.65 stafflinethickness;
+
+       % this is a somewhat heuristic.  We should  probably make it
+       % straight for low resolution (300 dpi and less).
+       top_stem_thick = round (2.2 stafflinethickness) + 0.74;
+
+       bottom_overshoot = stafflinethickness;
+       bottom_stem_thick = 1.2 stafflinethickness;
 
-       z1 = (0, 2 staff_space) + center;
-       z2 = (0, - 1/2 staff_space)+  center;
+       z1 = (0, 2 staff_space) + center - (0, stafflinethickness/2
+               + clearing);
+       z2 =  (0, - 1/2 staff_space - stafflinethickness/2 )+  center;
 
        penpos1(top_stem_thick, 0);
        penpos2(bottom_stem_thick, 0); 
@@ -185,52 +243,53 @@ def draw_meta_flat(expr xcenter, w, crook_fatness) =
        fill simple_serif(z1r, z1l, 30) -- z2l -- z2r -- cycle;
 
 
-       y3l = (staff_space - stafflinethickness)/2 + ypart center;
+       y3l = (staff_space - stafflinethickness) / 2 + ypart center;
        z3l = whatever [z2r,z1r];
 
-       z3r = .26 [z2r, z1r];
+       z3r = .3 [z2r, z1r] + (smaller_hole, 0);
 
+       z10 = whatever [z2r, z1r] + (smaller_hole , 0);
+       z11 = center + (bottom_overshoot/3,
+               -staff_space/2 - stafflinethickness/2) - (0,bottom_overshoot);
 
-       z4 = (3/8 staff_space, staff_space/2) + center;
        penpos4(whatever, 53);
-       y4l - y4r = 2 crook_thinness ;
-%      y4l - y4r = 6/20[crook_thinness, crook_fatness] ;
 
-       y5r = 1/4 staff_space + ypart center;
+       y4l - y4r =  top_crook_thinness ;
+
+       y5r = .20 staff_space + ypart center;
        x5l = w + xpart center;
-       penpos5(crook_fatness, -175);
+       y4 = ypart center + staff_space/2;
+       x4r = .45 [x5r, x3r];
 
-       z8 = (0, - staff_space/2 - stafflinethickness/2) + center;
+       penpos5(crook_fatness, -185);
 
-       z9 = (x5,0);
+       save bot_crook_dir ;
+       pair bot_crook_dir ;
+       bot_crook_dir =  unitvector ((x5l,0) - z11);
+       z8 = z11 +  whatever * bot_crook_dir;
+       y8 = - staff_space /2  +0.0* stafflinethickness;
 
-       save ne_angle;
-       ne_angle = angle(z9 - z8);
+       z7 = z8 + whatever * bot_crook_dir + crook_thinness  * (bot_crook_dir rotated 90);
 
-       z7 = 8/33 [z8,z9];
-       z6l = 18/33 [z8,z9] + .5 crook_thinness *dir(ne_angle -90);
-  
-       penpos7(crook_thinness, ne_angle + 90);
+       x7 = .1 [x3r, x8];
 
-       z6r = .3 (z9-z8) + z7r;
+       penlabels(range 0 thru 10);
 
-%      penpos7(crook_thinness, angle(dir(z8-center) -180);
+       y10 = -1/10 staff_space;
+%      draw_staff (-2, 2, 0.5);
+       draw_staff (-2, 2, 0.0);
 
-       penpos8(whatever, ne_angle + 90);
-       x8r =  xpart center - bottom_stem_thick/2;
-       penlabels(range 0 thru 10);
+       unfill z3r{z3r-z10} .. z4r{right} .. z5r{down}
 
-       y10 = -1/5 staff_space;
-       z10 = whatever [z2r, z1r];
-
-       unfill z3r .. z4r{right} .. tension .9 
-               .. z6r ---
-               z7r{left}
-               .. z10  -- cycle;
-       fill z8r{down}
-               .. tension 0.8 ..z8l{(z9-z8)}
-               .. z7l
-               .. z6l
+               ..  z7{- bot_crook_dir}
+               & z7 % .. tension 1.3
+               .. z10{z3r-z10}
+
+               -- cycle;
+       fill z2l{down}
+               
+               .. z11{right}
+               .. z8{bot_crook_dir}
                .. z5l{up}
                .. z4l{left} .. z3l -- cycle;
                
@@ -241,24 +300,50 @@ enddef;
 %
 % unfortunately, 600dpi is not enough to show the brush of the stem.
 %
-fet_beginchar("Flat", "-1", "flat")
-       set_char_box(1.2 stafflinethickness#, .8 staff_space#, .5 staff_space#, 2 staff_space#);
-       draw_meta_flat(0, w, 1/3 staff_space);
+fet_beginchar("Flat", "-2", "flat")
+       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);
        fet_endchar;
 
+fet_beginchar("Semi flat", "-1", "semiflat")
+       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);
+       currentpicture := currentpicture xscaled -1 shifted (w - b, 0);  
+       fet_endchar;
+
+
+fet_beginchar("Double Flat", "-4", "flatflat")
+       save left_wid, overlap, right_wid;
+       left_wid = .7;
+       right_wid = .8;
+       overlap = .05;
+       set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .6 staff_space#, 1.9 staff_space#);
+       draw_meta_flat(0, left_wid*  staff_space, 1/3 staff_space);
+       draw_meta_flat(round ((left_wid - overlap) *staff_space),
+               right_wid *staff_space, 0.33 staff_space);
+       fet_endchar;
 
-fet_beginchar("Double Flat", "-2", "flatflat")
+fet_beginchar("3/4 Flat", "-3", "threeqflat")
        save left_wid, overlap, right_wid;
        left_wid = .7;
        right_wid = .8;
        overlap = .05;
-       set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .5 staff_space#, 2 staff_space#);
+       set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .6 staff_space#, 1.9 staff_space#);
        draw_meta_flat(0, left_wid*  staff_space, 1/3 staff_space);
-       draw_meta_flat((left_wid - overlap) *staff_space,  
-               right_wid *staff_space, 1/3 staff_space);
+       draw_meta_flat(round ((left_wid - overlap) *staff_space),
+               right_wid *staff_space, 0.33 staff_space);
+
+       %% maybe we should clip part of the stems?
+       %% or make the 1st flat smaller?
+       %% or reverse it? 
+       pickup pencircle scaled 2 stafflinethickness;
+       z12 = ( - .25 w - b, .55 staff_space);
+       z13 = (  .75 w , 1.45 staff_space);
+       draw z12 -- z13;
        fet_endchar;
 
-fet_beginchar("Double Sharp", "2", "sharpsharp")
+
+fet_beginchar("Double Sharp", "4", "sharpsharp")
        set_char_box(0, staff_space#, .5 staff_space#, .5 staff_space#);
        save klaverblad, klaversteel;
 
@@ -308,11 +393,11 @@ def draw_paren =
        .. simple_serif(z1r, z1l, 90) .. z2l{down} -- cycle;
 enddef;
   
-fet_beginchar("Right Parenthesis", ")", "rightparen")
+fet_beginchar("Right Parenthesis", "rightparen", "rightparen")
        draw_paren;
 fet_endchar;
 
-fet_beginchar("Left Parenthesis", "(", "leftparen")
+fet_beginchar("Left Parenthesis", "leftparen", "leftparen")
        draw_paren;
         currentpicture := currentpicture xscaled -1;
         set_char_box(charwd, charbp, chardp, charht);