- Grob *closest_to_flag = extremal_heads (me)[dir];
- Grob *dots = closest_to_flag
- ? Rhythmic_head::get_dots (closest_to_flag) : 0;
-
- if (dots)
- {
- Real dp = Staff_symbol_referencer::get_position (dots);
- Real flagy = flag (me).extent (Y_AXIS)[-dir] * 2 / ss;
-
- /* Very gory: add myself to the X-support of the parent,
- which should be a dot-column. */
- if (dir * (stem_end + flagy - dp) < 0.5)
- {
- Grob *par = dots->get_parent (X_AXIS);
-
- if (Dot_column::has_interface (par))
- {
- Side_position_interface::add_support (par, me);
-
- /* TODO: apply some better logic here. The flag is
- curved inwards, so this will typically be too
- much. */
- }
- }
- }
+ Interval overshoot;
+ Direction dir = get_grob_direction (me);
+ for (DOWN_and_UP (d))
+ overshoot[d] = d == dir ? dir * infinity_f : iv[d];
+
+ vector<Interval> heights;
+ vector<Grob *> my_stems;
+ extract_grob_set (beam, "normal-stems", normal_stems);
+ for (vsize i = 0; i < normal_stems.size (); i++)
+ if (get_grob_direction (normal_stems[i]) == dir)
+ {
+ if (normal_stems[i] != me)
+ heights.push_back (Stem::internal_pure_height (normal_stems[i], false));
+ else
+ heights.push_back (iv);
+ my_stems.push_back (normal_stems[i]);
+ }
+ //iv.unite (heights.back ());
+ // look for cross staff effects
+ vector<Real> coords;
+ Grob *common = common_refpoint_of_array (my_stems, me, Y_AXIS);
+ Real min_pos = infinity_f;
+ Real max_pos = -infinity_f;
+ for (vsize i = 0; i < my_stems.size (); i++)
+ {
+ coords.push_back (my_stems[i]->pure_relative_y_coordinate (common, 0, INT_MAX));
+ min_pos = min (min_pos, coords[i]);
+ max_pos = max (max_pos, coords[i]);
+ }
+ for (vsize i = 0; i < heights.size (); i++)
+ {
+ heights[i][dir] += dir == DOWN
+ ? coords[i] - max_pos
+ : coords[i] - min_pos;
+ }
+
+ for (vsize i = 0; i < heights.size (); i++) iv.unite (heights[i]);
+
+ for (vsize i = 0; i < my_stems.size (); i++)
+ cache_pure_height (my_stems[i], iv, heights[i]);
+ iv.intersect (overshoot);