1 % Feta (not the Font-En-Tja) music font -- administrative MF routines
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 % Jan Nieuwenhuizen <janneke@gnu.org>
7 % These macros help create ascii logging output
8 % to automate generation of the lily tables.
9 % The output should be parsed by the mf-to-table script.
11 % LilyPond is free software: you can redistribute it and/or modify
12 % it under the terms of the GNU General Public License as published by
13 % the Free Software Foundation, either version 3 of the License, or
14 % (at your option) any later version.
16 % LilyPond is distributed in the hope that it will be useful,
17 % but WITHOUT ANY WARRANTY; without even the implied warranty of
18 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 % GNU General Public License for more details.
21 % You should have received a copy of the GNU General Public License
22 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
25 message "******************************************************";
26 message "Using feta Autometric macros.";
27 message "order of messages: ";
28 message " NAME/CODE/BP/WD/DP/HT/WX/WY";
29 message "******************************************************";
34 def fet_beginfont (expr name, size, encod) =
35 font_identifier := name & decimal size;
37 font_coding_scheme "asis";
38 message "@{font@:GNU@:LilyPond@:" & name
52 def fet_begingroup (expr name) =
59 message "@{group@:" & feta_group
65 def fet_endgroup (expr name) =
66 message "@{puorg@:" & name
73 def autometric_parameter (expr name, value) =
74 message "@{parameter@:" & name
75 & "@:" & decimal value
80 def autometric_output_char =
81 message "@{char@:" & charnamestr
82 & "@:" & decimal charcode
83 & "@:" & decimal charbp
84 & "@:" & decimal charwd
85 & "@:" & decimal chardp
86 & "@:" & decimal charht
87 & "@:" & decimal charwx
88 & "@:" & decimal charwy
94 def hround_pixels (expr sharped) =
95 hround (sharped * hppp)
99 def vround_pixels (expr sharped) =
100 vround (sharped * vppp)
104 def tand (expr alpha) =
105 (sind alpha / cosd alpha)
109 def to_bp (expr num) =
110 decimal (num * bp_per_pixel)
114 % breapth, width, depth, height
116 def set_char_box (expr b_sharp, w_sharp, d_sharp, h_sharp) =
117 save scharbp, scharht, scharwd, schardp;
119 % some paranoia if someone calls set_char_box (charwd, charbp, ...)
130 w := hround (w_sharp * hppp);
131 b := hround (b_sharp * hppp);
132 h := vround (h_sharp * vppp);
133 d := vround (d_sharp * vppp);
138 % additions for mf2pt1 (`bbox' is called `glyph_dimensions' starting
139 % with version 2.4.2)
140 if known bp_per_pixel:
141 special "% MF2PT1: bbox "
146 special "% MF2PT1: glyph_dimensions "
151 special "% MF2PT1: font_size " & decimal designsize;
152 special "% MF2PT1: font_slant " & decimal font_slant_;
154 for fvar = "font_identifier",
155 "font_coding_scheme",
162 if known scantokens (fvar & "_"):
165 & scantokens (fvar & "_");
169 for fvar = "font_underline_position",
170 "font_underline_thickness":
171 if known scantokens (fvar & "_"):
174 & scantokens ("decimal " & fvar & "_");
178 special "% MF2PT1: font_fixed_pitch "
179 & (if font_fixed_pitch_: "1" else: "0" fi);
181 % this must come after the `font_size' special
182 special "% MF2PT1: charwd " & decimal charwd;
187 def no_dimen_beginchar (expr c) =
189 charcode := if known c: byte c else: 0; fi;
194 scantokens extra_beginchar;
199 % we leave the ctrl characters alone
204 % starts just as plain mf's beginchar:
208 % id index in lily's table
210 % The dimensions are uninitialised; you should use set_char_box manually.
211 def fet_beginchar (expr name, id_lit) =
212 save idstr, charnamestr;
217 string idstr, charnamestr;
221 % addition for mf2pt1
222 if known bp_per_pixel:
224 special "% MF2PT1: glyph_name "
225 & feta_group & "." & idstr;
227 special "% MF2PT1: glyph_name " & idstr;
231 no_dimen_beginchar (incr code) name;
235 def makebox_with_breapth (text r) =
241 r ( (x, -d), (x, h));
247 % override plain endchar. We want a different box.
249 def breapth_endchar =
250 scantokens extra_endchar;
253 makebox_with_breapth (proofrule);
256 chardx := (w + b); % what the heck is chardx
263 autometric_output_char;