From: Han-Wen Nienhuys Date: Tue, 7 Nov 2006 15:43:12 +0000 (+0100) Subject: Examine Stem::duration_log() for preventing merge of quarter and half X-Git-Tag: release/2.10.0-2~31^2~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b1c421e9b4fae8a98703db55df29289ae191ea4a;p=lilypond.git Examine Stem::duration_log() for preventing merge of quarter and half note. Fixes collision-heads.ly. Add separate regtest for that. --- 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 ");