]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-beugel.mf
* lily/staff-symbol-referencer.cc (get_position): emergency
[lilypond.git] / mf / feta-beugel.mf
index 94218544ca856d03618b84cc982f6c823d5acd5a..3d6f6b037023f652a207ca6bd53821b0601d0adf 100644 (file)
@@ -1,14 +1,34 @@
+
+
 input feta-autometric;
 input feta-macros;
+
+staffsize#  := 20 pt#;  %% arbitrary.
+
+
 input feta-params;
 
-fet_beginfont("feta-braces", 16);
+
+def abc_encode_int (expr i) =
+       if i > 0:
+               abc_encode_int(i div 26)&char(65 + i mod 26)
+       else:
+               "A"
+       fi
+enddef ;
+
+% 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 := -1;
 
 
 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
@@ -19,8 +39,11 @@ def draw_brace (expr height_sharp, width_sharp, slt_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"&abc_encode_int(code+1),
+               "brace"&abc_encode_int (code+1))
+
+       set_char_box (0, width#, height#/2, height#/2);
          
        define_pixels (height, width, slt);
        thin = 2 slt;
@@ -44,7 +67,7 @@ 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;
 
 
@@ -52,7 +75,7 @@ enddef;
 save stafflinethickness;
 save increment;
 
-stafflinethickness := 0.5pt#;
+linethickness := 0.5pt#;
 increment := 0.5pt#;
 y := 10pt#;
 
@@ -67,7 +90,12 @@ for i := 0 step 1 until font_count:
     % 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
@@ -75,9 +103,9 @@ 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);
     fi
   endfor;
 endfor