lilypond-user
[Top][All Lists]
Advanced

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

Re: cresc. whitespace padding


From: Thomas Morley
Subject: Re: cresc. whitespace padding
Date: Fri, 11 Oct 2013 23:42:05 +0200

2013/10/11 EdBeesley <address@hidden>:
> Thomas Morley-2 wrote
>> Hi,
>>
>> how about:
>>
>> \version "2.16.2"
>>
>> moreVerticalDynamicTextSpannerWhiteout =
>>  \once \override DynamicTextSpanner #'stencil =
>>   #(lambda (grob)
>>      (let* ((stil (ly:line-spanner::print grob))
>>             (x-ext (ly:stencil-extent stil X))
>>             (y-ext (ly:stencil-extent stil Y)))
>>      (ly:grob-set-property! grob 'whiteout #t)
>>      (ly:make-stencil
>>         (ly:stencil-expr stil)
>>         (interval-widen x-ext 0)
>>         (interval-widen y-ext 0.2))))
>>
>> \score {
>>   \new GrandStaff <<
>>     \new Staff
>>       \relative c' {
>>          c d e
>>          \moreVerticalDynamicTextSpannerWhiteout
>>          f \cresc c  d e f \!
>>       }
>>     \new Staff
>>       \relative c' {
>>          c d e f \cresc c  d e f \!
>>       }
>>   >>
>> }
>>
>> Could be easily turned into a music-function.
>>
>> HTH,
>>   Harm
>
> That is exactly what I was after, thank you!
>
> Now when you say this could be easily turned into a music-function... could
> we assume for a second that I'm totally dumb and have no idea how to do
> this?

It would lead to:

moreVerticalDynamicTextSpannerWhiteout =
#(define-music-function (parser location adds)(pair?)
#{
 \once \override DynamicTextSpanner #'stencil =
  #(lambda (grob)
     (let* ((stil (ly:line-spanner::print grob))
            (x-ext (ly:stencil-extent stil X))
            (y-ext (ly:stencil-extent stil Y)))
     (ly:grob-set-property! grob 'whiteout #t)
     (ly:make-stencil
        (ly:stencil-expr stil)
        (interval-widen x-ext (car adds))
        (interval-widen y-ext (cdr adds)))))
#})

Apply it with
  \moreVerticalDynamicTextSpannerWhiteout #'(0 . 2.5)
Where the first number of the pair means additionally extension in
X-axis, the second in Y-axis.
Both values expand the stencil in two directions:
The first left and right, the second below and above.


HTH,
  Harm



reply via email to

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