lilypond-user
[Top][All Lists]
Advanced

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

Re: cresc. whitespace padding


From: EdBeesley
Subject: Re: cresc. whitespace padding
Date: Sat, 12 Oct 2013 04:17:12 -0700 (PDT)

Thomas Morley-2 wrote
> Also possible:
> 
> \version "2.16.2"
> 
> moreVerticalDynamicTextSpannerWhiteoutII =
>   #(define-music-function (parser location adds)(pair?)
> 
>     (define (flexible-stencil-whiteout add stencil)
>       (let*
>           ((x-ext (ly:stencil-extent stencil X))
>            (y-ext (ly:stencil-extent stencil Y)))
>         (ly:stencil-add
>          (stencil-with-color
>             (ly:round-filled-box
>                (interval-widen x-ext (car add))
>                (interval-widen y-ext (cdr add))
>                0.0)
>             white)
>          stencil)))
> 
>     (define more-stencil-whiteout
>       (lambda (grob)
>            (let* ((stil (ly:line-spanner::print grob))
>                   (x-ext (ly:stencil-extent stil X))
>                   (y-ext (ly:stencil-extent stil Y))
>                   (whiteout-stil (flexible-stencil-whiteout adds stil)))
>              (ly:make-stencil
>                 (ly:stencil-expr whiteout-stil)
>                 x-ext
>                 y-ext))))
>     #{
>       %% Needed for 2.17.x:
>       \override DynamicTextSpanner #'vertical-skylines = #'()
>       \once \override DynamicTextSpanner #'stencil =
>          #more-stencil-whiteout
>     #})
> 
> \score {
>   \new GrandStaff <<
>     \new Staff
>       \relative c' {
>          c d e
>          \moreVerticalDynamicTextSpannerWhiteoutII #'(0 . 1.5)
>          f \cresc c  d e f \!
>       }
>     \new Staff
>       \relative c' {
>          c d e f \cresc c  d e f \!
>       }
>   >>
> }
> 
> 'moreVerticalDynamicTextSpannerWhiteoutII' doesn't affect the vertical
> spacing of other grobs.
> To see the the difference, try higher values for y in
>   \moreVerticalDynamicTextSpannerWhiteoutII #'(x . y)
> 
> Cheers,
>   Harm

Wow this is a fantastically useful function! Thank you for that, it's
definitely helped with my understanding of how scheme works, too. 

Anyone else agree that this would be a very good addition to the snippet
repository? 



Damnit David, I'm a musician not a programmer! In all seriousness though I
always do my best to figure out the answer myself via the documentation. I
know I've asked a far few questions over the past week but believe me there
are a lot that I've not posted because I've spent hours reading through the
manual and snippets. I'm very conscious about only using the mailing list as
a last resort instead of a short-cut to problems I could solve myself, and
I'm sorry if I've not given that impression!



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/cresc-whitespace-padding-tp152120p152156.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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