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 "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 "asis";
27 message "@{font@:GNU@:LilyPond@:" & name
41 def fet_begingroup (expr name) =
48 message "@{group@:" & feta_group
54 def fet_endgroup (expr name) =
55 message "@{puorg@:" & name
62 def autometric_parameter (expr name, value) =
63 message "@{parameter@:" & name
64 & "@:" & decimal value
69 def autometric_output_char =
70 message "@{char@:" & charnamestr
71 & "@:" & decimal charcode
72 & "@:" & decimal charbp
73 & "@:" & decimal charwd
74 & "@:" & decimal chardp
75 & "@:" & decimal charht
76 & "@:" & decimal charwx
77 & "@:" & decimal charwy
83 def hround_pixels (expr sharped) =
84 hround (sharped * hppp)
88 def vround_pixels (expr sharped) =
89 vround (sharped * vppp)
93 def tand (expr alpha) =
94 (sind alpha / cosd alpha)
98 def to_bp (expr num) =
99 decimal (num * bp_per_pixel)
103 % breapth, width, depth, height
105 def set_char_box (expr b_sharp, w_sharp, d_sharp, h_sharp) =
106 save scharbp, scharht, scharwd, schardp;
108 % some paranoia if someone calls set_char_box (charwd, charbp, ...)
119 w := hround (w_sharp * hppp);
120 b := hround (b_sharp * hppp);
121 h := vround (h_sharp * vppp);
122 d := vround (d_sharp * vppp);
127 % additions for mf2pt1
128 if known bp_per_pixel:
129 special "% MF2PT1: bbox "
134 special "% MF2PT1: font_size " & decimal designsize;
135 special "% MF2PT1: font_slant " & decimal font_slant_;
137 for fvar = "font_identifier",
138 "font_coding_scheme",
145 if known scantokens (fvar & "_"):
148 & scantokens (fvar & "_");
152 for fvar = "font_underline_position",
153 "font_underline_thickness":
154 if known scantokens (fvar & "_"):
157 & scantokens ("decimal " & fvar & "_");
161 special "% MF2PT1: font_fixed_pitch "
162 & (if font_fixed_pitch_: "1" else: "0" fi);
164 % this must come after the `font_size' special
165 special "% MF2PT1: charwd " & decimal charwd;
170 def no_dimen_beginchar (expr c) =
172 charcode := if known c: byte c else: 0; fi;
177 scantokens extra_beginchar;
182 % we leave the ctrl characters alone.
187 % starts just as plain mf's beginchar:
191 % id index in lily's table
193 % The dimensions are uninitialised; you should use set_char_box manually.
194 def fet_beginchar (expr name, id_lit) =
195 save idstr, charnamestr;
200 string idstr, charnamestr;
204 % addition for mf2pt1
205 if known bp_per_pixel:
207 special "% MF2PT1: glyph_name "
208 & feta_group & "." & idstr;
210 special "% MF2PT1: glyph_name " & idstr;
214 no_dimen_beginchar (incr code) name;
218 def makebox_with_breapth (text r) =
224 r ( (x, -d), (x, h));
230 % override plain endchar. We want a different box.
232 def breapth_endchar =
233 scantokens extra_endchar;
236 makebox_with_breapth (proofrule);
239 chardx := (w + b); % what the heck is chardx
246 autometric_output_char;