2012/11/18 Federico Bruni <[email protected]>: > 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 _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
