On Mon, Oct 1, 2012 at 7:49 PM, David Nalesnik <[email protected]> wrote:
> Hi again,
>
>>
>> Anyway, hope there's some use in this.
>>
>
> A bit more streamlined:
>
OK, this fixes the issue with the spanner crossing line breaks.
That's it for me :)
\version "2.16.0"
#(define (capo grob)
(let* ((orig (ly:grob-original grob))
(siblings (if (ly:spanner? orig)
(ly:spanner-broken-into orig) '()))
(total-found (length siblings)))
(define (adjust-first-left piece)
(let* ((sys (ly:grob-system piece))
(cols (ly:grob-object sys 'columns))
(cols-list (ly:grob-array->list cols))
(nearest-non-musical
(find
(lambda (col) (eq? #t (ly:grob-property col 'non-musical)))
(find-tail
(lambda (col)
(eq? col (ly:grob-object (ly:spanner-bound piece
LEFT) 'axis-group-parent-X)))
(reverse cols-list)))))
(ly:spanner-set-bound! piece LEFT nearest-non-musical)))
(if (>= total-found 1)
(if (eq? grob (car siblings))
(adjust-first-left grob))
(adjust-first-left grob))))
capoVHalf = {
\once \override TextSpanner #'to-barline = ##t
\once \override TextSpanner #'dash-fraction = #0.6
\once \override TextSpanner #'(bound-details left-broken text) = ##f
\once \override TextSpanner #'(bound-details left padding) = #0
\once \override TextSpanner #'(bound-details left-broken padding) = #0.25
\once \override TextSpanner #'(bound-details left text) = \markup {
\tiny { "½ Capo V" } }
\once \override TextSpanner #'after-line-breaking = #capo
}
\relative c' {
\key e \major
c c c c
\capoVHalf
c\startTextSpan c c c
c c c c
c\stopTextSpan c c c
\key es \major
\capoVHalf
c\startTextSpan c c c
c c c c
\break
c c c c
c c c c
c\stopTextSpan c c c
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user