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