On 3/6/10 9:11 AM, "Stefan Thomas" <[email protected]> wrote:

> Dear community,
> I wanted to create a substitution-function with Scheme, where one could freely
> choose the context.
> I don't know which kind of variable is necessesary for the context.

You have a couple of problems, including the name left for your left text.

I couldn't find a straightforward way to implement this with a simple
substituton function, so I ended up using a case statement:

spanTextLeft =
#(define-music-function (parser location ctx leftText) (symbol? string?)
(case ctx
     (('Voice)
       #{
          \override Voice.TextSpanner #'(bound-details left text) =
$leftText
       #})
     (('Staff)
       #{
          \override Staff.TextSpanner #'(bound-details left text) =
$leftText
       #})
     (('Score)
       #{
          \override Score.TextSpanner #'(bound-details left text) =
$leftText
       #})
     (else
       #{
          \override TextSpanner #'(bound-details left text) = $leftText
       #})))


\relative c' {
  \override TextSpanner #'(bound-details left text) = "hello"
  c4 \startTextSpan d4 d4 d4 d4 \stopTextSpan e4 e4 e4
  \spanTextLeft #'Voice "goodbye"
  f4 \startTextSpan f f f f f f f \stopTextSpan g
}


HTH,

Carl



_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to