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");
15 % Setup 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 OPEN_PATH
19 def set_arrow_paths (expr width, height, open_tension, arrowlinethickness) =
21 tip_angle_o, tip_angle_c, tip_dir_c, tip_dir_o,
23 path pat, open_path, close_path;
24 pair tip_dir_o, tip_dir_c;
26 pickup pencircle scaled arrowlinethickness;
28 indent = linethickness/2;
39 pat := z1 .. tension open_tension .. z2{right};
41 penpos2 (arrowlinethickness, 90);
42 tip_dir_o := direction 0.0 of pat;
43 tip_angle_o := angle (tip_dir_o);
44 penpos1 (arrowlinethickness, 90 + tip_angle_o);
46 penpos3 (arrowlinethickness, tip_angle_o);
48 open_path := z1r{tip_dir_o} .. z2r{right}
49 .. z2l{left} .. z1l{-tip_dir_o} .. z3l .. cycle;
51 pat := z4 .. z5{down};
52 tip_dir_c := direction 0.0 of pat;
53 tip_angle_c := angle (tip_dir_c);
54 penpos4 (arrowlinethickness, 90+ tip_angle_c);
55 penpos5 (arrowlinethickness, 0);
57 penpos6 (arrowlinethickness, 90);
59 close_path := z4l{tip_dir_c} .. z5l{down} .. z6l{right}
60 .. z2l{right} .. z2r{left}
61 .. tension open_tension
68 fet_beginchar ("open", "open.01");
69 set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
70 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
72 addto currentpicture also currentpicture yscaled -1;
77 fet_beginchar ("open", "open.0M1");
78 set_char_box (0, staff_space#, 0.5 staff_space#, 0.5 staff_space#);
79 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
81 addto currentpicture also currentpicture yscaled -1;
82 currentpicture := currentpicture xscaled -1;
85 fet_beginchar ("open", "open.11");
86 set_char_box (.5 staff_space#, .5 staff_space#,
87 1.0 staff_space#, 0.0 staff_space#);
88 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
90 addto currentpicture also currentpicture yscaled -1;
91 currentpicture := currentpicture rotated 90;
94 fet_beginchar ("open", "open.1M1");
95 set_char_box (.5 staff_space#, .5 staff_space#,
96 0.0 staff_space#, 1.0 staff_space#);
97 set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
99 addto currentpicture also currentpicture yscaled -1;
100 currentpicture := currentpicture rotated 90;
101 currentpicture := currentpicture yscaled -1;
106 fet_beginchar ("close", "close.01");
107 set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
108 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
110 addto currentpicture also currentpicture yscaled -1;
112 fet_beginchar ("close", "close.0M1");
113 set_char_box (0, staff_space#, 0.5 staff_space#, 0.5 staff_space#);
114 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
116 addto currentpicture also currentpicture yscaled -1;
117 currentpicture := currentpicture xscaled -1;
120 fet_beginchar ("close", "close.11");
121 set_char_box (.5 staff_space#, .5 staff_space# ,
122 1.0 staff_space#, 0.0 staff_space#);
123 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
125 addto currentpicture also currentpicture yscaled -1;
126 currentpicture := currentpicture rotated 90;
129 fet_beginchar ("close", "close.1M1");
130 set_char_box (.5 staff_space#, .5 staff_space# ,
131 0.0 staff_space#, 1.0 staff_space#);
132 set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
134 addto currentpicture also currentpicture yscaled -1;
135 currentpicture := currentpicture rotated -90;
139 fet_endgroup ("arrowheads");