]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-arrow.mf
Run `make grand-replace'.
[lilypond.git] / mf / feta-arrow.mf
1 %
2 % feta-arrow.mf -- draw arrow heads
3 %
4 % source file of the GNU LilyPond music typesetter
5 %
6 % (c) 2005--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 fet_begingroup ("arrowheads");
9
10 %
11 % To consider: we could put arrow heads at their real Unicode locations.
12 %
13
14 %
15 % Set up paths for upper half of arrow head pointing right.
16 % CLOSE_PATH is for a closed arrow, OPEN_PATH is for the open arrow.
17 % OPEN_TENSION sets the tension for the part which forms the path in
18 % OPEN_PATH.
19 %
20
21 def set_arrow_paths (expr width, height, open_tension, arrowlinethickness) =
22         save pat, finalpath;
23         save tip_angle_o, tip_angle_c, tip_dir_c, tip_dir_o;
24         save indent;
25         path pat, open_path, close_path;
26         pair tip_dir_o, tip_dir_c;
27
28         pickup pencircle scaled arrowlinethickness;
29
30         indent = linethickness / 2;
31
32         lft x1 = -width;
33         x2 = 0;
34         top y1 = height;
35         y2 = 0;
36
37         z4 = z3;
38         y5 = 0;
39         x5 = x4 + indent;
40
41         pat := z1
42                ..tension open_tension.. z2{right};
43         penpos2 (arrowlinethickness, 90);
44         tip_dir_o := direction 0.0 of pat;
45         tip_angle_o := angle (tip_dir_o);
46         penpos1 (arrowlinethickness, 90 + tip_angle_o);
47         z3 = z1;
48         penpos3 (arrowlinethickness, tip_angle_o);
49
50         open_path := z1r{tip_dir_o}
51                      .. z2r{right}
52                      .. z2l{left}
53                      .. z1l{-tip_dir_o}
54                      .. z3l
55                      .. cycle;
56
57         pat := z4
58                .. z5{down};
59         tip_dir_c := direction 0.0 of pat;
60         tip_angle_c := angle (tip_dir_c);
61         penpos4 (arrowlinethickness, 90+ tip_angle_c);
62         penpos5 (arrowlinethickness, 0);
63         z6 = z5;
64         penpos6 (arrowlinethickness, 90);
65
66         close_path := z4l{tip_dir_c}
67                       .. z5l{down}
68                       .. z6l{right}
69                       .. z2l{right}
70                       .. z2r{left}
71                       ..tension open_tension.. z1r{-tip_dir_o}
72                       .. z3l
73                       .. cycle;
74 enddef;
75
76
77 fet_beginchar ("open", "open.01");
78         set_char_box (staff_space#, 1.6 linethickness# / 2,
79                       0.5 staff_space#, 0.5 staff_space#);
80         set_arrow_paths (staff_space, 0.5 staff_space,
81                          1.0, 1.6 linethickness);
82         fill open_path;
83         open_path := open_path yscaled -1;
84         fill open_path;
85
86         penlabels (1, 2, 3);
87         penlabels (4, 5, 6);
88 fet_endchar;
89
90
91 fet_beginchar ("open", "open.0M1");
92         set_char_box (1.6 linethickness# / 2, staff_space#,
93                       0.5 staff_space#, 0.5 staff_space#);
94         set_arrow_paths (staff_space, 0.5 staff_space,
95                          1.0, 1.6 linethickness);
96         fill open_path;
97         open_path := open_path yscaled -1;
98         fill open_path;
99         currentpicture := currentpicture xscaled -1;
100 fet_endchar;
101
102
103 fet_beginchar ("open", "open.11");
104         set_char_box (.5 staff_space#, .5 staff_space#,
105                       1.0 staff_space#, 1.6 linethickness# / 2);
106         set_arrow_paths (staff_space, 0.5 staff_space,
107                          1.0, 1.6 linethickness);
108         fill open_path;
109         open_path := open_path yscaled -1;
110         fill open_path;
111         currentpicture := currentpicture rotated 90;
112 fet_endchar;
113
114
115 fet_beginchar ("open", "open.1M1");
116         set_char_box (.5 staff_space#, .5 staff_space#,
117                       1.6 linethickness# / 2, 1.0 staff_space#);
118         set_arrow_paths (staff_space, 0.5 staff_space,
119                          1.0, 1.6 linethickness);
120         fill open_path;
121         open_path := open_path yscaled -1;
122         fill open_path;
123         currentpicture := currentpicture rotated 90;
124         currentpicture := currentpicture yscaled -1;
125 fet_endchar;
126
127
128 fet_beginchar ("close", "close.01");
129         set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
130         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
131         fill close_path;
132         close_path := close_path yscaled -1;
133         fill close_path;
134 fet_endchar;
135
136
137 fet_beginchar ("close", "close.0M1");
138         set_char_box (0, staff_space#,  0.5 staff_space#, 0.5 staff_space#);
139         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
140         fill close_path;
141         close_path := close_path yscaled -1;
142         fill close_path;
143         currentpicture := currentpicture xscaled -1;
144 fet_endchar;
145
146
147 fet_beginchar ("close", "close.11");
148         set_char_box (.5 staff_space#, .5 staff_space#,
149                       1.0 staff_space#, 0.0 staff_space#);
150         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
151         fill close_path;
152         close_path := close_path yscaled -1;
153         fill close_path;
154         currentpicture := currentpicture rotated 90;
155 fet_endchar;
156
157
158 fet_beginchar ("close", "close.1M1");
159         set_char_box (.5 staff_space#, .5 staff_space#,
160                       0.0 staff_space#, 1.0 staff_space#);
161         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
162         fill close_path;
163         close_path := close_path yscaled -1;
164         fill close_path;
165         currentpicture := currentpicture rotated -90;
166 fet_endchar;
167
168
169 fet_endgroup ("arrowheads");