2 % feta-beugel.mf -- [Staff] braces
4 % source file of the Feta (not an acronym for Font-En-Tja)
5 % pretty-but-neat music font
7 % (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 % Jan Nieuwenhuizen <janneke@gnu.org>
10 input feta-autometric;
13 staffsize# := 20 pt#; %% arbitrary.
18 def abc_encode_int (expr i) =
20 abc_encode_int (i div 26) & char (65 + i mod 26)
26 % we must let the design increase for each
27 % font to make sure that mftrace doesn't jack up the resolution too highly
28 % for the longer braces.
29 fet_beginfont ("feta-braces-" & char (97 + font_count), (font_count + 1) * 15,
40 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
42 save pendir, height, width, thin, thick, slt;
44 height# := height_sharp;
45 width# := width_sharp;
48 %% +1 is needed because fet_beginchar increments after dumping the strings.
49 fet_beginchar ("brace number " & (decimal (code + 1)),
50 "brace" & decimal code)
52 set_char_box (0, width#, height#/2, height#/2);
54 define_pixels (height, width, slt);
65 pendir = unitvector(x3 - x1, y3l/6 - y1);
66 penangle = angle pendir - 90;
67 penpos3(thin, penangle);
68 penpos2(thick, angle(z3 -z1) -90 );
69 penpos1(2/3 thin, penangle);
72 fill z2r .. simple_serif (z3r, z3l, 90)
73 .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
75 addto currentpicture also currentpicture yscaled -1;
81 save stafflinethickness;
84 linethickness := 0.5pt#;
90 for i := 0 step 1 until font_count:
92 %% We can't store more than 64 (65?) height dimensions in a TFM
93 %% file, so we make small files.
95 for j := 0 step 1 until 63:
96 % message "l: "&decimal l;
97 % note: define_pixels (x) multiplies x by hppp,
98 % must never get bigger than infinity
101 if y > infinity/hppp:
102 message "Resolution and/or magnification is too high";
103 error please report: <bug-lilypond@gnu.org>;
106 % x should be about one staff space, taking brace to have
107 % default height of 3 staffs, this yields height / 3 / 4 = 12
108 % but 15 looks better
112 linethickness := min (0.5pt#, y/150);
114 draw_brace (y, x, linethickness);
119 fet_endfont("feta-braces");