2 % autometric.mf -- administrative MF routines
4 % source file of the Feta (not an acronym for Font-En-Tja)
5 % pretty-but-neat music font
7 % (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 % Jan Nieuwenhuizen <janneke@gnu.org>
10 % these macros help create ascii logging output
11 % to automate generation of lily tables and tex backend
12 % The output should be parsed by the mf-to-table script
14 message "******************************************************";
15 message "Using feta Autometric macros. ";
16 message "Do not worry about the @ signs in the output, they are not errors. ";
17 message "******************************************************";
20 def fet_beginfont(expr name,size) =
21 font_identifier:=name&decimal size;
23 message "@{font@:"&name&"@:"&decimal size&"@}";
27 def fet_endfont(expr name) =
28 message "@{tnof@:"&name&"@}";
33 def fet_begingroup(expr name) =
34 message "@{group@:"&name&"@}";
39 def fet_endgroup(expr name) =
41 message "@{puorg@:"&name&"@}";
45 def autometric_output_char=
46 message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&idstr&"@:"&texstr&"@}";
49 def hround_pixels(expr sharped) = hround(sharped * hppp) enddef;
50 def vround_pixels(expr sharped) = vround(sharped * vppp) enddef;
52 def tand(expr alpha) =
53 (sind alpha/cosd alpha)
56 %breapth, width, depth, height
58 def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) =
59 save scharbp, scharht, scharwd, schardp;
61 % some paranoia if someone calls set_char_box(charwd, charbp, .. )
72 w := hround(w_sharp *hppp);
73 b := hround(b_sharp *hppp);
74 h := hround(h_sharp *vppp);
75 d := hround(d_sharp *vppp);
78 def no_dimen_beginchar(expr c) =
80 charcode := if known c: byte c else: 0; fi;
85 scantokens extra_beginchar;
90 % starts just as plain mf's beginchar:
94 % id index in lily's table
95 % texstr name of tex macro in lily's table and tex backend
97 % the dims are uninitialised; you should use set_char_box manually.
98 def fet_beginchar(expr name, id_lit, texstr_lit) =
99 save texstr, idstr, charnamestr;
102 string texstr, idstr, charnamestr;
103 texstr := texstr_lit;
107 no_dimen_beginchar(incr code) name;
111 def makebox_with_breapth(text r) =
112 for y = -d, 0, h: r((-b, y),(w,y)); endfor
113 for x = -b, 0, w: r((x, -d),(x, h)); endfor
117 % override plain endchar. We want a different box.
119 def breapth_endchar =
120 scantokens extra_endchar;
121 if proofing > 0: makebox_with_breapth(proofrule); fi
122 chardx := (w + b); %what the hack is chardx
128 autometric_output_char;