]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-beugel.mf
* mf/feta-bolletjes.mf: rewrite note head MF 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 font_coding_scheme "feta braces";
12
13 % we set the designsize arbitrarily at 10
14 % if the * 10 is left out, pktrace gets confused  over the proper magnification,
15 % and makes it too large.
16 fet_beginfont("feta-braces", font_count * 10);
17
18 mode_setup;
19
20
21
22 save code;
23 code := -1;
24
25
26 def abc_encode_int (expr i) =
27         if i > 0:
28                 abc_encode_int(i div 26)&char(65 + i mod 26)
29         else:
30                 "A"
31         fi
32 enddef ;
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 stafflinethickness := 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 := min (y + increment, infinity/hppp - 1);
94
95     % x should be about one staff space, taking brace to have
96     % default height of 3 staffs, this yields height / 3 / 4 = 12
97     % but 15 looks better
98     x := y / 15;
99
100     increment := x / 10;
101     stafflinethickness :=  min (0.5pt#, y/150);
102     if i = font_count:
103       draw_brace (y, x, stafflinethickness);
104     fi
105   endfor;
106 endfor
107   
108 fet_endfont("feta-braces");