lilypond-user
[Top][All Lists]
Advanced

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

Re: vertical spacing of rests


From: Peter Selinger
Subject: Re: vertical spacing of rests
Date: Sun, 23 Aug 2015 16:21:11 -0300 (ADT)

Thomas Morley wrote:
> 
> Anyway, if you want to have the dots for rests affected as well, you
> need to adress them through the Rest:
> 
> \version "2.19.25"
> 
> omit-rest-and-dots =
> \override Rest.after-line-breaking =
>   #(lambda (grob)
>     (ly:grob-set-property! grob 'stencil #f)
>     (if (not (null? (ly:grob-object grob 'dot)))
>         (ly:grob-set-property! (ly:grob-object grob 'dot) 'stencil #f)))
> 
> centerRests = {
>   \override Rest.staff-position = #0
> }
> 
> \new Staff <<
>   \new Voice
>   \relative c'' {
>     \voiceOne
>     \omit-rest-and-dots
>     r4  c  r  d | r2. e4
>     d2. e4
>   }
>   \new Voice
>   \relative c'' {
>     \voiceTwo
>     \centerRests
>     r4 a8 a8 r4 b8 b8 | r2. c4
>     c2. a4
>   }
>

Great, that is just the information I was missing in order to fix
Jay's Scheme code. Attached is an updated version of

https://github.com/openlilylib/openlilylib/blob/master/editorial-tools/merge-rests-engraver/definition.ily

that now works correctly for dotted rests (as well as double-dotted
rests, full-measure rests, and so on). I am attaching the full file,
as well as a patch.

I factored the actual rest-merging code into a separate Scheme
function that is shared by both merge-rests-engraver and
merge-mmrests-engraver -- this is probably technically unnecessary
because multi-measure rests are not usually dotted. Still I think it
is better to engrave just one glyph for the merged rests, rather than
a bunch of identical glyphs at the same coordinate. Also, having it as
a separate function is easier to comprehend than deeply-nested Scheme.

Here's an example showing it all in action:

%----------------------------------------
\version "2.19.25"

\include "definition.ily"

\layout {
  \context { \Staff \consists #merge-rests-engraver }
  \context { \Staff \consists #merge-mmrests-engraver }
}

\new Staff <<
  \new Voice {
    \relative c'' {
      \voiceOne
      | r  c  r  d
      | r2. r4
      | r2.. e8
      | r2... e16
      | d2. e4
      | R1
      | c4 c c c
      | R1
    }
  }
  \new Voice {
    \relative c'' {
      \voiceTwo
      | r4 a8 a8 r4 b8 b8
      | r2. c4
      | r2.. c8
      | r2... c16
      | c2. a4
      | R1*3
    }
  }
>>
%----------------------------------------

See rests5.pdf for the output.

If you all agree that this patch works correctly, hopefully someone
with commit privileges can merge it into git?

Thanks, -- Peter

Attachment: definition-patch.diff
Description: ASCII English text

Attachment: rests5.pdf
Description: PDF document, version 1.4

Attachment: definition.ily
Description: ASCII English text


reply via email to

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