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: David Nalesnik
Subject: Re: Changing MulitMeasureRest.stencil to a squiggle
Date: Tue, 6 Sep 2016 09:09:51 -0500

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.  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))))

{
  \override Staff.MultiMeasureRest.style = #'zigzag
  \override Staff.MultiMeasureRest.thickness = 4
  \override Staff.MultiMeasureRest.stencil = #my-stencil
  \compressFullBarRests
  R1*24
  R1*4
}

Instead of using a simple line, you would probably want to construct
your own stencil using Multi_measure_rest::big_rest as a model.  This
would be pretty straightforward to translate to Scheme.  Perhaps a
path stencil for the horizontal line?  Sorry, no time for a
mock-up.....

Hope this helps.
David



reply via email to

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