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--2007 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 (`bbox' is called `glyph_dimensions' starting
129 % with version 2.4.2)
130 if known bp_per_pixel:
131 special "% MF2PT1: bbox "
136 special "% MF2PT1: glyph_dimensions "
141 special "% MF2PT1: font_size " & decimal designsize;
142 special "% MF2PT1: font_slant " & decimal font_slant_;
144 for fvar = "font_identifier",
145 "font_coding_scheme",
152 if known scantokens (fvar & "_"):
155 & scantokens (fvar & "_");
159 for fvar = "font_underline_position",
160 "font_underline_thickness":
161 if known scantokens (fvar & "_"):
164 & scantokens ("decimal " & fvar & "_");
168 special "% MF2PT1: font_fixed_pitch "
169 & (if font_fixed_pitch_: "1" else: "0" fi);
171 % this must come after the `font_size' special
172 special "% MF2PT1: charwd " & decimal charwd;
177 def no_dimen_beginchar (expr c) =
179 charcode := if known c: byte c else: 0; fi;
184 scantokens extra_beginchar;
189 % we leave the ctrl characters alone.
194 % starts just as plain mf's beginchar:
198 % id index in lily's table
200 % The dimensions are uninitialised; you should use set_char_box manually.
201 def fet_beginchar (expr name, id_lit) =
202 save idstr, charnamestr;
207 string idstr, charnamestr;
211 % addition for mf2pt1
212 if known bp_per_pixel:
214 special "% MF2PT1: glyph_name "
215 & feta_group & "." & idstr;
217 special "% MF2PT1: glyph_name " & idstr;
221 no_dimen_beginchar (incr code) name;
225 def makebox_with_breapth (text r) =
231 r ( (x, -d), (x, h));
237 % override plain endchar. We want a different box.
239 def breapth_endchar =
240 scantokens extra_endchar;
243 makebox_with_breapth (proofrule);
246 chardx := (w + b); % what the heck is chardx
253 autometric_output_char;