]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-beugel.mf
* scm/output-tex.scm (text): remove debugging code.
[lilypond.git] / mf / feta-beugel.mf
1
2
3 input feta-autometric;
4 input feta-macros;
5
6 staffsize#  := 20 pt#;  %% arbitrary.
7
8
9 input feta-params;
10
11
12 def abc_encode_int (expr i) =
13         if i > 0:
14                 abc_encode_int(i div 26)&char(65 + i mod 26)
15         else:
16                 "A"
17         fi
18 enddef ;
19
20 % we must let the design increase for each
21 % font to make sure that mftrace doesn't jack up the resolution too highly
22 % for the longer braces.
23 fet_beginfont("feta-braces-" &char(97 + font_count), (font_count + 1)* 15,
24                 "fetaBraces");
25
26 mode_setup;
27
28
29
30 save code;
31 code := -1;
32
33
34 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
35
36         save pendir, height, width, thin, thick, slt;
37         save penangle;
38         height# := height_sharp;
39         width# := width_sharp;
40         slt# := slt_sharp;
41
42 %% +1  is needed because fet_beginchar increments after dumping the strings.
43 fet_beginchar("brace number "&(decimal (code + 1)), "brace"&abc_encode_int(code+1),
44                 "brace"&abc_encode_int (code+1))
45
46         set_char_box (0, width#, height#/2, height#/2);
47           
48         define_pixels (height, width, slt);
49         thin = 2 slt;
50         thick = .5 width;
51         
52         z2 = .5 [z1, z3];
53         y3l = y1 + height/2;
54         x3 = x1 + width;
55         y1 =0;
56         x3 = - width / 2;
57
58         pair pendir;
59         pendir = unitvector(x3 - x1, y3l/6 - y1);
60         penangle = angle pendir - 90;
61         penpos3(thin, penangle);
62         penpos2(thick, angle(z3 -z1) -90 );
63         penpos1(2/3 thin, penangle);
64         
65         penlabels(1,2,3);
66         fill z2r ..  simple_serif (z3r, z3l, 90)
67                 .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
68
69         addto currentpicture also currentpicture yscaled -1;
70 fet_endchar;
71 enddef;
72
73
74
75 save stafflinethickness;
76 save increment;
77
78 linethickness := 0.5pt#;
79 increment := 0.5pt#;
80 y := 10pt#;
81
82
83
84 for i := 0 step 1 until font_count:
85
86   %% We can't store more than 64 (65?) height dimensions in a TFM
87   %% file, so we make small files.
88
89   for j := 0 step 1 until 63:
90     % message "l: "&decimal l;
91     % note: define_pixels (x) multiplies x by hppp,
92     % must never get bigger than infinity
93     y := y + increment;
94
95     if y > infinity/hppp:
96       message "Resolution and/or magnification is too high";
97       error please report: <bug-lilypond@gnu.org>;
98     fi
99
100     % x should be about one staff space, taking brace to have
101     % default height of 3 staffs, this yields height / 3 / 4 = 12
102     % but 15 looks better
103     x := y / 15;
104
105     increment := x / 10;
106     linethickness :=  min (0.5pt#, y/150);
107     if i = font_count:
108       draw_brace (y, x, linethickness);
109     fi
110   endfor;
111 endfor
112   
113 fet_endfont("feta-braces");