2 % autometric.mf -- administrative MF routines
4 % source file of the Feta (Font-En-Tja) pretty-but-neat music font
6 % (c) 1997, 1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 % Jan Nieuwenhuizen <janneke@gnu.org>
9 % these macros help create ascii logging output
10 % to automate generation of lily tables and tex backend
11 % The output should be parsed by the mf-to-table script
14 def fet_beginfont(expr name,size) =
15 font_identifier:=name&decimal size;
17 message "@{font@:"&name&"@:"&decimal size&"@}";
21 def fet_endfont(expr name) =
22 message "@{tnof@:"&name&"@}";
27 def fet_begingroup(expr name) =
28 message "@{group@:"&name&"@}";
33 def fet_endgroup(expr name) =
35 message "@{puorg@:"&name&"@}";
39 def autometric_output_char=
40 message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&idstr&"@:"&texstr&"@}";
43 def hround_pixels(expr sharped) = hround(sharped * hppp) enddef;
44 def vround_pixels(expr sharped) = vround(sharped * vppp) enddef;
46 def tand(expr alpha) =
47 (sind alpha/cosd alpha)
50 %breapth, width, depth, height
52 def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) =
53 save scharbp, scharht, scharwd, schardp;
55 % some paranoia if someone calls set_char_box(charwd, charbp, .. )
66 w := hround(w_sharp *hppp);
67 b := hround(b_sharp *hppp);
68 h := hround(h_sharp *vppp);
69 d := hround(d_sharp *vppp);
72 def no_dimen_beginchar(expr c) =
74 charcode := if known c: byte c else: 0; fi;
79 scantokens extra_beginchar;
84 % starts just as plain mf's beginchar:
88 % id index in lily's table
89 % texstr name of tex macro in lily's table and tex backend
91 % the dims are uninitialised; you should use set_char_box manually.
92 def fet_beginchar(expr name, id_lit, texstr_lit) =
93 save texstr, idstr, charnamestr;
96 string texstr, idstr, charnamestr;
101 no_dimen_beginchar(incr code) name;
105 def makebox_with_breapth(text r) =
106 for y = -d, 0, h: r((-b, y),(w,y)); endfor
107 for x = -b, 0, w: r((x, -d),(x, h)); endfor
111 % override plain endchar. We want a different box.
113 def breapth_endchar =
114 scantokens extra_endchar;
115 if proofing > 0: makebox_with_breapth(proofrule); fi
116 chardx := 10*(w + b);
122 autometric_output_char;