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--2006 Han-Wen Nienhuys <hanwen@xs4all.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 "order of messages: ";
18 message " NAME/CODE/BP/WD/DP/HT/WX/WY";
19 message "******************************************************";
24 def fet_beginfont (expr name, size, encod) =
25 font_identifier := name & decimal size;
27 font_coding_scheme "asis";
28 message "@{font@:GNU@:LilyPond@:" & name
42 def fet_begingroup (expr name) =
49 message "@{group@:" & feta_group
55 def fet_endgroup (expr name) =
56 message "@{puorg@:" & name
63 def autometric_parameter (expr name, value) =
64 message "@{parameter@:" & name
65 & "@:" & decimal value
70 def autometric_output_char =
71 message "@{char@:" & charnamestr
72 & "@:" & decimal charcode
73 & "@:" & decimal charbp
74 & "@:" & decimal charwd
75 & "@:" & decimal chardp
76 & "@:" & decimal charht
77 & "@:" & decimal charwx
78 & "@:" & decimal charwy
84 def hround_pixels (expr sharped) =
85 hround (sharped * hppp)
89 def vround_pixels (expr sharped) =
90 vround (sharped * vppp)
94 def tand (expr alpha) =
95 (sind alpha / cosd alpha)
99 def to_bp (expr num) =
100 decimal (num * bp_per_pixel)
104 % breapth, width, depth, height
106 def set_char_box (expr b_sharp, w_sharp, d_sharp, h_sharp) =
107 save scharbp, scharht, scharwd, schardp;
109 % some paranoia if someone calls set_char_box (charwd, charbp, ...)
120 w := hround (w_sharp * hppp);
121 b := hround (b_sharp * hppp);
122 h := vround (h_sharp * vppp);
123 d := vround (d_sharp * vppp);
128 % additions for mf2pt1
129 if known bp_per_pixel:
130 special "% MF2PT1: bbox "
135 special "% MF2PT1: font_size " & decimal designsize;
136 special "% MF2PT1: font_slant " & decimal font_slant_;
138 for fvar = "font_identifier",
139 "font_coding_scheme",
146 if known scantokens (fvar & "_"):
149 & scantokens (fvar & "_");
153 for fvar = "font_underline_position",
154 "font_underline_thickness":
155 if known scantokens (fvar & "_"):
158 & scantokens ("decimal " & fvar & "_");
162 special "% MF2PT1: font_fixed_pitch "
163 & (if font_fixed_pitch_: "1" else: "0" fi);
165 % this must come after the `font_size' special
166 special "% MF2PT1: charwd " & decimal charwd;
171 def no_dimen_beginchar (expr c) =
173 charcode := if known c: byte c else: 0; fi;
178 scantokens extra_beginchar;
183 % we leave the ctrl characters alone.
188 % starts just as plain mf's beginchar:
192 % id index in lily's table
194 % The dimensions are uninitialised; you should use set_char_box manually.
195 def fet_beginchar (expr name, id_lit) =
196 save idstr, charnamestr;
201 string idstr, charnamestr;
205 % addition for mf2pt1
206 if known bp_per_pixel:
208 special "% MF2PT1: glyph_name "
209 & feta_group & "." & idstr;
211 special "% MF2PT1: glyph_name " & idstr;
215 no_dimen_beginchar (incr code) name;
219 def makebox_with_breapth (text r) =
225 r ( (x, -d), (x, h));
231 % override plain endchar. We want a different box.
233 def breapth_endchar =
234 scantokens extra_endchar;
237 makebox_with_breapth (proofrule);
240 chardx := (w + b); % what the heck is chardx
247 autometric_output_char;