lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text Spanner, with Text left-aligned to bar-line, and spanner line r


From: David Nalesnik
Subject: Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?
Date: Mon, 1 Oct 2012 20:47:40 -0500

On Mon, Oct 1, 2012 at 7:49 PM, David Nalesnik <address@hidden> 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
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]