- Direction dir = get_grob_direction (me);
-
- Real staff_space = Staff_symbol_referencer::staff_space (me);
- Real staff_position = tie_position;
-
- Grob *common[NO_AXES];
- for (int a = X_AXIS; a < NO_AXES; a++)
- {
- Axis ax ((Axis) a);
- common[ax] = me->get_bound (LEFT)->common_refpoint (me, ax);
- common[ax] = me->get_bound (RIGHT)->common_refpoint (common[a], ax);
- }
-
- Interval attachments;
-
- Direction d = LEFT;
- Real gap = robust_scm2double (me->get_property ("x-gap"), 0.2);
- do
- {
- attachments[d]
- = robust_relative_extent (me->get_bound (d),
- common[X_AXIS],
- X_AXIS)[-d]
- - gap * d;
- }
- while (flip (&d) != LEFT);
-
- bool in_between = true;
- if (attachments.length () < 0.6 * staff_space)
- {
- /*
- Let short ties start over note heads, instead of between.
- */
- Drul_array<bool> allow (true, true);
-
- Direction d = LEFT;
- do {
- if (Note_head::has_interface (me->get_bound (d)))
- {
- Grob *stem = unsmob_grob (me->get_bound (d)->get_object ("stem"));
- if (get_grob_direction (stem) == dir
- && -d == dir)
- allow[d] = false;
- }
- } while (flip (&d) != LEFT);
-
- if (allow[LEFT] && allow[RIGHT])
- {
- staff_position += dir;
- do
- {
- if (Note_head::has_interface (me->get_bound (d)))
- {
- Interval extent
- = robust_relative_extent (me->get_bound (d),
- common[X_AXIS], X_AXIS);
-
- attachments[d] = extent.linear_combination (- 0.5 * d);
- in_between = false;
- }
- }
- while (flip (&d) != LEFT);
- }
- }
-
- SCM details = me->get_property ("details");
-
- SCM limit
- = scm_assq (ly_symbol2scm ("height-limit"), details);
-
- Real h_inf = robust_scm2double (scm_cdr (limit), 0.75) * staff_space;
- Real r_0 = robust_scm2double (scm_cdr (scm_assq (ly_symbol2scm ("ratio"), details)),
- .333);
-
- Bezier b = slur_shape (attachments.length(),
- h_inf, r_0);
- b.scale (1, dir);