From: Joe Neeman Date: Thu, 17 Jun 2010 07:31:56 +0000 (+0300) Subject: Fix 801 and 1088. X-Git-Tag: release/2.13.25-1~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5cd72e7e39e897837c54986db593d4a4e49a1468;p=lilypond.git Fix 801 and 1088. Manually shift the dots on a rest so that the horizontal collision avoidance sees them (even though they cannot be positioned properly until after line breaking). --- diff --git a/input/regression/dot-rest-horizontal-spacing.ly b/input/regression/dot-rest-horizontal-spacing.ly new file mode 100644 index 0000000000..b294ba231e --- /dev/null +++ b/input/regression/dot-rest-horizontal-spacing.ly @@ -0,0 +1,8 @@ +\version "2.13.24" + +\header { + texidoc = "The dots on a dotted rest are correctly accounted for +in horizontal spacing." +} + +{ r16. cis'' } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index e36980a92f..2951741fb6 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -128,7 +128,7 @@ Dot_column::calc_positioning_done (SCM smob) stems.insert (stem); } - for (set::const_iterator i(stems.begin()); + for (set::const_iterator i (stems.begin()); i != stems.end (); i++) { Grob *stem = (*i); @@ -148,8 +148,13 @@ Dot_column::calc_positioning_done (SCM smob) vector_sort (dots, position_less); for (vsize i = dots.size (); i--;) - if (!dots[i]->is_live ()) - dots.erase (dots.begin () + i); + { + if (!dots[i]->is_live ()) + dots.erase (dots.begin () + i); + else + // Undo any fake translations that were done in add_head. + dots[i]->translate_axis (-dots[i]->relative_coordinate (me, X_AXIS), X_AXIS); + } Dot_formatting_problem problem (boxes, base_x); @@ -210,9 +215,14 @@ Dot_column::add_head (Grob *me, Grob *head) Pointer_group_interface::add_grob (me, ly_symbol2scm ("dots"), d); d->set_property ("Y-offset", Grob::x_parent_positioning_proc); - // Dot formatting requests the Y-offset, -which- for rests may - // trigger post-linebreak callbacks. - if (!Rest::has_interface (head)) + // Dot formatting requests the Y-offset, which for rests may + // trigger post-linebreak callbacks. On the other hand, we need the + // correct X-offset of the dots for horizontal collision avoidance. + // The translation here is undone in calc_positioning_done, where we + // do the X-offset properly. + if (Rest::has_interface (head)) + d->translate_axis (head->extent (head, X_AXIS).length (), X_AXIS); + else d->set_property ("X-offset", Grob::x_parent_positioning_proc); Axis_group_interface::add_element (me, d); }