From b75db784e3d6a9e1d2cff3f77036aaa88598b53c Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 7 Nov 2006 16:43:12 +0100 Subject: [PATCH] Examine Stem::duration_log() for preventing merge of quarter and half note. Fixes collision-heads.ly. Add separate regtest for that. --- .../collision-merge-differently-headed.ly | 25 ++++++++++++++++++++++ lily/note-collision.cc | 13 ++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 input/regression/collision-merge-differently-headed.ly diff --git a/input/regression/collision-merge-differently-headed.ly b/input/regression/collision-merge-differently-headed.ly new file mode 100644 index 0000000000..62e6e6b7a8 --- /dev/null +++ b/input/regression/collision-merge-differently-headed.ly @@ -0,0 +1,25 @@ +\version "2.7.39" +\header { + texidoc = + + "If @code{merge-differently-headed} is enabled, then +open note heads may be merged with black noteheads, but only +if the black note heads are from 8th or shorter notes. +" + +} + +\layout { ragged-right= ##t } + + +\context Staff \relative c'' << + { + \override Staff.NoteCollision #'merge-differently-headed = ##t + c2 c8 c4. + c2 + }\\ + { + c8 c4. c2 + c4 + } +>> diff --git a/lily/note-collision.cc b/lily/note-collision.cc index bce6d08a60..ddfbf19983 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -39,6 +39,9 @@ check_meshing_chords (Grob *me, if (!Note_column::get_stem (cu) || !Note_column::get_stem (cd)) return; + Drul_array stems (Note_column::get_stem (cd), + Note_column::get_stem (cu)); + Grob *nu = Note_column::first_head (cu); Grob *nd = Note_column::first_head (cd); @@ -90,10 +93,10 @@ check_meshing_chords (Grob *me, /* Should never merge quarter and half notes, as this would make them indistinguishable. */ if (merge_possible - && ((Rhythmic_head::duration_log (nu) == 1 - && Rhythmic_head::duration_log (nd) == 2) - || (Rhythmic_head::duration_log (nu) == 2 - && Rhythmic_head::duration_log (nd) == 1))) + && ((Stem::duration_log (stems[UP]) == 1 + && Stem::duration_log (stems[DOWN]) == 2) + || (Stem::duration_log (stems[UP]) == 2 + && Stem::duration_log (stems[DOWN]) == 1))) merge_possible = false; /* @@ -535,4 +538,4 @@ ADD_INTERFACE (Note_collision_interface, "note-collision-interface", /* properties */ "merge-differently-dotted " "merge-differently-headed " - "positioning-done"); + "positioning-done "); -- 2.11.4.GIT