1\version "2.21.3" 2 3\header { 4 texidoc = "A @code{DurationLine} grob may end with a special behaviour. 5Currently available are hooks (with settable direction) and arrows." 6} 7 8%% Running to the very end of a score, the DurationLine is the not-last 9%% part of a broken spanner, thus we need to go for the 10%% right-broken-subproperty: 11%% \override DurationLine.bound-details.right-broken.end-style = #'arrow/hook 12%% or 13%% call the function lastEndStyle with 'arrow/hook 14 15lastEndStyle = 16#(define-music-function (end-style)(symbol?) 17#{ 18 \override DurationLine.after-line-breaking = 19 #(lambda (grob) 20 (let* ((orig (ly:grob-original grob)) 21 (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '())) 22 (last-grob (if (pair? siblings) (last siblings) #f))) 23 (if last-grob 24 (ly:grob-set-nested-property! 25 last-grob 26 '(bound-details right-broken end-style) end-style)))) 27#}) 28 29\layout { 30 \context { 31 \Voice 32 \consists "Duration_line_engraver" 33 \omit Stem 34 \omit Flag 35 \omit Beam 36 \override NoteHead.duration-log = 2 37 } 38} 39 40\score { 41 \new Voice = "main" 42 { 43 b1\- 44 << 45 \context Voice = "foo" { 46 \voiceOne 47 d''2\- 48 } 49 \context Voice = "bar" { 50 \voiceTwo 51 d'2\- 52 \oneVoice 53 } 54 >> 55 << { d''\- } \\ d'\- >> 56 \lastEndStyle #'arrow 57 e'\- 58 \bar "|." 59 } 60 \layout { 61 \context { 62 \Voice 63 \override DurationLine.bound-details.right.end-style = #'arrow 64 } 65 } 66} 67 68\score { 69 \new Voice = "main" 70 { 71 b1\- 72 << 73 \context Voice = "foo" { 74 \voiceOne 75 \override DurationLine.details.hook-direction = #DOWN 76 d''2\- 77 } 78 \context Voice = "bar" { 79 \voiceTwo 80 d'2\- 81 \oneVoice 82 } 83 >> 84 << { d''\- } \\ d'\- >> 85 \lastEndStyle #'hook 86 e'\- 87 \bar "|." 88 } 89 \layout { 90 \context { 91 \Voice 92 \override DurationLine.bound-details.right.end-style = #'hook 93 } 94 } 95}