]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #295.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 17 Feb 2007 22:35:37 +0000 (23:35 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 17 Feb 2007 22:35:37 +0000 (23:35 +0100)
For invisible stems, use note head extent for gapped beams.

input/regression/chord-tremolo-whole.ly [new file with mode: 0644]
lily/beam.cc

diff --git a/input/regression/chord-tremolo-whole.ly b/input/regression/chord-tremolo-whole.ly
new file mode 100644 (file)
index 0000000..74f4e57
--- /dev/null
@@ -0,0 +1,3 @@
+\version "2.11.16"
+\relative c'''{    \repeat tremolo 32{ g64 a }} 
index 02ee8c4f3bb6b50c5334eed5c2efcdc4ec8483e3..f9bd03d9d200026c3e218aa4baab98b34d2a36b6 100644 (file)
@@ -453,7 +453,24 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
                {
                  current.horizontal_[event_dir] += event_dir * segs[j].width_/2;
                  if (segs[j].gapped_)
-                   current.horizontal_[event_dir] -= event_dir * gap_length;  
+                   {
+                     current.horizontal_[event_dir] -= event_dir * gap_length;
+
+                     if (Stem::is_invisible (segs[j].stem_))
+                       {
+                         /*
+                           Need to do this in case of whole notes. We don't want the
+                           heads to collide with the beams.
+                          */
+                         extract_grob_set (segs[j].stem_, "note-heads", heads);
+
+                         for (vsize k = 0; k < heads.size (); k ++)
+                           current.horizontal_[event_dir]
+                             = event_dir * min  (event_dir * current.horizontal_[event_dir],
+                                                 - gap_length/2
+                                                 + event_dir * heads[k]->extent (commonx, X_AXIS)[-event_dir]);
+                       }
+                   }
                }
 
              if (event_dir == RIGHT)