]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-schrift.mf
2003 -> 2004
[lilypond.git] / mf / feta-schrift.mf
index 9b390d7e06c834d13359a34c81a76517d36c00bb..50b3fd551ad5269e3bbbd3007cfcbc9059e2053a 100644 (file)
@@ -4,7 +4,7 @@
 % source file of the Feta (defintively not an abbreviation for Font-En-Tja)
 % music font
 % 
-% (c) 1997 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+% (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 %      Jan Nieuwenhuizen <janneke@gnu.org>
 % 
 
@@ -19,8 +19,8 @@ def draw_fermata =
   alpha := 10;
 
   radius# = 1.25 staff_space#;
-  crook_thinness# = 1.5stafflinethickness#;
-  crook_fatness# = 4 stafflinethickness#;
+  crook_thinness# = 1.5linethickness#;
+  crook_fatness# = 0.25 staff_space# +  1.5 linethickness#;
 
   radius# + crook_fatness#/2 = h#;
   radius# + crook_thinness#/2 = w#;
@@ -57,6 +57,113 @@ fet_beginchar("fermata down", "dfermata", "dfermata")
        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#);
+
+       dot_radius# = 0.133 staff_space# + 1.33 linethickness#;
+       define_pixels(dot_radius)
+
+       fat_factor = .11;
+       thinness = 1.5 linethickness;
+
+       pickup pencircle scaled thinness;
+       rt x2 = w;
+       lft x5 = -b;
+       bot y5 = 0;
+       top y3 = h;
+       y1 = y2 = y5;
+
+       x3 = 0;
+       z1 - z4 = whatever * (charwd, -charht);
+       z4 = fat_factor [z3, z5];
+
+       filldraw z1 -- z2 -- z3 -- z4 -- cycle;
+       draw z3 .. z5;
+
+       pickup pencircle scaled 2dot_radius;
+       x1 - 2x6 = x2;
+       bot y6 = -d;
+       drawdot z6;
+enddef;
+
+fet_beginchar("short fermata up", "ushortfermata", "ushortfermata")
+       draw_short_fermata;     
+fet_endchar;
+
+fet_beginchar("short fermata down", "dshortfermata", "dshortfermata")
+       draw_short_fermata;
+       xy_mirror_char;
+fet_endchar;
+
+def draw_long_fermata =
+       save stemthick, beamheight, dot_radius, wd;
+       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#);
+
+       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 2dot_radius;
+       x4 = 0;
+       bot y4 = -d;
+       drawdot z4;
+enddef;
+
+fet_beginchar("long fermata up", "ulongfermata", "ulongfermata")
+       draw_long_fermata;      
+fet_endchar;
+
+fet_beginchar("long fermata down", "dlongfermata", "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 stemthick, dot_radius;
+       define_pixels(ihwd, ohwd, iht, oht)
+
+       ihwd# = 1.0 staff_space#;
+       ohwd# = 1.5 staff_space#;
+       iht# = 0.9 staff_space#;
+       oht# = 1.6 staff_space#;
+
+       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;
+
+       pickup pencircle scaled 2dot_radius;
+       x4 = 0;
+       bot y4 = -d;
+       drawdot z4;
+enddef;
+
+fet_beginchar("very long fermata up", "uverylongfermata", "uverylongfermata")
+       draw_very_long_fermata; 
+fet_endchar;
+
+fet_beginchar("very long fermata down", "dverylongfermata", "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
@@ -67,10 +174,12 @@ fet_beginchar("Thumb", "thumb", "thumb")
         save thin, height, width, thick;
         height# = 5/4 width#;
         height# = staff_space#;
-        thin = 1.2 stafflinethickness;
-        thick =  2 thin;
         set_char_box(width#/2, width#/2, height#/2, height#/2);
-        
+       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);
@@ -94,7 +203,7 @@ fet_beginchar("> accent", "sforzato", "sforzatoaccent")
        set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
        save thickness, diminish;
 
-       thickness = 3/2 stafflinethickness;
+       thickness = 0.05 staff_space + linethickness;
        pickup pencircle scaled thickness;
 
        % prevent blobs at crossing lines
@@ -106,7 +215,7 @@ fet_beginchar("> accent", "sforzato", "sforzatoaccent")
        y2 = .25 thickness* diminish;
 
        rt z4 = (w,0);
-       x3 =0;
+       x3 = - linethickness + 0.1 staff_space;
        z3 = whatever [z1, z4];
 
        penpos2(thickness*(2 - diminish)/2 , 90);
@@ -123,17 +232,9 @@ fet_beginchar("> accent", "sforzato", "sforzatoaccent")
        labels(4);
 fet_endchar;
 
-% Hmm, changed 1.5 to 1.4 to avoid problems with "random" placement of
-% the dots because of quantization effects for almost integer values. /MB
-
-
-%
-% Hmm. Should not meddle with darkness of font. Check out the 
-% correct value for radius. Maybe we'd better change padding --hwn
-%
 fet_beginchar("staccato dot", "staccato", "staccato")
        save radius;
-       radius# =   ((3/8) * 1.75) staff_space#;
+       radius# =   0.20 * staff_space#;
        define_whole_pixels(radius);
        pickup pencircle scaled 2 radius;
        drawdot (0,0);
@@ -143,11 +244,11 @@ fet_endchar;
 def draw_staccatissimo =
        save radius, height;
        height# = .8 staff_space#;
-       radius# = 2 stafflinethickness#;
+       radius# = linethickness# + .1 staff_space#;
        define_whole_pixels(radius);
        define_pixels(height);
 
-       draw_brush((0,0), stafflinethickness, (0, height),2 radius);
+       draw_brush((0,0), linethickness, (0, height),2 radius);
        set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
 enddef;
 
@@ -156,9 +257,6 @@ fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
        draw_staccatissimo;
 fet_endchar;
 
-%
-% FIXEM: scale labels too.
-%
 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
        draw_staccatissimo;
        y_mirror_char;
@@ -166,7 +264,7 @@ fet_endchar;
 
 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
        save thick;
-       thick# = 1.6 stafflinethickness#;
+       thick# = 1.6 linethickness#;
        define_whole_pixels(thick);
 
        set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
@@ -174,15 +272,10 @@ fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
        draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
 fet_endchar;
 
-
-%
-% Portato by Heikki Junes <heikki.junes@hut.fi>
-%
-
 def draw_portato = 
        save thick, radius;
-       thick# = 1.4 stafflinethickness#;
-       radius# = 1.4 stafflinethickness#;
+       thick# = 1.4 linethickness#;
+       radius# = 1.4 linethickness#;
        define_whole_pixels(thick,radius);
        
        set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,.5 staff_space#+ radius#);
@@ -211,7 +304,7 @@ def draw_marcato =
        set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
 
        fat_factor = .3;
-       thinness =  stafflinethickness;
+       thinness =  linethickness;
 
        pickup pencircle scaled thinness;
        rt x2 = w;
@@ -238,6 +331,7 @@ fet_endchar;
 % 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", "dmarcato")
        draw_marcato;
        xy_mirror_char;
@@ -252,9 +346,10 @@ fet_beginchar("open (unstopped)", "open", "ouvert")
        save thin, height, width, thick;
        height# = 5/4 width#;
        height# = staff_space#;
-       thin = 1.2 stafflinethickness;
-       thick =  1.4 thin;
+        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);
@@ -269,7 +364,7 @@ fet_endchar;
 
 fet_beginchar("plus (stopped)", "stopped", "plusstop")
        save thick, size;
-       thick = 2 stafflinethickness;
+       thick = 2 linethickness;
        size# = 1.1 staff_space#;
 
        set_char_box(size#/2, size#/2, size#/2, size#/2);
@@ -295,7 +390,9 @@ begingroup
        rt x2 =  w;
        top y2 = h;
 
-       z3 = 0.6 [z2, z1];
+       z3 = whatever [z2, z1];
+       y3 = 0.6 [y2, y1] + thickness;
+
        penpos3(thickness, 0);
        penpos4(thickness * diminish, 0);
        x4r = thickness/2;
@@ -313,7 +410,7 @@ enddef;
 fet_beginchar("Upbow", "upbow", "upbow")
        save ht, wd, thick, diminish;
        
-       thick = 1.4 stafflinethickness;
+       thick = 1.4 linethickness;
        wd# = 1.3 staff_space#;
        ht# = 1.6 wd#; 
        set_char_box(wd#/2, wd#/2, 0, ht#);
@@ -327,7 +424,7 @@ fet_beginchar("Downbow", "downbow", "downbow")
        define_pixels(wd)
 
        wd# = 1.5 staff_space#;
-       stemthick = 1.2 stafflinethickness;
+       stemthick = 1.2 linethickness;
        set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
 
        beamheight = 4/10 h;
@@ -349,7 +446,7 @@ def draw_turn =
 
        wd# = 35/16 staff_space#;
        ht# = 18/17 staff_space#;
-       darkness = 1.20 stafflinethickness;
+       darkness = 0.3 linethickness + 0.09 staff_space;
 
        set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
 
@@ -395,16 +492,12 @@ enddef;
 fet_beginchar("Reverse turn","reverseturn","reverseturn")
        draw_turn;
        currentpicture := currentpicture yscaled -1;
-       penlabels(5,6,7);
-       penlabels(2,3,4);
 fet_endchar;
 
 
 fet_beginchar("Turn","turn","turn")
        draw_turn;
-               
-       penlabels(5,6,7);
-       penlabels(1,2,3,4);
+       penlabels(1,2,3,4,5,6,7);
 fet_endchar;
 
 
@@ -432,7 +525,7 @@ fet_beginchar("Trill (`tr')","trill","trill")
        ex# = 1.4 staff_space#;
        kerning# = .60 ex#;
        start_nib_angle = 20;
-       bulb_size = 0.70;
+       bulb_size = 0.80;
        define_pixels(ex, ascender_extra, ascender, kerning);
 
        t_overshoot = 0.03 ex;
@@ -441,8 +534,8 @@ fet_beginchar("Trill (`tr')","trill","trill")
        t_width =  1.9 t_fatness;
        r_fatness = 0.78 fatness;
        uitschieter = 0.48 ex;
-       hair_thick =  blot_diameter;
-       r_flare = 0.45  r_fatness;
+       hair_thick =  linethickness;
+       r_flare = .5 hair_thick + 0.25 r_fatness;
        r_width =  2 r_fatness + 0.25 kerning;
        slant = .2;
 
@@ -511,7 +604,7 @@ fet_beginchar("Trill (`tr')","trill","trill")
        penpos9(r_fatness, 0);
 
        x10 = x9;
-       y10 =  -0.3 stafflinethickness;
+       y10 =  -0.3 linethickness;
        penpos10(r_fatness, 0);
 
        krul_p := z4{up}
@@ -528,13 +621,13 @@ fet_beginchar("Trill (`tr')","trill","trill")
        set_char_box(.85 staff_space# , .85 staff_space#, 0,ascender#);
 
 
-       penpos11(1/4 r_fatness, -4);
+       penpos11(hair_thick, -4);
        z11r = z9r;
        
-       z13l = (x9l + r_width, y11 -  stafflinethickness );
+       z13l = (x9l + r_width, y11 -  linethickness );
        penpos13(r_flare, 180);
 
-       z15 = z13r  - (bulb_size * r_fatness,0);
+       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);
 
@@ -560,7 +653,7 @@ def draw_heel =
        define_pixels(radius);
        set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
 
-       thickness := 1.5 stafflinethickness;    
+       thickness := 1.5 linethickness; 
        pickup pencircle scaled thickness;
        rt x1 = b;
        top y1 = h;
@@ -590,7 +683,7 @@ fet_endchar;
 def draw_toe =
        save ht,wd;
 
-       thickness := 1.5 stafflinethickness;
+       thickness := 1.5 linethickness;
        ht# := 1.5 staff_space#;
        wd# := 1/3 ht#;
        define_pixels(ht,wd);
@@ -631,6 +724,12 @@ fet_beginchar("Flageolet", "flageolet", "flageolet")
        draw z1..z2..z3..z4..cycle;
 fet_endchar;
 
+%%
+%
+%TODO:  ARGRGHGH code dup.
+%
+%
+
 fet_beginchar("Segno", "segno", "segno")
        save thin, thick, ball_diam, darkness, pointheight;
        save wd, ht, thick_nibangle, ball_nib_thick;
@@ -639,7 +738,7 @@ fet_beginchar("Segno", "segno", "segno")
 
        ht# = 3 staff_space#;
        wd# = 2 staff_space#;
-       darkness = 1.20 stafflinethickness;
+       darkness = .08 staff_space + 0.4  linethickness;
 
        set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
 
@@ -648,7 +747,7 @@ fet_beginchar("Segno", "segno", "segno")
        thin = darkness;
        ball_nib_thick = 2.7 darkness;
        ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
-       pointheight = 2 stafflinethickness;
+       pointheight = 2 linethickness;
        
        y3l = h;
        2 x3 = x2 + x4;
@@ -692,15 +791,18 @@ fet_beginchar("Segno", "segno", "segno")
 fet_endchar;
 
 fet_beginchar("Coda", "coda", "coda")
-       save thin, thick, codawidth, codaheight;
-       thin# = 1.2 stafflinethickness#;
-       thick# = 3.5 stafflinethickness#;
+       save stickout, thin, thick, codawidth, codaheight;
+
+       stickout# = 0.35 staff_space#;
        codawidth# = 2/3 staff_space#;
        codaheight# = 1 staff_space#;
-       define_pixels(thin, thick, codawidth, codaheight);
 
-       set_char_box(codawidth#+thick#, codawidth#+thick#,
-               codaheight#+thick#, codaheight#+thick#);
+       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);
@@ -723,11 +825,42 @@ fet_beginchar("Coda", "coda", "coda")
 
 fet_endchar;
 
+fet_beginchar("Varied Coda", "varcoda", "varcoda")
+       save thin, thick, codawidth, codaheight;
+       thin# = 1.2 linethickness#;
+       thick# = 1.0 linethickness# + 0.25 staff_space#;
+       codawidth# = 2/3 staff_space#;
+       codaheight# = 1 staff_space#;
+       define_pixels(thin, thick, codawidth, codaheight);
+
+       set_char_box(codawidth#+thick#, codawidth#+thick#,
+               codaheight#+thick#, codaheight#+thick#);
+
+       x1 = -codawidth;
+       y1 = y2 - thin;
+       x2 = 0;
+       y2 = codaheight;
+       draw_rounded_block(z1, z2, blot_diameter);
+
+       x3 = x1;
+       y3 = -blot_diameter;
+       x4 = x1 + thick;
+       y4 = y2;
+       draw_rounded_block(z3, z4, blot_diameter);
+       labels(1,2,3,4);
+
+       addto currentpicture also currentpicture xscaled -1;
+       addto currentpicture also currentpicture yscaled -1;
+
+       draw_gridline((0,-h),(0,h),thin);
+       draw_gridline((-w,0),(w,0),thin);
+fet_endchar;
+
 def draw_comma = 
        save alpha, thick, thin, ht;
        alpha:=35;
-       thin# = 1.2 stafflinethickness#;
-       thick# = 3 stafflinethickness#;
+       thin# = 1.2 linethickness#;
+       thick# = 3 linethickness#;
        ht# = .6staff_space#;
        define_pixels(thin, thick,ht);
        set_char_box(0, .5staff_space#, ht#, ht#);
@@ -756,10 +889,33 @@ fet_beginchar("Left Comma","lcomma","lcomma");
        xy_mirror_char;
 fet_endchar;
 
+def draw_varcomma = 
+       save thick, thin, ht, wd, alpha;
+       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#);
+       z1 = (-b, -d);
+       z2 = (w, h);
+       draw_brush(z1, thin, z2, thick);
+enddef;
+
+fet_beginchar("Right Varied Comma","rvarcomma","rvarcomma");
+       draw_varcomma;
+fet_endchar;
+
+fet_beginchar("Left Varied Comma","lvarcomma","lvarcomma");
+       draw_varcomma;
+       xy_mirror_char;
+fet_endchar;
+
 thick#:=1/24designsize;
 define_blacker_pixels(thick);
 
-rthin:=1/8*staff_space;
+rthin:= 0.075 *staff_space + 0.5 linethickness;
 rthick:=2thick+rthin;
 
 def draw_arpeggio =
@@ -872,6 +1028,54 @@ 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. 
+%
+fet_beginchar("Caesura", "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;
+
+
+  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);
+
+  bot y1 = -d;
+  top y2 = h;
+  lft x1 = 0;
+  x2 = (y2 - y1) / slant;
+
+  krom = 10;
+
+  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);
+
+  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");