% % autometric.mf -- administrative MF routines % % source file of the Feta (not an acronym for Font-En-Tja) % pretty-but-neat music font % % (c) 1997--2004 Han-Wen Nienhuys % Jan Nieuwenhuizen % % these macros help create ascii logging output % to automate generation of lily tables and tex backend % The output should be parsed by the mf-to-table script message "******************************************************"; message "Using feta Autometric macros. "; message "Do not worry about the @ signs in the output, they are not errors. "; message "******************************************************"; % font or database? def fet_beginfont(expr name,size,encod) = font_identifier:=name&decimal size; font_size size; font_coding_scheme encod; message "@{font@:GNU@:LilyPond@:"&name&"@:"&decimal size&"@:"&encod&"@}"; message ""; enddef; def fet_endfont = message "@{tnof@}"; enddef; % group or table? def fet_begingroup(expr name) = message "@{group@:"&name&"@}"; message ""; begingroup enddef; def fet_endgroup(expr name) = endgroup; message "@{puorg@:"&name&"@}"; message ""; enddef; def autometric_parameter (expr name, value) = message "@{parameter@:"&name&"@:"&decimal value&"@}"; enddef; def autometric_output_char= message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&decimal charwx&"@:"&decimal charwy&"@:"&idstr&"@}"; enddef; def hround_pixels(expr sharped) = hround(sharped * hppp) enddef; def vround_pixels(expr sharped) = vround(sharped * vppp) enddef; def tand(expr alpha) = (sind alpha/cosd alpha) enddef; %breapth, width, depth, height % breapth x-depth def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) = save scharbp, scharht, scharwd, schardp; % some paranoia if someone calls set_char_box(charwd, charbp, .. ) scharbp := b_sharp; scharht := h_sharp; schardp := d_sharp; scharwd := w_sharp; charbp := scharbp; charht := scharht; chardp := schardp; charwd := scharwd; w := hround(w_sharp *hppp); b := hround(b_sharp *hppp); h := hround(h_sharp *vppp); d := hround(d_sharp *vppp); charwx := charwd; charwy := 0; enddef; def no_dimen_beginchar(expr c) = begingroup charcode := if known c: byte c else: 0; fi; charic := 0; clearxy; clearit; clearpen; scantokens extra_beginchar; enddef; % % we leave the ctrl characters alone. % code:=32; % starts just as plain mf's beginchar: % charcode, % and then adds: % charname see below % id index in lily's table % the dims are uninitialised; you should use set_char_box manually. def fet_beginchar(expr name, id_lit) = save idstr, charnamestr; save charbp; save w,b,h,d; save charwx, charwy; string idstr, charnamestr; charnamestr := name; idstr := id_lit; no_dimen_beginchar(incr code) name; enddef; def makebox_with_breapth(text r) = for y = -d, 0, h: r((-b, y),(w,y)); endfor for x = -b, 0, w: r((x, -d),(x, h)); endfor enddef; % % override plain endchar. We want a different box. % def breapth_endchar = scantokens extra_endchar; if proofing > 0: makebox_with_breapth(proofrule); fi chardx := (w + b); %what the hack is chardx shipit; endgroup enddef; def fet_endchar= autometric_output_char; breapth_endchar; enddef;