lilypond-user
[Top][All Lists]
Advanced

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

Re: Whiteout box function by Thomas Morley / need help


From: Karol Majewski
Subject: Re: Whiteout box function by Thomas Morley / need help
Date: Mon, 21 Apr 2014 13:22:48 +0200

Although I know nothing about scheme, I've managed to slim down this function, 
so that there are no optional arguments. Now I'll try to find out why it 
doesn't work for DynamicText grob.

Harm, thanks in advance for any hints. Perhaps we can mix your function with 
flexible-stencil-whiteout (see my first post).

%%%%%%%%%%%%%%%%%%%%%

\version "2.19.5"

moreWhiteout =
#(define-music-function
  (parser location adds)
  (pair?)
  (define
    (interval-add iv-1 iv-2)
    (cons
      (+
        (car iv-1)
        (car iv-2))
      (+
        (cdr iv-1)
        (cdr iv-2))))
  (define more-stencil-whiteout
    (lambda
      (grob)
      (let*
        ((stil
            (ly:text-interface::print grob))
          (x-ext
            (ly:stencil-extent stil X))
          (y-ext
            (ly:stencil-extent stil Y))
          (add-to-x-ext
            (if
              (pair?
                (car adds))
              (car adds) adds))
          (add-to-y-ext
            (if
              (pair?
                (cdr adds))
              (cadr adds) '(0 . 0)))
          (new-stil
            (ly:make-stencil
              (ly:stencil-expr stil)
              (interval-add x-ext add-to-x-ext)
              (interval-add y-ext add-to-y-ext)))) new-stil)))
  #{
    \once \override DynamicText . layer = #10
    \once \override DynamicText . whiteout = ##t
    \once \override DynamicText . stencil = #more-stencil-whiteout
  #})

%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%

musicI = { \time 2/4 \repeat unfold 16 b8 }

musicII = {
  r2
  %% apply to X- and Y-axis
  \moreWhiteout #'((-2 . 0.5)(0 . 2))
  b4 \ff b
  r2
  %% apply to X-axis only
  \moreWhiteout #'(-2 . 0.5)
  b4 \mf b
}


\new StaffGroup <<
  \new Staff \relative c'' \musicI
  \new Staff \relative c'' \musicII
>>

%%%%%%%%%%%%%%%%%%%%%


-- Karol





reply via email to

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