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