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
15 message "******************************************************";
16 message "Using feta Autometric macros.";
17 message "Do not worry about the @ signs in the output, they are not errors.";
18 message "******************************************************";
23 def fet_beginfont (expr name, size, encod) =
24 font_identifier := name & decimal size;
26 font_coding_scheme encod;
27 message "@{font@:GNU@:LilyPond@:" & name
41 def fet_begingroup (expr name) =
42 message "@{group@:" & name
49 def fet_endgroup (expr name) =
51 message "@{puorg@:" & name
57 def autometric_parameter (expr name, value) =
58 message "@{parameter@:" & name
59 & "@:" & decimal value
64 def autometric_output_char=
65 message "@{char@:" & charnamestr
66 & "@:" & decimal charcode
67 & "@:" & decimal charbp
68 & "@:" & decimal charwd
69 & "@:" & decimal chardp
70 & "@:" & decimal charht
71 & "@:" & decimal charwx
72 & "@:" & decimal charwy
78 def hround_pixels (expr sharped) =
79 hround (sharped * hppp)
83 def vround_pixels (expr sharped) =
84 vround (sharped * vppp)
88 def tand (expr alpha) =
89 (sind alpha / cosd alpha)
93 def to_bp (expr num) =
94 decimal (num * bp_per_pixel)
98 % breapth, width, depth, height
100 def set_char_box (expr b_sharp, w_sharp, d_sharp, h_sharp) =
101 save scharbp, scharht, scharwd, schardp;
103 % some paranoia if someone calls set_char_box (charwd, charbp, ...)
114 w := hround (w_sharp * hppp);
115 b := hround (b_sharp * hppp);
116 h := vround (h_sharp * vppp);
117 d := vround (d_sharp * vppp);
122 % additions for mf2pt1
123 if known bp_per_pixel:
124 special "% MF2PT1: bbox "
129 special "% MF2PT1: font_size " & decimal designsize;
130 special "% MF2PT1: font_slant " & decimal font_slant_;
132 for fvar = "font_identifier",
133 "font_coding_scheme",
140 if known scantokens (fvar & "_"):
143 & scantokens (fvar & "_");
147 for fvar = "font_underline_position",
148 "font_underline_thickness":
149 if known scantokens (fvar & "_"):
152 & scantokens ("decimal " & fvar & "_");
156 special "% MF2PT1: font_fixed_pitch "
157 & (if font_fixed_pitch_: "1" else: "0" fi);
159 % this must come after the `font_size' special
160 special "% MF2PT1: charwd " & decimal charwd;
165 def no_dimen_beginchar (expr c) =
167 charcode := if known c: byte c else: 0; fi;
172 scantokens extra_beginchar;
177 % we leave the ctrl characters alone.
182 % starts just as plain mf's beginchar:
186 % id index in lily's table
188 % The dimensions are uninitialised; you should use set_char_box manually.
189 def fet_beginchar (expr name, id_lit) =
190 save idstr, charnamestr;
195 string idstr, charnamestr;
199 no_dimen_beginchar (incr code) name;
203 def makebox_with_breapth (text r) =
209 r ( (x, -d), (x, h));
215 % override plain endchar. We want a different box.
217 def breapth_endchar =
218 scantokens extra_endchar;
221 makebox_with_breapth (proofrule);
224 chardx := (w + b); % what the heck is chardx
231 autometric_output_char;