]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-autometric.mf
release: 0.1.39
[lilypond.git] / mf / feta-autometric.mf
1
2 % autometric.mf -- administrative MF routines
3
4 % source file of the Feta (Font-En-Tja) pretty-but-neat music font
5
6 % (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 %          Jan Nieuwenhuizen <jan@digicash.com>
8
9 % these macros help create ascii logging output
10 % to automate generation of lily tables and tex backend
11 % The output should be parsed by the mf-to-table script
12
13 % font or database?
14 def fet_beginfont(expr name,size) =
15         font_identifier:=name&decimal size;
16         font_size size;
17         message "@{font@:"&name&"@:"&decimal size&"@}";
18         message "";
19         enddef;
20
21 def fet_endfont(expr name) =
22         message "@{tnof@:"&name&"@}";
23         message "";
24         enddef;
25
26 % group or table?
27 def fet_begingroup(expr name) =
28         message "@{group@:"&name&"@}";
29         message "";
30         begingroup
31 enddef;
32
33 def fet_endgroup(expr name) =
34         endgroup;
35         message "@{puorg@:"&name&"@}";
36         message "";
37 enddef;
38
39 def autometric_output_char=
40         message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&idstr&"@:"&texstr&"@}";
41 enddef;
42
43 def hround_pixels(expr sharped) = hround(sharped * hppp) enddef;
44 def vround_pixels(expr sharped) = vround(sharped * vppp) enddef;
45
46
47
48 def tand(expr alpha) = 
49         (sind alpha/cosd alpha)
50         enddef;
51
52 %breapth, width, depth, height
53 %     breapth   x-depth
54 def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) = 
55         save scharbp, scharht, scharwd, schardp;
56
57         % some paranoia if someone calls set_char_box(charwd, charbp, .. )
58         scharbp := b_sharp;
59         scharht := h_sharp;
60         schardp := d_sharp;
61         scharwd := w_sharp;
62
63         charbp := scharbp;
64         charht := scharht;
65         chardp := schardp;
66         charwd := scharwd;
67
68         w := hround(w_sharp *hppp);
69         b := hround(b_sharp *hppp);
70         h := hround(h_sharp *vppp);
71         d := hround(d_sharp *vppp);
72 enddef;
73
74 def no_dimen_beginchar(expr c) =
75         begingroup
76         charcode := if known c: byte c else: 0; fi;
77         charic := 0;
78         clearxy;
79         clearit;
80         clearpen;
81         scantokens extra_beginchar;
82 enddef;
83
84 code:=-1;
85
86 % starts just as plain mf's beginchar:
87 %     charcode, 
88 % and then adds:
89 %     charname  see below
90 %     id        index in lily's table
91 %     texstr    name of tex macro in lily's table and tex backend
92
93 % the dims are uninitialised; you should use set_char_box manually.
94 def fet_beginchar(expr name, id_lit, texstr_lit) =
95         save texstr, idstr, charnamestr;
96         save charbp;
97         save w,b,h,d;
98         string texstr, idstr, charnamestr;
99         texstr := texstr_lit;
100         charnamestr := name;
101         idstr := id_lit;
102
103         no_dimen_beginchar(incr code) name;
104         enddef;
105
106
107 def makebox_with_breapth(text r) = 
108         for y = -d, 0, h: r((-b, y),(w,y)); endfor
109         for x = -b, 0, w: r((x, -d),(x, h)); endfor
110 enddef;
111
112 %
113 % override plain endchar.  We want a different box. 
114 %
115 def breapth_endchar =
116         scantokens extra_endchar;
117         if proofing > 0: makebox_with_breapth(proofrule); fi
118         chardx := 10*(w + b);
119         shipit;
120         endgroup
121 enddef;
122
123 def fet_endchar=
124         autometric_output_char;
125         breapth_endchar;
126         enddef;