lilypond-user
[Top][All Lists]

## Re: hairpin with overlayed text

 From: -Eluze Subject: Re: hairpin with overlayed text Date: Fri, 7 Jan 2011 15:57:06 -0800 (PST)

```
Neil Puttock wrote:
>
> 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-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
>
yes, the vertical alignment gets much better, thanks!

but the problem of whitening the hairpin for the length of the text persists
- clearly the \whiteout approach can not be used here because the whole
stencil is built in the same layer - but then it gets pretty sophisticated,
does it not!?

please don't bother, i just thought it would be nice to have this feature!

cheers
Eluze

--
View this message in context:
http://old.nabble.com/hairpin-with-overlayed-text-tp30596563p30619249.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.

```