]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-beugel.mf
(transform_heads): replace
[lilypond.git] / mf / feta-beugel.mf
index fad6035df3efcf9b62fe07ca317929c064a567fe..ba5840bfbeea5ab17188227912cb041ccfcf5df1 100644 (file)
@@ -1,25 +1,47 @@
+% 
+% 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);
+
+% 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");
+
 mode_setup;
 
-staffsize#:=16pt#;
+
 
 save code;
-code := 0;
+code := 64;
+
 
+def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
 
-def draw_brace (expr height_sharp, width_sharp, slt_sharp) = 
        save pendir, height, width, thin, thick, slt;
        save penangle;
        height# := height_sharp;
        width# := width_sharp;
        slt# := slt_sharp;
 
-       beginchar(code, width#, height#/2, height#/2);
-       code := incr code;
+%% +1  is needed because fet_beginchar increments after dumping the strings.
+fet_beginchar ("brace number " & (decimal (code + 1)),
+               "brace" & decimal code)
+
+       set_char_box (0, width#, height#/2, height#/2);
          
        define_pixels (height, width, slt);
        thin = 2 slt;
@@ -43,25 +65,45 @@ def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
                .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
 
        addto currentpicture also currentpicture yscaled -1;
-endchar;
+fet_endchar;
 enddef;
 
-l := 0.05pt#;
+
+
+save stafflinethickness;
+save increment;
+
+linethickness := 0.5pt#;
+increment := 0.5pt#;
 y := 10pt#;
 
+
+
 for i := 0 step 1 until font_count:
-  for j := 0 step 1 until 255:
+
+  %% We can't store more than 64 (65?) height dimensions in a TFM
+  %% file, so we make small files.
+
+  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 + l / 2, 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
-    x := y / 12;
-    % l should be about one stafflinethickness
-    l := x / 10;
+    % default height of 3 staffs, this yields height / 3 / 4 = 12
+    % but 15 looks better
+    x := y / 15;
+
+    increment := x / 10;
+    linethickness :=  min (0.5pt#, y/150);
     if i = font_count:
-      draw_brace (y, x, l);
+      draw_brace (y, x, linethickness);
     fi
   endfor;
 endfor