]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/text-spanner.cc (print): use it.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 2 Aug 2004 17:13:20 +0000 (17:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 2 Aug 2004 17:13:20 +0000 (17:13 +0000)
* lily/dynamic-text-spanner.cc (print): use it.

* lily/grob.cc (robust_relative_extent): new function.

* lily/text-spanner.cc (print): only take linear_combination of
nonempty interval.

ChangeLog
lily/dynamic-text-spanner.cc
lily/grob.cc
lily/include/grob.hh
lily/text-spanner.cc

index 1574f1b03f02efe0f77511b663d3a28f13ab1b72..455ccb2102302cc54d03cc9ad0dcab8e06b07282 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2004-08-02  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/text-spanner.cc (print): use it.
+
+       * lily/dynamic-text-spanner.cc (print): use it.
+
+       * lily/grob.cc (robust_relative_extent): new function.
+
        * scripts/lilypond-book.py (main): add -f tex as default process.
 
        * lily/text-spanner.cc (print): only take linear_combination of
index 80a955d98b37a337fe4f418c024402c98e34aa2b..19963fe4587e215359ddabce3e85b921a68614c7 100644 (file)
@@ -88,10 +88,9 @@ Dynamic_text_spanner::print (SCM smob)
            }
 
          Interval ext  = b->extent (common, X_AXIS);
-         span_points[d] = -d  * pad +
-           (ext.is_empty ())
-           ? b->relative_coordinate (common, X_AXIS) 
-           : ext.linear_combination (encl);
+         span_points[d] = -d  * pad
+           + robust_relative_extent (b,common, X_AXIS)
+           .linear_combination (encl);
        }
     }
   while (flip (&d) != LEFT);
index acdc6b0d3fc681adad2543363d6dfe0abe979e1b..1c3aa91fa3bd662f758af994f9a05ca42e34c2f4 100644 (file)
@@ -137,6 +137,19 @@ Grob::stencil_extent (SCM element_smob, SCM scm_axis)
   return ly_interval2scm (e);
 }
 
+
+Interval
+robust_relative_extent (Grob*me, Grob*refp, Axis a)
+{
+  Interval ext =  me->extent  (refp, a);
+  if (ext.is_empty())
+    {
+      ext.add_point (me->relative_coordinate (refp, a));
+    }
+
+  return ext;      
+}
+
 Output_def *
 Grob::get_paper () const
 {
index e3506c4071c9b867663757a71e16799d92877ab3..b653ec25d3f7856b64824f18ca53aab12e5f3bdb 100644 (file)
@@ -148,5 +148,7 @@ SCM substitute_mutable_property_alist (SCM alist);
 Link_array<Grob> ly_scm2grobs (SCM ell);
 SCM ly_grobs2scm (Link_array<Grob> a);
 
+Interval robust_relative_extent (Grob*, Grob*, Axis); 
+
 #endif /* GROB_HH */
 
index 4795e5bb0ad86c33770312943f25c23f8ea68b64..dea9d39d3ec90a8232d0ee6d069127806be6039d 100644 (file)
@@ -68,9 +68,7 @@ Text_spanner::print (SCM smob)
            Interval ext = b->extent (common, X_AXIS);
            
            span_points[d] =
-             (ext.is_empty())
-             ? b->relative_coordinate (common, X_AXIS)
-             : ext.linear_combination (d * encl);
+             robust_relative_extent (b, common, X_AXIS).linear_combination (d * encl);
 
            if (is_number_pair (shorten))
              span_points -= d * ly_scm2double (index_get_cell (shorten, d));