]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-beugel.mf
*** empty log message ***
[lilypond.git] / mf / feta-beugel.mf
index 419f3b59edc221e7e6653c750bdadb4ac00e0b81..393d6a372d3446d80c177900f0200bb5c685ae81 100644 (file)
@@ -1,27 +1,35 @@
+% 
+% feta-beugel.mf -- [Staff] braces
+% 
+% source file of the Feta (not an acronym for Font-En-Tja)
+% pretty-but-neat music font
+% 
+% (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+%                Jan Nieuwenhuizen <janneke@gnu.org>
+
 input feta-autometric;
 input feta-macros;
+
+staffsize# := 20 pt#;   %% arbitrary.
+
 input feta-params;
 
-fet_beginfont("feta-braces", 16);
-mode_setup;
 
-staffsize#:=16pt#;
+% we must let the design increase for each
+% font to make sure that mftrace doesn't jack up the resolution too highly
+% for the longer braces.
+fet_beginfont ("feta-braces-" & char (97 + font_count), (font_count + 1) * 15,
+               "fetaBraces");
 
-save code;
-code := 0;
+mode_setup;
 
 
-def abc_encode_int (expr i) =
-       if i > 0:
-               abc_encode_int(i div 26)&char(65 + i mod 26)
-       else:
-               "A"
-       fi
-enddef ;
 
-message (abc_encode_int (26));
+save code, braces_per_font;
+code := 64;
+braces_per_font := 64;
 
-def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
+def draw_brace (expr height_sharp, width_sharp, slt_sharp, brace_number) =
 
        save pendir, height, width, thin, thick, slt;
        save penangle;
@@ -29,8 +37,9 @@ def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
        width# := width_sharp;
        slt# := slt_sharp;
 
-fet_beginchar("brace number "&(decimal code), "brace"&abc_encode_int(code),
-               "brace"&abc_encode_int (code))
+%% +1  is needed because fet_beginchar increments after dumping the strings.
+fet_beginchar ("brace number " & (decimal (brace_number)),
+               "brace" & decimal(brace_number))
 
        set_char_box (0, width#, height#/2, height#/2);
          
@@ -64,22 +73,30 @@ enddef;
 save stafflinethickness;
 save increment;
 
-stafflinethickness := 0.5pt#;
+linethickness := 0.5pt#;
 increment := 0.5pt#;
 y := 10pt#;
 
 
 
+
 for i := 0 step 1 until font_count:
 
   %% We can't store more than 64 (65?) height dimensions in a TFM
   %% file, so we make small files.
+  save number;
+
+  number := braces_per_font * i;
 
   for j := 0 step 1 until 63:
     % message "l: "&decimal l;
     % note: define_pixels (x) multiplies x by hppp,
     % must never get bigger than infinity
-    y := min (y + increment, infinity/hppp - 1);
+    y := y + increment;
+    if y > infinity/hppp:
+      message "Resolution and/or magnification is too high";
+      error please report: <bug-lilypond@gnu.org>;
+    fi
 
     % x should be about one staff space, taking brace to have
     % default height of 3 staffs, this yields height / 3 / 4 = 12
@@ -87,10 +104,11 @@ for i := 0 step 1 until font_count:
     x := y / 15;
 
     increment := x / 10;
-    stafflinethickness :=  min (0.5pt#, y/150);
+    linethickness :=  min (0.5pt#, y/150);
     if i = font_count:
-      draw_brace (y, x, stafflinethickness);
+      draw_brace (y, x, linethickness, number);
     fi
+    number := number + 1;
   endfor;
 endfor