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 17:29:15 -0300 (ADT)

Point taken. So I was wrong: it's not possible to remove the stencils
for redundant rests, or else fermatas in that voice don't have
anything to attach to. So the behavior of Jay's original code was the
better one, i.e., to force all the redundant rests to the same
coordinates, but to retain their glyphs. In addition, dots should be
removed from all but one of them.

Another bug was also present in my previous example (rests5.pdf from
my last email): the two quarter rests in the first measure weren't
vertically centered. I am not entirely sure why this happens, and why
it only affects quarter rests, but the following patch-to-my-patch
happens to fix both problems at the same time.

--- /tmp/definition.ily 2015-08-23 17:15:54.591816683 -0300
+++ definition.ily      2015-08-23 17:15:29.044253078 -0300
@@ -24,7 +24,7 @@
    (ly:grob-set-property! (car rests) 'Y-offset offset)
    (for-each
     (lambda (rest)
-      (ly:grob-set-property! rest 'stencil #f)
+      (ly:grob-set-property! rest 'Y-offset offset)
       (if (not (null? (ly:grob-object rest 'dot)))
          (ly:grob-set-property! (ly:grob-object rest 'dot) 'stencil #f)))
     (cdr rests)))

This seems to work fine with your example as well as mine. Of course
further testing may be needed to ensure that it works in all other
cases. Apart from an equivalent refactoring of the Scheme code, the
only two lines that now differ from Jay's version are the two lines
"(if (not (null? ... #f))".

I'm also attaching the patched file definition.ly as a whole, for ease
of reference.

-- Peter

Thomas Morley wrote:
> 
> 2015-08-23 21:21 GMT+02:00 Peter Selinger <address@hidden>:
> > 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.
> >
> 
> Hi Peter,
> 
> glad I could help.
> Though, reading up the whole thread I got some concerns and did some
> further testing.
> 
> Try with your updated engravers:
> 
> \layout {
>   \context { \Staff \consists #merge-rests-engraver }
>   \context { \Staff \consists #merge-mmrests-engraver }
>   \compressFullBarRests
> }
> 
> \new Staff <<
>   \new Voice {
>       \voiceOne
>       R1*3^\fermataMarkup
>   }
>   \new Voice {
>       \voiceTwo
>       R1*3_\fermataMarkup
>   }
> >>
> 
> Looks some more work has to be done ...
> 
> png attached
> 
> >
> > If you all agree that this patch works correctly, hopefully someone
> > with commit privileges can merge it into git?
> 
> Afaik, there are still some problems with scheme-engravers in the source-code.
> But I may be wrong here.
> 
> 
> Cheers,
>   Harm

Attachment: definition.ily
Description: ASCII English text


reply via email to

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