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: Tue, 25 Aug 2015 10:02:13 -0300 (ADT)

address@hidden wrote:
> 
> Hello,
> There might be another aspect of positioning (common) rests from 
> different voices. This is beside all the technical solutions presented 
> earlier in this thread. All these work more or less fine for half rests 
> as well as full rests. But when it comes to full rests, in almost every 
> note sheet I have come in contact with, it is printed hanging below 
> staff line number two, not zero, so the half rest and full rest reside 
> in the same white space.
> 
> You can not have different definitions for these two rests, except for 
> individual rests (\once \override...). But if you need a full rest, at 
> least I prefer the multi measure rest (R1 instead of r1) as this is 
> automatically centred in the measure. This type of rest also has its own 
> definition of the vertical position. So the definition of centerRests 
> should be:
> 
> centerRests = {
>     \override Rest.staff-position = ##t
>     \override MultiMeasureRest.staff-position = #2
> }
> 
> Regarding the voice VoiceTwo, I use to convert the rests into spaces, 
> which is quite simple by means of the global replace function (ctrl+H) 
> in Frescobaldi and the regular expression (Regex) option. Replace /"/([ 
> ])r([^a-zA-Z]*)" with "\1s\2)/"/ (remove the quotation marks, they are 
> here just for pointing out the text to insert). For non English works 
> the exclude text (a-zA-Z) might have to be expanded, not to affect 
> comments and similar texts.
> 
> Kaj

Hi Kaj,

thanks for pointing this out. Ugh, what an ugly mess. In my opinion,
this is a bug in the font for the full measure rest glyph. The
reference point for that glyph should be so that the glyph is above,
not below, its reference point.

Currently, the behavior is completely inconsistent, as this example
shows:

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

<<
  \compressFullBarRests
  \new Staff {
    <>^"default"
    | r\longa | r\breve | r1 | r2 r4 r8 r8 | R1*4 | R1*2 | R1 |
  }
  \new Staff {
    \override Rest.staff-position = #0
    \override MultiMeasureRest.staff-position = #0
    <>^"staff-position = 0"
    | r\longa | r\breve | r1 | r2 r4 r8 r8 | R1*4 | R1*2 | R1 |
    \revert Rest.staff-position
    \revert MultiMeasureRest.staff-position
  }
  \new Staff {
    \override Rest.Y-offset = #0
    \override MultiMeasureRest.Y-offset = #0
    <>^"Y-offset = 0"
    | r\longa | r\breve | r1 | r2 r4 r8 r8 | R1*4 | R1*2 | R1 |
    \revert Rest.Y-offset
    \revert MultiMeasureRest.Y-offset
  }
>>
%----------------------------------------

All three staffs (see tests8.pdf) contain the same set of rests. 
The default positioning (top staff) is correct both for normal rests
and full-measure rests.

Setting staff-position = 0 (middle staff) works correctly for "r1"
rests, incorrectly for "R1" rests, and correctly for all other rests
(including multi-measure).

Setting Y-offset = 0 (bottom staff) works incorrectly for "r1" and
"R1" rests, and correctly for all other rests (including multi-measure).

This is inconsistent in several ways, because

* if staff-position is used, whole rests of type "r1" and "R1" are
  treated differently from each other. Moreover, the "R1" type rests
  are positioned incorrectly relative to all other rests.

* if Y-offset is used, both "r1" and "R1" rests are positioned
  incorrectly relative to all other rests.

* finally, the behavior of staff-position doesn't match that of
  Y-offset, in the case of "r1" rests only.

I think the correct long-term solution is to redefine the reference
point of the whole rest glyph so that it is always positioned slightly
above the half-rest glyph. 

Meanwhile, one has to work around this. Here is another incremental
patch to the merge-rests code (from
http://www.mail-archive.com/lilypond-user%40gnu.org/msg69608.html, now
triply patched):

diff --git a/merge-rests.ily b/merge-rests.ily
index 688a37c..f4e3adb 100644
--- a/merge-rests.ily
+++ b/merge-rests.ily
@@ -21,10 +21,10 @@
 % merge a list of rests, by moving the first one to the specified
 % offset, and disabling all the other ones including any associated dots.
 #(define (merge-to-offset rests offset)
-   (ly:grob-set-property! (car rests) 'Y-offset offset)
+   (ly:grob-set-property! (car rests) 'staff-position offset)
    (for-each
     (lambda (rest)
-      (ly:grob-set-property! rest 'Y-offset offset)
+      (ly:grob-set-property! rest 'staff-position offset)
       (if (not (null? (ly:grob-object rest 'dot)))
          (ly:grob-set-property! (ly:grob-object rest 'dot) 'stencil #f)))
     (cdr rests)))
@@ -58,7 +58,7 @@
              (lambda (rests)
                (if (all-equal rests mmrest-same-length)
                    (let ((offset (if (eq? (ly:grob-property (car rests)
-                                            'measure-count) 1) 1 0)))
+                                            'measure-count) 1) 2 0)))
                      (merge-to-offset rests offset)))))
             (curr-rests '())
             (rests '()))

It turns out the code was already compensating for the incorrect
positioning of R1 rests. I have now ensured it also works correctly
for r1 rests, by using staff-position instead of Y-offset. 

I'm also attaching the fully patched file for reference.

-- Peter

Attachment: rests8.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]