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: Jonathan Kulp
Subject: Re: Let's make TextSpanners easier to use!
Date: Wed, 29 Oct 2008 10:11:01 -0500
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

This is great, Valentin!  Thanks!

Jon

Valentin Villenave wrote:
2008/10/26 Valentin Villenave <address@hidden>:
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
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user


--
Jonathan Kulp
http://www.jonathankulp.com




reply via email to

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