lilypond-user
[Top][All Lists]
Advanced

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

Re: Moving dynamics to a fixed vertical position (inside the staff)


From: Carl D. Sorensen
Subject: Re: Moving dynamics to a fixed vertical position (inside the staff)
Date: Mon, 20 Apr 2009 19:20:30 -0600



On 4/20/09 4:32 PM, "Neil Puttock" <address@hidden> wrote:

> 2009/4/20 Reinhold Kainhofer <address@hidden>:
> 
>> Is there any way to position a dynamic sign at an explicit staff-relative
>> (not
>> note-relative) vertical position?
> 
> Since the dynamic's X-parent is the notehead, you can normalize its
> position by retrieving the notehead's Y-offset:
> 
> dynamicsAllInside = #(define-music-function (parser location offsetX shiftY)
> (number? number?)
> #{
>   \once \override DynamicText #'X-offset = $offsetX
> %   \once \override DynamicLineSpanner #'Y-offset = #0
>   \once \override DynamicText #'Y-extent = #(cons 1 -1)
>   \once \override DynamicLineSpanner #'Y-extent = #(cons 1 -1)
>   \once \override DynamicText #'Y-offset =
>     $(lambda (grob)
>        (let* ((head (ly:grob-parent grob X))
>               (offset (ly:grob-property head 'Y-offset)))
>          (- (/ shiftY 2) offset 0.75)))
> #})

Thanks, Neil.  You just saved me the time of figuring out how to do this.
After I sent my hack, I realized that the trick was to get the parent offset
and then do a shift from that.  But then I found that you had already
written it!

Carl





reply via email to

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