lilypond-user
[Top][All Lists]
Advanced

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

Re: Let's make TextSpanners easier to use!


From: Valentin Villenave
Subject: Re: Let's make TextSpanners easier to use!
Date: Sat, 1 Nov 2008 23:26:15 +0100

2008/11/1 Neil Puttock <address@hidden>:
> It saves you having to use cdr to get the value.

Brilliant!!!

%%%%%%%%%%%%%%%%%%%

#(define (make-text-span txt)
"Make a TextSpanner that begins with the given STR."
  (let* ((m (make-music 'TextSpanEvent
             'span-direction -1))
         (details (assoc-get 'bound-details
                        (assoc-get 'TextSpanner
                              all-grob-descriptions)))
         (left-details (assoc-get 'left
                             details)))
   (ly:music-set-property! m 'tweaks
    (acons 'bound-details
     (acons 'left
      (acons 'text txt
       left-details)
      details)
     (ly:music-property m 'tweaks)))
   m))

textSpan=
#(define-music-function (location parser txt) (string?)
(make-text-span txt))

stopText= #(define-music-function (location parser) ()(make-music 'TextSpanEvent
             'span-direction 1))

rit = #(make-text-span "rit")

\relative{
c1\rit c c\stopTextSpan
}

%%%%%%%%%%%%%%%%%%%%

Now, still this annoying music-function limitation.

Cheers,
Valentin




reply via email to

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