lilypond-user
[Top][All Lists]
Advanced

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

Whiteout box function by Thomas Morley / need help


From: Karol Majewski
Subject: Whiteout box function by Thomas Morley / need help
Date: Sun, 06 Apr 2014 00:09:36 +0200

This is a function written by Thomas Morley. It allows to control width and 
height of whiteout box. Now I want to modify this function to make it work like:

\dynamicTextWhiteout #'(1 . 2)

where:
  - first number is LEFT X-extent
  - second number is RIGHT X-extent

I don't need Y-extent at all.


Don't quite know how to do this. Any hints would be appreciated.

Thanks,
Karol


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

\version "2.19.1"

dynamicTextWhiteout =
#(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) green) stencil)))
  (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))
          (whiteout-stil
            (flexible-stencil-whiteout adds stil)))
        (ly:make-stencil
          (ly:stencil-expr whiteout-stil) x-ext y-ext))))
  #{
    \override DynamicText.vertical-skylines = #'()
    \once \override DynamicText.stencil = #more-stencil-whiteout
  #})

{
  \dynamicTextWhiteout #'(1 . 0) c'4 \f
}

%%%%%%%%%





reply via email to

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