}
/*
- We look at the width of the note head, since smaller heads get less space
+ The main factor that determines the amount of space is the width of the
+ note head (or the rest). For example, a quarter rest gets almost 0.5 ss
+ less horizontal space than a note.
- eg. a quarter rest gets almost 0.5 ss less horizontal space than a note.
-
- What is sticking out of the note head (eg. a flag), doesn't get
- the full amount of space.
+ The other parts of a note column (eg. flags, accidentals, etc.) don't get
+ the full amount of space. We give them half the amount of space, but then
+ adjust things so there are no collisions.
*/
- Real min_dist = Spacing_interface::minimum_distance (me);
- Real min_desired_space = max (left_head_end + (min_dist - left_head_end) / 2,
- min_dist - (base_space - increment) / 2);
+ Drul_array<Skyline> skys = Spacing_interface::skylines (me, right_col);
+ Real min_dist = max (0.0, skys[LEFT].distance (skys[RIGHT]));
+ Real min_desired_space = left_head_end + (min_dist - left_head_end) / 2;
+
+ /* if the right object sticks out a lot, include a bit of extra space.
+ But only for non-musical-columns; this shouldn't apply to accidentals */
+ if (!Paper_column::is_musical (right_col))
+ min_desired_space = max (min_desired_space,
+ left_head_end + LEFT * skys[RIGHT].max_height ());
+
Real ideal = base_space - increment + min_desired_space;
stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space);
Spring ret (ideal, min_dist);
- ret.set_inverse_compress_strength (ideal - max (min_dist, min_desired_space));
+ ret.set_inverse_compress_strength (max (0.0, ideal - max (min_dist, min_desired_space)));
+ ret.set_inverse_stretch_strength (max (0.1, base_space - increment));
return ret;
}