+ /*
+ Avoid too steep slurs.
+ */
+ SCM s = me->get_property ("slope-limit");
+ if (gh_number_p (s))
+ {
+ Array<Offset> encompass = get_encompass_offsets (me);
+ Drul_array<Offset> attachment;
+ attachment[LEFT] = encompass[0];
+ attachment[RIGHT] = encompass.top ();
+
+ Real dx = attachment[RIGHT][X_AXIS] - attachment[LEFT][X_AXIS];
+ Real dy = attachment[RIGHT][Y_AXIS] - attachment[LEFT][Y_AXIS];
+ if (!dx)
+ return;
+
+ Real slope = slope = abs (dy / dx);
+
+ Real limit = gh_scm2double (s);
+
+ if (slope > limit)
+ {
+ Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me);
+ Direction dir = (Direction)gh_scm2int (me->get_property ("direction"));
+ Direction d = (Direction) (- dir * (sign (dy)));
+ SCM a = me->get_property ("attachment-offset");
+ Drul_array<Offset> o;
+ o[LEFT] = ly_scm2offset (index_get_cell (a, LEFT));
+ o[RIGHT] = ly_scm2offset (index_get_cell (a, RIGHT));
+ o[d][Y_AXIS] -= (limit - slope) * dx * dir / staff_space;
+
+ o[d][Y_AXIS] *= get_grob_direction (me);
+
+ me->set_property ("attachment-offset",
+ gh_cons (ly_offset2scm (o[LEFT]),
+ ly_offset2scm (o[RIGHT])));
+ }
+ }
+
+}