- }
- }
-
- if (!fix_broken_b)
- dy_f_drul_[RIGHT] += interstaff_f;
-
-
-
- return;
-
- /*
- Now we've got a fine slur
- Catch and correct some ugly cases
- */
- String infix = interstaff_b ? "interstaff_" : "";
- Real height_damp_f = paper_l ()->get_var ("slur_"+infix +"height_damping");
- Real slope_damp_f = paper_l ()->get_var ("slur_"+infix +"slope_damping");
- Real snap_f = paper_l ()->get_var ("slur_"+infix +"snap_to_stem");
- Real snap_max_dy_f = paper_l ()->get_var ("slur_"+infix +"snap_max_slope_change");
-
- Real dx_f = spanner_length ()+ dx_f_drul_[RIGHT] - dx_f_drul_[LEFT];
- Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
- if (!fix_broken_b)
- dy_f -= interstaff_f;
-
- /*
- Avoid too steep slurs.
- */
- Real slope_ratio_f = abs (dy_f / dx_f);
- if (slope_ratio_f > slope_damp_f)
- {
- Direction d = (Direction)(- my_dir * (sign (dy_f)));
- if (!d)
- d = LEFT;
- Real damp_f = (slope_ratio_f - slope_damp_f) * dx_f;
- /*
- must never change sign of dy
- */
- damp_f = damp_f <? abs (dy_f);
- dy_f_drul_[d] += my_dir * damp_f;
- }
-
- /*
- Avoid too high slurs
-
- Wierd slurs may look a lot better after they have been
- adjusted a bit.
- So, we'll do this in 3 steps
- */
- for (int i = 0; i < 3; i++)
- {
- Bezier c (get_curve ());
-
- Offset size (c.extent (X_AXIS).length (),
- c.extent (Y_AXIS).length ());
-
- dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
- if (!fix_broken_b)
- dy_f -= interstaff_f;
-
- Real height_ratio_f = abs (size[Y_AXIS] / size[X_AXIS]);
- if (height_ratio_f > height_damp_f)
- {
- Direction d = (Direction)(- my_dir * (sign (dy_f)));
- if (!d)
- d = LEFT;
- /* take third step */
- Real damp_f = (height_ratio_f - height_damp_f) * size[X_AXIS] / 3;
- /*
- if y positions at about the same height, correct both ends
- */
- if (abs (dy_f / dx_f ) < slope_damp_f)