summaryrefslogtreecommitdiff
path: root/lily/spanner.cc
diff options
context:
space:
mode:
authorMike Solomon <mike@apollinemike.com>2011-06-16 10:34:48 +0200
committerMike Solomon <mike@apollinemike.com>2011-06-16 10:34:48 +0200
commitd02c9ba13cc3a7c96cc6374e232e94501a833ed1 (patch)
tree3b0dbb49e36a5e46a9fd88b4db49164c58c1e904 /lily/spanner.cc
parent551366717e02aa0bbcde43cdd301b32a1b484728 (diff)
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.
Diffstat (limited to 'lily/spanner.cc')
-rw-r--r--lily/spanner.cc23
1 files changed, 19 insertions, 4 deletions
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<SCM> 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 *