]> git.donarmstrong.com Git - lilypond.git/commitdiff
Positions TupletNumber correctly when Script and Slur are present.
authorMike Solomon <mike@apollinemike.com>
Fri, 23 Mar 2012 08:30:41 +0000 (09:30 +0100)
committerMike Solomon <mike@apollinemike.com>
Fri, 23 Mar 2012 08:30:41 +0000 (09:30 +0100)
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.

input/regression/tuplet-number-slur-script.ly [new file with mode: 0644]
lily/tuplet-bracket.cc

diff --git a/input/regression/tuplet-number-slur-script.ly b/input/regression/tuplet-number-slur-script.ly
new file mode 100644 (file)
index 0000000..6ccab60
--- /dev/null
@@ -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) }
+}
index 40e0c728c5ef2c353de391bd5da025386bce7007..3cf7190bb1ce2722741c1711858f96ec5fc18007 100644 (file)
@@ -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));