lilypond-user
[Top][All Lists]
Advanced

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

Re: Changing MulitMeasureRest.stencil to a squiggle


From: Marc Hohl
Subject: Re: Changing MulitMeasureRest.stencil to a squiggle
Date: Tue, 6 Sep 2016 17:56:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Am 06.09.2016 um 16:09 schrieb David Nalesnik:
Hi Marc,

On Tue, Sep 6, 2016 at 7:28 AM, Marc Hohl <address@hidden> wrote:
Hi list,

I want to change the MultiMeasureRest.stencil to a squiggle as shown in the
appendices (quite roughly pasted together in GIMP).
Searching the LSR and the web does not give any informations about this
topic (the only thing I found was using the percent stencil, which is also
hardcoded in the C++ sources).

I tried to override the stencil by

\override MultiMeasureRest.stencil = #ly:line-spanner::print

but this causes errors like

"MultiMeasureRest has empty extent and non-empty stencil."

Even if you for this to work, your mockup shows a line more complex
than a squiggle.

Yes, of course, but that would have been a starting point ... ;-)

You'd only be able to get a simple zigzag line,
without the refinement at the ends, and without control of the
"amplitude" (as if my simple example below).


Any ideas?

The easiest way to get what you want is to create a stencil callback
which uses the default stencil for dimensions of a replacement
stencil.  The code below is a simple demonstration, which draws lines
like you would get with ly:line-spanner::print.
(Note that you need at least 2.19.27 for this to work.)


\version "2.19.46"

#(define my-stencil
   (lambda (grob)
     (let* ((default-stil (ly:multi-measure-rest::print grob))
            (X-ext (ly:stencil-extent default-stil X)))
       (ly:line-interface::line grob (car X-ext) 0 (cdr X-ext) 0))))

Ah, that's the way to do it: getting the x-ext from the original stencil!
And I wasn't aware that ly:line-interface::line exists, so your answer is pretty useful for future solutions.

Thanks,

Marc




reply via email to

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