From: Mike Solomon Date: Fri, 23 Mar 2012 08:30:41 +0000 (+0100) Subject: Positions TupletNumber correctly when Script and Slur are present. X-Git-Tag: release/2.15.35-1~21 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ab8e2a788867c1539a014d7d74242715f340aa00;p=lilypond.git Positions TupletNumber correctly when Script and Slur are present. There was previously a circular dependency that went: TupletNumber needs TupletBracket position TupletBracket needs Script position Script with avoid-slur set to around or outside needs Slur position Slur needs TupletNumber position This is avoided by not doing Script vs TupletBracket collision avoidance for Scripts that (a) are encompassed by a slur; and (b) have avoid-slur set to outside or around. The worst-case scenario, then, is the same collision that would have been present before Slur vs TupletBracket collision avoidance was implemented. A more thorough solution would be to have an avoid-tuplet-bracket property that functions like avoid-slur. --- diff --git a/input/regression/tuplet-number-slur-script.ly b/input/regression/tuplet-number-slur-script.ly new file mode 100644 index 0000000000..6ccab60a8e --- /dev/null +++ b/input/regression/tuplet-number-slur-script.ly @@ -0,0 +1,14 @@ +\version "2.15.35" + +\header { + texidoc = "Tuplet number position is correct when slurs and scripts +are present. +" +} + +\relative c' +{ + R1 | + \break + \times 2/3 { e8(-> e e) } +} diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 40e0c728c5..3cf7190bb1 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -669,6 +669,14 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) if (scm_is_number (scripts[i]->get_property ("outside-staff-priority"))) continue; + // assume that if a script is avoiding slurs, it should not get placed + // under a tuplet bracket + SCM avoid = scripts[i]->get_property ("avoid-slur"); + if (unsmob_grob (scripts[i]->get_object ("slur")) + && (avoid == ly_symbol2scm ("outside") + || avoid == ly_symbol2scm ("around"))) + continue; + Interval script_x (scripts[i]->extent (commonx, X_AXIS)); Interval script_y (scripts[i]->extent (commony, Y_AXIS));