lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Direction operators in event-function


From: Urs Liska
Subject: Re: Direction operators in event-function
Date: Sun, 21 Oct 2018 17:28:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1



Am 21.10.2018 um 16:58 schrieb David Kastrup:
Urs Liska <address@hidden> writes:

But if I simply create two elements in the event-function the explicit
direction operator takes no effect:

propagate-direction =
#(define-event-function (text)(markup?)
    #{
      -(
      -\markup #text
    #})

{
   g'1 ^\propagate-direction "Up" g' )
}

(here both the slur and the text are printed below the staff.

Why is that?
Multiple post events in one post event expression are temporarily
wrapped in one PostEvents music event.  This is then what gets the
up/down direction.  When it is unwrapped in use, the direction gets
lost.

I see, this explains the observations.


Arguably, dissolving a PostEvents into separate events should try
applying some fields (tweaks, color, direction?).  Unfortunately, there
are a lot.  Alternatively, directions and tweaks should bypass
PostEvents and go through the enclosed events.  Either would have some
performance impact.  Maybe just walk the property list of a PostEvents
and copy _everything_ found there?

And more importantly: how can I achieve the goal of creating more than
one element in an event-function and still have the explicit
directions from the calling code be applied?

And why can't I access the explicit direction operator from within the
event-function? I understand that the *generated* direction isn't
accessible at that moment, but an explicit setting should be known at
that point, isn't it?
I have no idea what you are talking about.

Somehow I was afraid I didn't express myself clearly enough :-(

What do you mean with
"explicit direction operator" here?  What do you mean with "generated"
direction?

With explicit I refer to a direction explicitly assigned, either thorugh ^/_ or an \override like \slurUp etc. If I call my function with ^\propagate-direction there is an explicit direction in place while the event-function is called, isn't it? If OTOH I call it with -\propagate-direction or without an operator the direction will only be generated/calculated at some later point, depending on the layout algorithms.
Is that correct or am I missing something?

What I would *like* to do is a function like

propagate-direction =
#(define-event-function (text)(markup?)
   #{
     -\tweak direction #UP
     -(
     -\tweak direction #UP
     -\markup #text
   #})

but instead of hard-coding #UP I'd like to calculate the values based on something. For example let the text have the opposite direction of the slur and have the slur accept the ^\_ operator. From what I can understand this information *should* be present at that moment, while I'm aware that it is *not* possible to do the same relying on the automatically determined direction of the slur (which is only calculated later).

Does that make my question clearer?

Urs

The only direction operator I see here is clearly applied
_after_ calling the event function.  It cannot magically affect
expressions you create inside of the function before the function even
returns.





reply via email to

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