[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: barré variables and TextSpanner
From: |
Thomas Morley |
Subject: |
Re: barré variables and TextSpanner |
Date: |
Sun, 18 Nov 2012 18:10:00 +0100 |
2012/11/18 Federico Bruni <address@hidden>:
> Il 18/11/2012 14:28, Thomas Morley ha scritto:
>
>> boiled down, you want to use a function to set 'left 'text of TextSpanner.
>>
>> How about:
>>
>> \version "2.16.0"
>>
>> barre =
>> #(define-music-function (parser location strg)(string?)
>> (let ((arg (string-append "B " strg)))
>> #{
>> \override TextSpanner #'(bound-details left text) = $arg
>> #}))
>>
>> startBarre = \startTextSpan
>> stopBarre = \stopTextSpan
>>
>> \relative c' {
>> \barre I c4\startTextSpan d e f\stopTextSpan
>> \barre II g\startBarre a b c\stopBarre
>> }
>
>
> Thanks Harm!
> It's perfect for my needs.
>
> I wonder if above function can be improved to make the input even simpler
> and concise, like this:
>
> \barre I { c4 d e f }
>
I first tried to adapt the David Nalesnik's coding from:
http://lists.gnu.org/archive/html/lilypond-user/2011-10/msg00500.html
but it didn't work for 2.14.2 , even after running convert-ly.
So see my own coding below.
\version "2.16.0"
barre =
#(define-music-function (parser location strg music)(string? ly:music?)
(let ((arg (string-append "B " strg)))
#{
\override TextSpanner #'(bound-details left text) = $arg
#(let ((elts (ly:music-property music 'elements)))
(make-music 'SequentialMusic 'elements
(append
(list (make-music 'TextSpanEvent 'span-direction -1))
(reverse (cdr (reverse elts)))
(list (make-music 'TextSpanEvent 'span-direction 1))
(list (last elts)))))
#}))
\relative c' {
\barre I { c4 d e f }
\barre II { g a b c }
}
Regards,
Harm
Re: barré variables and TextSpanner, Nick Payne, 2012/11/18