On 4/20/09 4:32 PM, "Neil Puttock" <n.putt...@gmail.com> wrote:

> 2009/4/20 Reinhold Kainhofer <reinh...@kainhofer.com>:
> 
>> 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



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

Reply via email to