Reviewers: ,
Message:
This, in tandem with the modification to spanner_length, leads to better
optical results for feathered beam breaking.
Description:
Attaches bound info to beam for better normalized-endpoint calculations.
Also adds a slight modification to the print function to take into
account
the width of the last stem.
Please review this at http://codereview.appspot.com/4605047/
Affected files:
M lily/beam.cc
Index: lily/beam.cc
diff --git a/lily/beam.cc b/lily/beam.cc
index
8a30752c386eccd8294b181c5dd18159c2b492d2..a49b35c98b7a2bbd8d7b9b243abb8f89a899b3ae
100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -560,13 +560,15 @@ Beam::print (SCM grob)
if (normal_stem_count (me))
{
span[LEFT] = first_normal_stem (me)->relative_coordinate (commonx,
X_AXIS);
- span[RIGHT] = last_normal_stem (me)->relative_coordinate (commonx,
X_AXIS);
+ span[RIGHT] = last_normal_stem (me)->relative_coordinate (commonx,
X_AXIS)
+ + last_normal_stem (me)->extent (commonx,
X_AXIS).length ();
}
else
{
extract_grob_set (me, "stems", stems);
span[LEFT] = stems[0]->relative_coordinate (commonx, X_AXIS);
- span[RIGHT] = stems.back ()->relative_coordinate (commonx, X_AXIS);
+ span[RIGHT] = stems.back ()->relative_coordinate (commonx, X_AXIS)
+ + stems.back ()->extent (commonx, X_AXIS).length ();
}
Real blot = me->layout ()->get_dimension (ly_symbol2scm
("blot-diameter"));
@@ -581,6 +583,15 @@ Beam::print (SCM grob)
else
pos = ly_scm2realdrul (posns);
+ // allows correct normalized endpoints to be calculated
+ Direction d = LEFT;
+ Drul_array<SCM> bound_info (ly_symbol2scm ("left-bound-info"),
ly_symbol2scm ("right-bound-info"));
+
+ do
+ me->set_property (bound_info[d], scm_list_2 (scm_cons (ly_symbol2scm
("X"), scm_from_double (span[d])),
+ scm_cons (ly_symbol2scm
("Y"), scm_from_double (pos[d]))));
+ while (flip (&d) != LEFT);
+
scale_drul (&pos, Staff_symbol_referencer::staff_space (me));
Real dy = pos[RIGHT] - pos[LEFT];
@@ -1862,12 +1873,14 @@ ADD_INTERFACE (Beam,
"grow-direction "
"inspect-quants "
"knee "
+ "left-bound-info "
"length-fraction "
"least-squares-dy "
"neutral-direction "
"normal-stems "
"positions "
"quantized-positions "
+ "right-bound-info "
"shorten "
"stems "
);
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel