[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Let's make TextSpanners easier to use!
From: |
Valentin Villenave |
Subject: |
Let's make TextSpanners easier to use! |
Date: |
Sun, 26 Oct 2008 22:07:50 +0100 |
Greetings everybody,
as Graham recently noted, TextSpanners are currently painful to use:
{
\override TextSpanner #'bound-details #'left #'text = "rit."
b1\startTextSpan
e'\stopTextSpan
}
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. (The \override way would still exist for
power-users.)
I've spent some time trying to write such a command, but I'm stuck.
%%%%%%%%%%%%%%%
textSpan =
#(define-music-function (location parser txt) (string?)
(let* ((m (make-music 'TextSpanEvent
'span-direction -1)))
(ly:music-set-property! m 'tweaks
(acons 'bound-details '((left . ((text . "txt"))))
(ly:music-property m 'tweaks)))
m))
\relative{
b'1\textSpan #"rit"
e, f\stopTextSpan
}
%%%%%%%%%%%%
The annoyances with my code are:
- it replaces the whole bound-details alist, and therefore all
alignment-related settings are lost
- for some reason I don't understand, the txt variable can't be
passed as a text string to the 'text property (hence the double quotes
in my code, otherwise it doesn't work).
- it doesn't take a markup as argument.
If any of you guys has some ideas to fix these issues (or improve my
concepts), it would be great if we could come up with a command to
include in future versions of LilyPond!
Cheers,
Valentin
- Let's make TextSpanners easier to use!,
Valentin Villenave <=