Hi,

I'm trying to write an event-function that creates both a slur and a markup on opposite sides. I can do that by manually specifying the directions:

\version "2.19.82"

testDirection =
#(define-event-function ()()
   #{
     _(
     ^"Text"
   #})

{
  c' \testDirection d' )
}

but I have to make it possible to do it both ways (top/bottom and bottom/top). I know how to set the directions with an extra (optional) function argument, but I would prefer if I could extract the direction directly from within the event-function.

Using \displayMusic I see that an explicit direction is "known" to the event function:

\void \displayMusic ^\testDirection
=>
(make-music
  'PostEvents
  'direction
  1
  'elements
  (list (make-music
          'SlurEvent
          'direction
          -1
          'span-direction
          -1)
        (make-music
          'TextScriptEvent
          'direction
          1
          'text
          "Text")))

(the 'direction PostEvent takes either 1 or -1, or is missing if no explicit direction is given). But I have no idea if/how I can access that information from within the function to decide how to create the slur and the text event.

Thanks Urs

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

Reply via email to