Doc workaround for DurationLine to end of piece is broken in some cases
In the documentation at Graphical notation and the regression test duration-line-end-items.ly
, a workaround is given to let the duration line's ending item be printed. This does not work in all cases, like with \alternative
:
\version "2.23.3"
\layout {
\context {
\Voice
\consists "Duration_line_engraver"
\omit Stem
\omit Flag
\omit Beam
\override NoteHead.duration-log = 2
}
}
lastEndStyle =
#(define-music-function (end-style)(symbol?)
#{
\override DurationLine.after-line-breaking =
#(lambda (grob)
(let* ((orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig) '()))
(last-grob (if (pair? siblings) (last siblings) #f)))
(if last-grob
(ly:grob-set-nested-property!
last-grob
'(bound-details right-broken end-style) end-style))))
#})
{
\once \override DurationLine.bound-details.right.end-style = #'arrow
\lastEndStyle #'arrow
\repeat volta 2 { c'1 }
a'1\-
}
{
\once \override DurationLine.bound-details.right.end-style = #'arrow
\lastEndStyle #'arrow
\repeat volta 2 { c'1 }
\alternative { {
a'1\-
} }
}
I first experienced this in !731 (merged), with CenteredBarNumberLineSpanner
. My understanding is that the VoltaBracketSpanner
tries to move itself to the topmost staff (the after-line-breaking
callback is ly:side-position-interface::move-to-extremal-staff
) and this causes the X-extent of the DurationLine
to be requested by get_extremal_staff
in staff-grouper.cc
, triggering the stencil
callback before DurationLine
's after-line-breaking
has had a chance to operate.
Of course, it's still a workaround, but it would be nice to fix it.