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