]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-haak.mf
2e8e83275ae6c7623786c3e2c973537eff66b77a
[lilypond.git] / mf / feta-haak.mf
1 % feta-haak.mf -- implement bracket tips -*-Fundamental-*-
2 %
3 % part of LilyPond's pretty-but-neat music font
4 %
5 % source file of the Feta (not the Font-En-Tja) music font
6 %
7 % (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
8
9 fet_begingroup ("brackettips");
10
11 def draw_bracket (expr thick_sharp, width_sharp, updown) =
12 begingroup;
13         save p, thin, thick, flattening, width, hair, flare;
14         path p;
15         pair tipdir;
16
17         flattening = 0.72;
18         thick# = thick_sharp;
19         flare# = flattening * width#;
20         width# = width_sharp;
21
22         define_pixels (thick, width, flare);
23         if updown = 1:
24                 set_char_box (0, width#,
25                               .5 thick#, flare#);
26         else:
27                 set_char_box (0, width#,
28                               flare#, .5 thick#);
29         fi;
30
31         thin = 2 linethickness;
32         hair = 1.25 linethickness;
33
34         pickup pencircle scaled thin;
35         y7 = y1;
36         x7 = x2;
37         z2 = z4r + (thin, 0);
38
39         penpos3 (thin, 0);
40         penpos4 (thin, 90);
41
42         z3 = z4;
43
44         top y3 = 0.5 thick;
45         lft x3 = 0.0;
46         x1 = x3l;
47         y1 = -0.5 thick;
48
49         z8 = .5 [z2, z7];
50         top y5 = flare;
51         rt x5 = width;
52
53         p := z8{right}
54              ..tension 1.2.. z5{curl 0};
55         tipdir := direction 1 of p;
56
57         penpos5 (hair, angle tipdir);
58         penpos6 (hair, 90 + angle tipdir);
59
60         z5 = z6;
61
62         pickup pencircle scaled 1;
63
64         fill (z1
65               -- z3l{up}
66               .. z4r{right}
67               -- z2{right}
68               .. z6r{tipdir}
69               .. z5r
70               .. z6l{-tipdir}
71               ..tension 1.1.. z7{left}
72               & z7
73               -- z1
74               & cycle) yscaled updown;
75
76         if updown = 1:
77                 penlabels (1, 2, 3, 4, 5, 6, 7, 8);
78         fi;
79 endgroup;
80 enddef;
81
82
83 fet_beginchar ("bracket tip up", "up");
84         draw_bracket (0.45 staff_space#, 1.9 staff_space#, 1);
85 fet_endchar;
86
87
88 fet_beginchar ("bracket tip down", "down");
89         draw_bracket (0.45 staff_space#, 1.9 staff_space#, -1);
90 fet_endchar;
91
92 fet_endgroup ("brackettips");