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--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 % Jan Nieuwenhuizen <janneke@gnu.org>
11 % We have to reduce the pixel-per-point value to
12 % support large brace glyphs in case we are using MetaPost
13 % (which by default sets `hppp' to 49.80244, regardless of
14 % the used `mag' value)
17 bpppix_ := 0.2; % ten times larger than original
19 numeric mm, pt, dd, bp, cm, pc, cc, in;
21 mm * bpppix_ = 2.83464;
22 pt * bpppix_ = 0.99626;
23 dd * bpppix_ = 1.06601;
25 cm * bpppix_ = 28.34645;
26 pc * bpppix_ = 11.95517;
27 cc * bpppix_ = 12.79213;
35 input feta-autometric;
38 staffsize# := 20 pt#; %% arbitrary
43 % We must let the design increase for each font to make sure that mftrace
44 % doesn't jack up the resolution too highly for the longer braces.
47 fet_beginfont ("feta-braces-" & char (97 + font_count),
48 (font_count + 1) * 20, "fetaBraces");
53 save code, braces_per_font;
55 braces_per_font := 64;
57 def draw_brace (expr height_sharp, width_sharp, slt_sharp, brace_number) =
58 save pendir, height, width, thin, thick, slt, pat;
63 height# := height_sharp;
64 width# := width_sharp;
67 fet_beginchar ("brace number " & decimal (brace_number),
68 "brace" & decimal (brace_number))
69 set_char_box (width#, 0, height# / 2, height# / 2);
71 define_pixels (height, width, slt);
76 y3l = y1 + height / 2;
83 pendir = unitvector (x3 - x1, y3l / 6 - y1);
84 penangle = angle pendir - 90;
85 penpos3 (thin, penangle);
86 penpos2 (thick, angle (z3 - z1) - 90);
87 penpos1 (2/3 thin, penangle);
93 .. simple_serif (z3r, z3l, 90)
95 .. z1l{dir (angle (z1r - z1l) - 90)}
97 .. z1r{-dir (angle (z1l - z1r) + 90)}
99 pat := subpath (0, 5) of pat
100 -- subpath (6, 7) of pat
109 save stafflinethickness;
112 linethickness := 0.5 pt#;
113 increment := 0.5 pt#;
116 for i := 0 step 1 until font_count:
119 number := braces_per_font * i;
121 for j := 0 step 1 until (braces_per_font - 1):
122 % message "l: "&decimal l;
123 % note: define_pixels (x) multiplies x by hppp,
124 % must never get bigger than infinity
126 if y > infinity / hppp:
127 message "Resolution and/or magnification is too high";
128 message "HPPP: "& decimal hppp &" Y: " & decimal y;
129 errmessage "please report to <bug-lilypond@gnu.org>";
132 % x should be about one staff space, taking brace to have
133 % default height of 3 staffs, this yields height / 3 / 4 = 12
134 % but 15 looks better
138 linethickness := min (0.5 pt#, y / 150);
140 draw_brace (y, x, linethickness, number);
143 number := number + 1;
147 fet_endfont ("feta-braces");