2008/10/26 Valentin Villenave <[EMAIL PROTECTED]>:
> We really should provide our users with a shortcut: a single command,
> less powerful, less flexible but simpler to use. Ideally , this
> command would take the spanner's text as an argument, and start the
> spanner automatically.

OK, here is a function that works much better.

It works very much like Graham's recent "extra" dynamics: you can
either have a predefined TextSpanner, either define your spanners
on-the-fly through a music-function (but in this case you have to
enter it *before* the starting note).

%%%%%%%%%%%%%
#(define (make-text-span txt)
"Make a TextSpanner that begins with the given STR."
  (let* ((m (make-music 'TextSpanEvent
             'span-direction -1))
         (details (cdr (assoc 'bound-details
                        (cdr (assoc 'TextSpanner
                              all-grob-descriptions)))))
         (left-details (cdr (assoc '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))

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

\relative{
b'1\textSpan #"rit"
e, f\stopTextSpan

b'\rit c\stopTextSpan
}
%%%%%%%%%%%%%%

Cheers,
Valentin


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to