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