- Real dy = fabs (middle[Y_AXIS] - edge[Y_AXIS]);
- bool in_space = !(Staff_symbol_referencer::on_staffline (me, (int) staff_position));
- bool fits_in_space =
- (dy < 0.6 * staff_space);
-
- /*
- Avoid dot
- */
- Grob *left_dot = unsmob_grob (me->get_bound (LEFT)->get_object ("dot"));
- if (left_dot && in_space)
- {
- if (staff_position == Staff_symbol_referencer::get_position (left_dot))
- {
- staff_position += dir;
- in_space = false;
-
- if (skylines)
- {
- Real y = staff_space * 0.5 * staff_position;
- attachments = get_skyline_attachment (*skylines, y);
- attachments.widen (-gap);
- Bezier b = slur_shape (attachments.length(),
- details.height_limit_,
- details.ratio_);
- Offset middle = b.curve_point (0.5);
- Offset edge = b.curve_point (0.0);
- dy = fabs (middle[Y_AXIS] - edge[Y_AXIS]);
- fits_in_space =
- (dy < 0.6 * staff_space);
- }
- }
- }
- /*
- Avoid flag.
- */
- Grob *left_stem = unsmob_grob (me->get_bound (LEFT)->get_object ("stem"));
- if (left_stem)
- {
- Stencil flag = Stem::get_translated_flag (left_stem);
- Real y = staff_position * staff_space * 0.5;
- if (flag.extent (Y_AXIS).contains (y))
- {
- staff_position += dir;
- in_space = !in_space;
- }
- }
-
- if (in_space != fits_in_space)
- {
- if (in_space)
- {
- staff_position += dir;
- }
- else
- {
- in_space = true;
- staff_position += dir;
- }
-
- /*
- ugh: code dup.
- */
- if (skylines)
- {
- Real y = staff_space * 0.5 * staff_position;
- attachments = get_skyline_attachment (*skylines, y);
- attachments.widen (-gap);
-
- Bezier b = slur_shape (attachments.length(),
- details.height_limit_,
- details.ratio_);
- Offset middle = b.curve_point (0.5);
- Offset edge = b.curve_point (0.0);
- dy = fabs (middle[Y_AXIS] - edge[Y_AXIS]);
- fits_in_space =
- (dy < 0.6 * staff_space);
- }
- }