From: Mike Solomon Date: Thu, 16 Jun 2011 08:34:48 +0000 (+0200) Subject: Modifies Spanner::spanner_length to better handle line spanners. X-Git-Tag: release/2.14.2-1~44 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c3b1f46a10cbcb4abbd9f54200506bda2077bfdf;p=lilypond.git Modifies Spanner::spanner_length to better handle line spanners. With this change, the normalized endpoints should be correct for all spanners with correct bound information. --- diff --git a/lily/spanner.cc b/lily/spanner.cc index 9fe94ab3ac..30638bfed4 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -239,13 +239,28 @@ Spanner::Spanner (Spanner const &s) Real Spanner::spanner_length () const { - Real l = spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS); - Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS); + Interval lr; - if (r < l) + Drul_array bounds (get_property ("left-bound-info"), + get_property ("right-bound-info")); + + Direction d = LEFT; + do + lr[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"), + bounds[d], SCM_BOOL_F), -d); + while (flip (&d) != LEFT); + + if (lr.is_empty ()) + { + do + lr[d] = spanned_drul_[d]->relative_coordinate (0, X_AXIS); + while (flip (&d) != LEFT); + } + + if (lr.is_empty ()) programming_error ("spanner with negative length"); - return r - l; + return lr.length (); } System *