2 % feta-arrow.mf -- draw arrow heads
4 % source file of the GNU LilyPond music typesetter
6 % (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 fet_begingroup ("arrowheads");
14 % To consider: we could put arrow heads at their real Unicode locations.
18 % Setup paths for upper half of arrow head pointing right.
19 % CLOSE_PATH is for a closed arrow, OPEN_PATH is for the open arrow
20 % OPEN_TENSION sets the tension for the part which forms the path in OPEN_PATH
22 def set_arrow_paths (expr width, height, open_tension, arrowlinethickness) =
24 tip_angle_o, tip_angle_c, tip_dir_c, tip_dir_o,
26 path pat, open_path, close_path;
27 pair tip_dir_o, tip_dir_c;
29 pickup pencircle scaled arrowlinethickness;
31 indent = linethickness/2;
42 pat := z1 .. tension open_tension .. z2{right};
44 penpos2 (arrowlinethickness, 90);
45 tip_dir_o := direction 0.0 of pat;
46 tip_angle_o := angle (tip_dir_o);
47 penpos1 (arrowlinethickness, 90 + tip_angle_o);
49 penpos3 (arrowlinethickness, tip_angle_o);
51 open_path := z1r{tip_dir_o} .. z2r{right}
52 .. z2l{left} .. z1l{-tip_dir_o} .. z3l .. cycle;
54 pat := z4 .. z5{down};
55 tip_dir_c := direction 0.0 of pat;
56 tip_angle_c := angle (tip_dir_c);
57 penpos4 (arrowlinethickness, 90+ tip_angle_c);
58 penpos5 (arrowlinethickness, 0);
60 penpos6 (arrowlinethickness, 90);
62 close_path := z4l{tip_dir_c} .. z5l{down} .. z6l{right}
63 .. z2l{right} .. z2r{left}
64 .. tension open_tension
71 fet_beginchar ("open", "open.01");
72 set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
73 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
75 addto currentpicture also currentpicture yscaled -1;
80 fet_beginchar ("open", "open.0M1");
81 set_char_box (0, staff_space#, 0.5 staff_space#, 0.5 staff_space#);
82 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
84 addto currentpicture also currentpicture yscaled -1;
85 currentpicture := currentpicture xscaled -1;
88 fet_beginchar ("open", "open.11");
89 set_char_box (.5 staff_space#, .5 staff_space#,
90 1.0 staff_space#, 0.0 staff_space#);
91 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
93 addto currentpicture also currentpicture yscaled -1;
94 currentpicture := currentpicture rotated 90;
97 fet_beginchar ("open", "open.1M1");
98 set_char_box (.5 staff_space#, .5 staff_space#,
99 0.0 staff_space#, 1.0 staff_space#);
100 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
102 addto currentpicture also currentpicture yscaled -1;
103 currentpicture := currentpicture rotated 90;
104 currentpicture := currentpicture yscaled -1;
109 fet_beginchar ("close", "close.01");
110 set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
111 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
113 addto currentpicture also currentpicture yscaled -1;
115 fet_beginchar ("close", "close.0M1");
116 set_char_box (0, staff_space#, 0.5 staff_space#, 0.5 staff_space#);
117 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
119 addto currentpicture also currentpicture yscaled -1;
120 currentpicture := currentpicture xscaled -1;
123 fet_beginchar ("close", "close.11");
124 set_char_box (.5 staff_space#, .5 staff_space# ,
125 1.0 staff_space#, 0.0 staff_space#);
126 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
128 addto currentpicture also currentpicture yscaled -1;
129 currentpicture := currentpicture rotated 90;
132 fet_beginchar ("close", "close.1M1");
133 set_char_box (.5 staff_space#, .5 staff_space# ,
134 0.0 staff_space#, 1.0 staff_space#);
135 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
137 addto currentpicture also currentpicture yscaled -1;
138 currentpicture := currentpicture rotated -90;
142 fet_endgroup ("arrowheads");