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 21:53:41 +0200

2013/10/11 EdBeesley <address@hidden>:
> I'm trying to add a bit of padding to the whiteout function when used on a
> \cresc. My results are best explained with code...
>
> \version "2.16.2"
>
> exampleone = \markup {how it looks with whiteout}
> exampletwo = \markup {how I want it to look}
> examplethree = \markup {trying to use scheme}
>
>
> \score {
>   \new GrandStaff <<
>     \new Staff \relative c' {
>
>        c ^\exampleone d e \once \override DynamicTextSpanner #'whiteout =
> ##t f \cresc c  d e f \!}
>     \new Staff \relative c' {
>       c d e f \cresc c  d e f \!}
>   >>
> }
>
> \score {
>   \new GrandStaff <<
>     \new Staff \relative c' {
>
>       c ^\exampletwo d e f _\markup {\normal-text \larger \whiteout
> \pad-around #0.2 \italic cresc.} c  d e f \!}
>     \new Staff \relative c' {
>       c d e f \cresc c  d e f \!}
>   >>
> }
>
> wcresc =
>   #(make-music 'CrescendoEvent
>              'span-direction START
>              'span-type 'text
>
>              'span-text "cresc.")
>
> \score {
>   \new GrandStaff <<
>     \new Staff \relative c' {
>
>       c ^\examplethree d e f \wcresc c  d e f \!}
>     \new Staff \relative c' {
>       c d e f \cresc c  d e f \!}
>   >>
> }
>
> As you can see I clearly don't know how to change whiteout or padding
> properties in scheme!

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



reply via email to

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