From 95890ee80ae464e70e425dbd39b9798ff27d2bb7 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 7 Jun 2007 22:15:04 -0300 Subject: [PATCH] Fix #362 (2) Try not to look at height of a stem in rest collisions. --- input/regression/dot-column-rest-collision.ly | 10 ++++++++++ lily/include/note-column.hh | 1 - lily/rest-collision.cc | 20 +++++++++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 input/regression/dot-column-rest-collision.ly diff --git a/input/regression/dot-column-rest-collision.ly b/input/regression/dot-column-rest-collision.ly new file mode 100644 index 0000000000..f706d4ef6d --- /dev/null +++ b/input/regression/dot-column-rest-collision.ly @@ -0,0 +1,10 @@ +\header { + texidoc = "Dot columns do not trigger beam slanting too early." +} + +\version "2.11.26" +\paper{ ragged-right=##t } +<< + { e''8 e''8 g'' g''} \\ + { e8 r4. } +>> diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 429b83af3e..8646f120fe 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -26,7 +26,6 @@ public: static Grob *accidentals (Grob *me); static Grob *arpeggio (Grob *me); static Slice head_positions_interval (Grob *me); - static Direction static_dir (Grob *); static void translate_rests (Grob *me, int dy); static Grob *first_head (Grob *me); static Grob *get_rest (Grob *me); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 063b773a92..dd92f083e3 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -227,8 +227,24 @@ Rest_collision::calc_positioning_done (SCM smob) Interval notedim; for (vsize i = 0; i < notes.size (); i++) - notedim.unite (notes[i]->extent (common, Y_AXIS)); - + { + if (Note_column::dir (notes[i]) == -dir) + { + /* try not to look at the stem, as looking at a beamed + note may trigger beam positioning prematurely. + + This happens with dotted rests, which need Y + positioning to compute X-positioning. + */ + Grob *head = Note_column::first_head (notes[i]); + if (head) + notedim.unite (head->extent (common, Y_AXIS)); + else + programming_error ("Note_column without first_head()"); + } + else + notedim.unite (notes[i]->extent (common, Y_AXIS)); + } Real y = dir * max (0.0, -dir * restdim[-dir] + dir * notedim[dir] + minimum_dist); -- 2.39.5