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--2004 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,encod) =
21 font_identifier:=name&decimal size;
23 font_coding_scheme encod;
24 message "@{font@:GNU@:LilyPond@:"&name&"@:"&decimal size&"@:"&encod&"@}";
33 def fet_begingroup(expr name) =
34 message "@{group@:"&name&"@}";
39 def fet_endgroup(expr name) =
41 message "@{puorg@:"&name&"@}";
45 def autometric_parameter (expr name, value) =
46 message "@{parameter@:"&name&"@:"&decimal value&"@}";
50 def autometric_output_char=
51 message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&decimal charwx&"@:"&decimal charwy&"@:"&idstr&"@:"&texstr&"@}";
54 def hround_pixels(expr sharped) = hround(sharped * hppp) enddef;
55 def vround_pixels(expr sharped) = vround(sharped * vppp) enddef;
57 def tand(expr alpha) =
58 (sind alpha/cosd alpha)
61 %breapth, width, depth, height
63 def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) =
64 save scharbp, scharht, scharwd, schardp;
66 % some paranoia if someone calls set_char_box(charwd, charbp, .. )
77 w := hround(w_sharp *hppp);
78 b := hround(b_sharp *hppp);
79 h := hround(h_sharp *vppp);
80 d := hround(d_sharp *vppp);
86 def no_dimen_beginchar(expr c) =
88 charcode := if known c: byte c else: 0; fi;
93 scantokens extra_beginchar;
98 % we leave the ctrl characters alone.
102 % starts just as plain mf's beginchar:
106 % id index in lily's table
107 % texstr name of tex macro in lily's table and tex backend
109 % the dims are uninitialised; you should use set_char_box manually.
110 def fet_beginchar(expr name, id_lit, texstr_lit) =
111 save texstr, idstr, charnamestr;
116 string texstr, idstr, charnamestr;
117 texstr := texstr_lit;
121 no_dimen_beginchar(incr code) name;
125 def makebox_with_breapth(text r) =
126 for y = -d, 0, h: r((-b, y),(w,y)); endfor
127 for x = -b, 0, w: r((x, -d),(x, h)); endfor
131 % override plain endchar. We want a different box.
133 def breapth_endchar =
134 scantokens extra_endchar;
135 if proofing > 0: makebox_with_breapth(proofrule); fi
136 chardx := (w + b); %what the hack is chardx
142 autometric_output_char;