From: Han-Wen Nienhuys Date: Mon, 2 Aug 2004 17:13:20 +0000 (+0000) Subject: * lily/text-spanner.cc (print): use it. X-Git-Tag: release/2.3.11~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2c0780ef1aa618d3ae255ffd4226d6a139c5746c;p=lilypond.git * lily/text-spanner.cc (print): use it. * 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. --- diff --git a/ChangeLog b/ChangeLog index 1574f1b03f..455ccb2102 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-08-02 Han-Wen Nienhuys + * 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 diff --git a/lily/dynamic-text-spanner.cc b/lily/dynamic-text-spanner.cc index 80a955d98b..19963fe458 100644 --- a/lily/dynamic-text-spanner.cc +++ b/lily/dynamic-text-spanner.cc @@ -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); diff --git a/lily/grob.cc b/lily/grob.cc index acdc6b0d3f..1c3aa91fa3 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -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 { diff --git a/lily/include/grob.hh b/lily/include/grob.hh index e3506c4071..b653ec25d3 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -148,5 +148,7 @@ SCM substitute_mutable_property_alist (SCM alist); Link_array ly_scm2grobs (SCM ell); SCM ly_grobs2scm (Link_array a); +Interval robust_relative_extent (Grob*, Grob*, Axis); + #endif /* GROB_HH */ diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 4795e5bb0a..dea9d39d3e 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -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));