[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moving dynamics to a fixed vertical position (inside the staff)
From: |
Neil Puttock |
Subject: |
Re: Moving dynamics to a fixed vertical position (inside the staff) |
Date: |
Mon, 20 Apr 2009 23:32:41 +0100 |
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)))
#})
Regards,
Neil