]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/feta-beugel.mf
Imported sources
[lilypond.git] / mf / feta-beugel.mf
index ca510cebb3904ce6543e5e589fd6007028686653..8ab96f18c61ce34fdaa2db0c8cc535b9fa3daf5d 100644 (file)
@@ -1,31 +1,62 @@
+
+
+input feta-autometric;
 input feta-macros;
+
+staffsize# := 20 pt#;  %% arbitrary.
+
+
 input feta-params;
 
+font_coding_scheme "feta braces";
+
+% we set the designsize arbitrarily at 10
+% if the * 10 is left out, pktrace gets confused  over the proper magnification,
+% and makes it too large.
+fet_beginfont("feta-braces", font_count * 10);
+
+mode_setup;
+
+
+
 save code;
-code :=0;
+code := -1;
+
+
+def abc_encode_int (expr i) =
+       if i > 0:
+               abc_encode_int(i div 26)&char(65 + i mod 26)
+       else:
+               "A"
+       fi
+enddef ;
 
+def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
 
-def draw_brace( expr height_sharp, width_sharp) = 
-       save pendir, height, width, thin, thick;
+       save pendir, height, width, thin, thick, slt;
        save penangle;
        height# := height_sharp;
-       width#  := width_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);
-       thin = 2 stafflinethickness;
+       define_pixels (height, width, slt);
+       thin = 2 slt;
        thick = .5 width;
        
        z2 = .5 [z1, z3];
-       y3 = y1 + height/2;
+       y3l = y1 + height/2;
        x3 = x1 + width;
        y1 =0;
        x3 = - width / 2;
 
        pair pendir;
-       pendir = unitvector(x3 - x1, y3/6 - y1);
+       pendir = unitvector(x3 - x1, y3l/6 - y1);
        penangle = angle pendir - 90;
        penpos3(thin, penangle);
        penpos2(thick, angle(z3 -z1) -90 );
@@ -36,13 +67,42 @@ def draw_brace( expr height_sharp, width_sharp) =
                .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
 
        addto currentpicture also currentpicture yscaled -1;
-endchar;
+fet_endchar;
 enddef;
 
-for i := font_count * 256 step 1 until (font_count + 1) * 256 - 1:
-  % note: define_pixels (x) multiplies x by hppp,
-  %       we must never get bigger than infinity
-  y := min ((i + 1) * 0.25pt#, infinity/hppp - 1);
-  x := y / 12;
-  draw_brace (y, x);
+
+
+save stafflinethickness;
+save increment;
+
+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.
+
+  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);
+
+    % x should be about one staff space, taking brace to have
+    % 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, linethickness);
+    fi
+  endfor;
 endfor
+  
+fet_endfont("feta-braces");