]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-beugel.mf
* lily/beam.cc (struct Int_set): typo.
[lilypond.git] / mf / feta-beugel.mf
1 input feta-autometric;
2 input feta-macros;
3 input feta-params;
4
5 fet_beginfont("feta-braces", 16);
6 mode_setup;
7
8 staffsize#:=16pt#;
9
10 save code;
11 code := -1;
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 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
23
24         save pendir, height, width, thin, thick, slt;
25         save penangle;
26         height# := height_sharp;
27         width# := width_sharp;
28         slt# := slt_sharp;
29
30 fet_beginchar("brace number "&(decimal code), "brace"&abc_encode_int(code),
31                 "brace"&abc_encode_int (code))
32
33         set_char_box (0, width#, height#/2, height#/2);
34           
35         define_pixels (height, width, slt);
36         thin = 2 slt;
37         thick = .5 width;
38         
39         z2 = .5 [z1, z3];
40         y3l = y1 + height/2;
41         x3 = x1 + width;
42         y1 =0;
43         x3 = - width / 2;
44
45         pair pendir;
46         pendir = unitvector(x3 - x1, y3l/6 - y1);
47         penangle = angle pendir - 90;
48         penpos3(thin, penangle);
49         penpos2(thick, angle(z3 -z1) -90 );
50         penpos1(2/3 thin, penangle);
51         
52         penlabels(1,2,3);
53         fill z2r ..  simple_serif (z3r, z3l, 90)
54                 .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
55
56         addto currentpicture also currentpicture yscaled -1;
57 fet_endchar;
58 enddef;
59
60
61
62 save stafflinethickness;
63 save increment;
64
65 stafflinethickness := 0.5pt#;
66 increment := 0.5pt#;
67 y := 10pt#;
68
69
70
71 for i := 0 step 1 until font_count:
72
73   %% We can't store more than 64 (65?) height dimensions in a TFM
74   %% file, so we make small files.
75
76   for j := 0 step 1 until 63:
77     % message "l: "&decimal l;
78     % note: define_pixels (x) multiplies x by hppp,
79     % must never get bigger than infinity
80     y := min (y + increment, infinity/hppp - 1);
81
82     % x should be about one staff space, taking brace to have
83     % default height of 3 staffs, this yields height / 3 / 4 = 12
84     % but 15 looks better
85     x := y / 15;
86
87     increment := x / 10;
88     stafflinethickness :=  min (0.5pt#, y/150);
89     if i = font_count:
90       draw_brace (y, x, stafflinethickness);
91     fi
92   endfor;
93 endfor
94   
95 fet_endfont("feta-braces");