1% Feta (not the Font-En-Tja) music font -- Accidentals 2% This file is part of LilyPond, the GNU music typesetter. 3% 4% Copyright (C) 2005--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> 5% 6% The LilyPond font is free software: you can redistribute it and/or modify 7% it under the terms of the GNU General Public License as published by 8% the Free Software Foundation, either version 3 of the License, or 9% (at your option) any later version, or you can redistribute it under 10% the SIL Open Font License. 11% 12% LilyPond is distributed in the hope that it will be useful, 13% but WITHOUT ANY WARRANTY; without even the implied warranty of 14% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15% GNU General Public License for more details. 16% 17% You should have received a copy of the GNU General Public License 18% along with LilyPond. If not, see <http://www.gnu.org/licenses/>. 19 20 21% 22% Draw an arrow 23% 24% * `stemslant' gives the direction of the stem's left boundary 25% (needed for brushed stems, equals "up" for straight stems) 26% * `extend' is used to make the stem longer or shorter (if negative); 27% different kinds of accidentals need different values here 28% 29def draw_arrow (expr attach, stemwidth, stemslant, extend, pointingdown) = 30 begingroup; 31 save htip; % tip height 32 save wwing; % wing `radius' 33 save angle_wing_bot, angle_wing_top, angle_tip; 34 save upshift; 35 clearxy; 36 37 wwing := 0.26 stemwidth; 38 htip := staff_space * 0.85 + stafflinethickness - wwing; 39 40 % `flip' is used to reflect the arrow vertically 41 % if arrow points downward 42 transform flip; 43 if pointingdown: 44 flip = identity reflectedabout (origin, right); 45 else: 46 flip = identity; 47 fi; 48 49 z1 = attach shifted (-stemwidth / 2, 0); 50 upshift := max (0, wwing + 0.1 staff_space + extend); 51 z2 = z1 shifted (((unitvector stemslant) 52 scaled upshift) transformed flip); 53 54 z7 = attach shifted ((stemwidth/2),0); 55 z6 = z7 shifted (((unitvector (-xpart stemslant, ypart stemslant)) 56 scaled upshift) transformed flip); 57 z2 - z3 = ( 0.38 staff_space, 0.05 htip) transformed flip; 58 z6 - z5 = (-0.38 staff_space, 0.05 htip) transformed flip; 59 60 z4 = attach shifted ((-0.2 stemwidth, upshift + htip) transformed flip); 61 z4'= attach shifted (( 0.2 stemwidth, upshift + htip) transformed flip); 62 63 % `angle_wing_bot' is the angle at which the arc 64 % from z2 to z3a enters z3a 65 % `angle_wing_top' is the angle at which the arc 66 % from z3b to z4 leaves z3b 67 % `angle_tip' is the angle at which the arc 68 % from z4 to z4' leaves z4 69 angle_wing_bot = 30; 70 angle_wing_top = 55; 71 angle_tip = 68; 72 73 z3a = z3 shifted ((((dir angle_wing_bot) rotated -90) 74 scaled wwing) transformed flip); 75 z3b = z3 shifted ((((dir angle_wing_top) rotated 90) 76 scaled wwing) transformed flip); 77 78 z5a = z5 shifted ((((dir (180 - angle_wing_bot)) rotated 90) 79 scaled wwing) transformed flip); 80 z5b = z5 shifted ((((dir (180 - angle_wing_top)) rotated -90) 81 scaled wwing) transformed flip); 82 83 % Draw the arrow 84 pickup pencircle scaled 1; 85 fill z1 86 -- z2{stemslant transformed flip} 87 .. {(-dir angle_wing_bot) transformed flip}z3a 88 .. z3b{(dir angle_wing_top) transformed flip} 89 .. z4{(dir angle_tip) transformed flip} 90 .. z4'{(dir (-angle_tip)) transformed flip} 91 .. {(dir (-angle_wing_top)) transformed flip}z5b 92 .. z5a{(-dir (-angle_wing_bot)) transformed flip} 93 .. z6{((-stemslant) reflectedabout (origin, up)) transformed flip} 94 -- z7 95 -- cycle; 96 97 labels (range 0 thru 7, 4', 3a, 3b, 5a, 5b); 98 endgroup; 99enddef; 100