From 36bb1a592b0c33c466ffd4f5e7a05c8b5b225a28 Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Sat, 10 Jan 2015 22:36:07 -0800 Subject: [PATCH] resolve note-collisions in absence of explicit voicing; issue 4255 --- lily/note-collision.cc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lily/note-collision.cc b/lily/note-collision.cc index a0be58907a..728f64dfae 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -503,24 +503,23 @@ Note_collision_interface::automatic_shift (Grob *me, if (i == 0) offset = inner_offset; - else if (shifts[i] == shifts[i - 1]) - { - // Match the previous notecolumn offset, - // but warn if the user did not set these equal shifts explictly - if (!scm_is_number (sh)) - col->warning (_ ("this Voice needs a \\voiceXx or \\shiftXx setting")); - } - else if (extents[d][i][UP] > extents[d][i - 1][DOWN] - && extents[d][i][DOWN] < extents[d][i - 1][UP]) - offset += 1.0; // fully clear the inner-voice heads else { - // check if we cross the inner voice - if (d * extents[d][i][-d] >= d * extents[d][i - 1][d]) + bool explicit_shift = scm_is_number (sh); + if (!explicit_shift) + col->warning (_ ("this Voice needs a \\voiceXx or \\shiftXx setting")); + + if (explicit_shift && shifts[i] == shifts[i - 1]) + ; // Match the previous notecolumn offset + else if (extents[d][i][UP] > extents[d][i - 1][DOWN] + && extents[d][i][DOWN] < extents[d][i - 1][UP]) + offset += 1.0; // fully clear the previous-notecolumn heads + else if (d * extents[d][i][-d] >= d * extents[d][i - 1][d]) offset += Stem::is_valid_stem (stems[d][i - 1]) - ? 1.0 : 0.5; + ? 1.0 : 0.5; // we cross the previous notecolumn else if (Stem::is_valid_stem (stems[d][i])) offset += 0.5; + // check if we cross the opposite-stemmed voices if (d * extents[d][i][-d] < d * extent_union[-d][d]) offset = max (offset, 0.5); -- 2.39.5