+Real
+Slur::get_first_notecolumn_y (Score_element *me, Direction dir)
+{
+ Score_element *col = dir == LEFT
+ ? unsmob_element (gh_car (scm_reverse (me->get_elt_property
+ ("note-columns"))))
+ : unsmob_element
+ (gh_car (me->get_elt_property ("note-columns")));
+
+ Score_element *common[] =
+ {
+ 0,
+ me->common_refpoint (col, Y_AXIS)
+ };
+ Real y;
+ if (col == ((Spanner*)me)->get_bound (dir))
+ {
+ y = get_attachment (me, dir, common)[Y_AXIS];
+ }
+ else
+ {
+ y = encompass_offset (me, col, common)[Y_AXIS]
+ - me->relative_coordinate (common[Y_AXIS], Y_AXIS);
+ }
+ return y;
+}
+
+Offset
+Slur::broken_trend_offset (Score_element *me, Direction dir)
+{
+ /*
+ A broken slur should maintain the same vertical trend
+ the unbroken slur would have had.
+ */
+ Offset o;
+ if (Spanner *mother = dynamic_cast<Spanner*> (me->original_l_))
+ {
+ for (int i = dir == LEFT ? 0 : mother->broken_into_l_arr_.size ();
+ dir == LEFT ? i < mother->broken_into_l_arr_.size () : i;
+ dir == LEFT ? i++ : --i)
+ {
+ if (mother->broken_into_l_arr_[i - dir] == me)
+ {
+ Score_element *neighbour = mother->broken_into_l_arr_[i];
+ if (dir == RIGHT)
+ neighbour->set_elt_property ("direction",
+ me->get_elt_property ("direction"));
+ Real neighbour_y = get_first_notecolumn_y (neighbour, dir);
+ Real y = get_first_notecolumn_y (me, -dir);
+ o = Offset (0, (y + neighbour_y) / 2);
+ break;
+ }
+ }
+ }
+ return o;
+}
+