]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fixes a tuplet bracket bug caused by 32570e8ac85561afc1f59712301ee80c0d69d2b3.
authorMike Solomon <mike@apollinemike.com>
Mon, 29 Aug 2011 09:11:49 +0000 (11:11 +0200)
committerMike Solomon <mike@apollinemike.com>
Mon, 29 Aug 2011 09:11:49 +0000 (11:11 +0200)
Tuplet bracket positions were being calculated before beamed stem
positions were set.  This patch triggers the setting of stem positions
before the calculation of these brackets.

lily/tuplet-bracket.cc

index 67a00b4b2b86af0f8e46c617e78b25d02745271a..627d6fcfb04a961e531e7ee9aabd6bc3ae2afc34 100644 (file)
@@ -556,14 +556,21 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
       Drul_array<Grob *> stems (Note_column::get_stem (columns[0]),
                                 Note_column::get_stem (columns.back ()));
 
-      Real lp = stems[LEFT]->extent (stems[LEFT], Y_AXIS)[get_grob_direction (stems[LEFT])]
-                + stems[LEFT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
-      Real rp = stems[RIGHT]->extent (stems[RIGHT], Y_AXIS)[get_grob_direction (stems[RIGHT])]
-                + stems[RIGHT]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
-
-      *dy = rp - lp;
-      points.push_back (Offset (stems[LEFT]->relative_coordinate (commonx, X_AXIS) - x0, lp));
-      points.push_back (Offset (stems[RIGHT]->relative_coordinate (commonx, X_AXIS) - x0, rp));
+      Interval poss;
+      Direction side = LEFT;
+      do
+        {
+          // Trigger setting of stem lengths if necessary.
+          if (Grob *beam = Stem::get_beam (stems[side]))
+            (void) beam->get_property ("quantized-positions");
+          poss[side] = stems[side]->extent (stems[side], Y_AXIS)[get_grob_direction (stems[side])]
+                       + stems[side]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
+        }
+      while (flip (&side) != LEFT);
+
+      *dy = poss[RIGHT] - poss[LEFT];
+      points.push_back (Offset (stems[LEFT]->relative_coordinate (commonx, X_AXIS) - x0, poss[LEFT]));
+      points.push_back (Offset (stems[RIGHT]->relative_coordinate (commonx, X_AXIS) - x0, poss[RIGHT]));
     }
   else
     {