lilypond-devel
[Top][All Lists]
Advanced

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

rest-collision


From: Klaus Zimmermann
Subject: rest-collision
Date: Fri, 25 Oct 2002 23:34:16 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021006

Hi,

the current code in lily/rest-collision.cc which kills
the rests of the same measure that are supernumerary
according to the maximum-rest-count variable can lead to
very bad spacing.

This effect seem only to rests of a duration of 2 or more.
An extract from the piece I experienced it with is:

---------------begin sample------------------
soprano = \notes \relative c'' \context Voice = soprano {
    \voiceOne
    g2. g2 g4 g2. ~ g2 r4
    a2. a2 ~ a8 g f2. g2 \times 2/3 { g8 a b }
    c4 c r c c r8 b b4 a g f g aes
    c c r r2 b8 c c2. ~ c2 b4
    c2. r2. r2. r2.
}

alto = \notes \relative c' \context Voice = alto {
    \voiceTwo
    e2. f2 d4 e2.( )d2 r4
    e2. e4 d e e d c c d \times 2/3 { d8 e f }
    g4 g r gis gis r8 g g4 f e d e f
    g g r r2 g8 a a2. ~ a2 g4
    c2. r2. r2. r2.
}

\score {
    \context Staff = women <
        \time 3/4
        \soprano
        \alto
    >
    \paper {
        papersize = "a4"
        \translator {
            \StaffContext
            RestCollision \override #'maximum-rest-count = #1
        }
    }
    \midi { }
}
----------------end sample-------------------


I changed the behaviour from killing the rests to making
them as well as there dots transparent. (patch attached)

regards Klaus Zimmermann
Index: lilypond/ChangeLog
===================================================================
RCS file: /cvsroot/lilypond/lilypond/ChangeLog,v
retrieving revision 1.575
diff -p -u -r1.575 ChangeLog
--- lilypond/ChangeLog  24 Oct 2002 08:13:49 -0000      1.575
+++ lilypond/ChangeLog  25 Oct 2002 21:03:47 -0000
@@ -1,3 +1,7 @@
+2002-10-25  Klaus Zimmermann  <address@hidden>
+       * lily/rest-collision.cc: joining common rests of two (or more?)
+       voices in one staff could wreck the spacing. Fixed.
+       
 2002-10-23  Han-Wen Nienhuys  <address@hidden>
 
        * input/regression/multi-measure-rest-center.ly: new file.
Index: lilypond/Documentation/topdocs/AUTHORS.texi
===================================================================
RCS file: /cvsroot/lilypond/lilypond/Documentation/topdocs/AUTHORS.texi,v
retrieving revision 1.28
diff -p -u -r1.28 AUTHORS.texi
--- lilypond/Documentation/topdocs/AUTHORS.texi 12 Aug 2002 12:01:11 -0000      
1.28
+++ lilypond/Documentation/topdocs/AUTHORS.texi 25 Oct 2002 21:03:47 -0000
@@ -83,6 +83,8 @@ list is alphabetically ordered.
 @item @email{rune@@zedeler.dk, Rune Zedeler}
     Drum notation, beaming and auto-accidental code. Font
 updates. Miscellaneous fixes.
address@hidden @email{klaus_zimmermann@@gmx.de, Klaus Zimmermann}
+    minor fix in rest-collision.
 @end itemize
 
 @bye
Index: lilypond/lily/rest-collision.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/lily/rest-collision.cc,v
retrieving revision 1.75
diff -p -u -r1.75 rest-collision.cc
--- lilypond/lily/rest-collision.cc     11 Jul 2002 10:55:24 -0000      1.75
+++ lilypond/lily/rest-collision.cc     25 Oct 2002 21:03:48 -0000
@@ -143,10 +143,32 @@ Rest_collision::do_shift (Grob *me, SCM 
          display_count = gh_scm2int (s);
          for (; i > display_count; i--)
            {
+             /**
+              * This old code wrecks the spacing with rests >= r2
+              * -- at least it did in my 3/4 timed piece.
+              * Grob* r = unsmob_grob (rests[i-1]->get_grob_property ("rest"));
+              * if (r)
+              *   r->suicide ();
+              * rests[i-1]->suicide ();
+              */
              Grob* r = unsmob_grob (rests[i-1]->get_grob_property ("rest"));
              if (r)
-               r->suicide ();
-             rests[i-1]->suicide ();
+               {
+                 r->set_grob_property ("transparent", gh_bool2scm(1));
+                 r = unsmob_grob (r->get_grob_property ("dot"));
+                 if (r)
+                   r->set_grob_property ("transparent", gh_bool2scm(1));
+               }
+           }
+         for (int j=i; j>0; j--)
+           {
+             Grob* r = unsmob_grob (rests[j-1]->get_grob_property ("rest"));
+             if (r)
+               {
+                 r = unsmob_grob (r->get_grob_property ("dot"));
+                 if (r)
+                   r->set_grob_property ("direction", gh_int2scm(0) );
+               }
            }
        }
       else

reply via email to

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