2008/10/29 Valentin Villenave <[EMAIL PROTECTED]>: > 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)) Looks good. :) As a minor refinement, you could use assoc-get instead of assoc. > textSpan= > #(define-music-function (location parser txt) (string?) > (make-text-span txt)) Hmm, this isn't as elegant as make-text-span itself; you can't use markup. It's a bit academic now, but concerning your problem with passing the text variable in the original example, you need to use a backquote for the bound-details, together with a comma before txt; this ensures that the value of txt is substituted in the list, rather than returning the symbol. (acons 'bound-details `((left . ((text . ,txt)))) You can see the same syntax in define-grobs.scm for grob callbacks. Regards, Neil _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user