[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hairpin with overlayed text
From: |
Neil Puttock |
Subject: |
Re: hairpin with overlayed text |
Date: |
Fri, 7 Jan 2011 22:43:10 +0000 |
On 5 January 2011 21:58, -Eluze <address@hidden> wrote:
> that'd be to easy - in fact it doesn't have any effect. maybe i use it the
> wrong way!?
>
> here is the code: http://old.nabble.com/file/p30600503/snippet.ly
> snippet.ly
Try this:
hairpinWithCenteredText = #(define-music-function (parser location
text) (markup?)
#{
\override Voice.Hairpin #'stencil = #(lambda (grob)
(ly:stencil-aligned-to
(ly:stencil-add
(ly:stencil-aligned-to (ly:hairpin::print grob) X CENTER)
(grob-interpret-markup grob (markup #:vcenter
#:center-align $text)))
X LEFT))
#})
You can use ly:stencil-combine-at-edge if you want (simply swap the
stencils around), but it will produce poorer alignment since `Y
CENTER' is invalid for adding at an edge (it simply ignores the extent
of one of the stencils, and will cause a crash in an unoptimized
build.)
Cheers,
Neil