- if (!bar_size.is_empty ())
- if (Grob *stem = Note_column::get_stem (g))
- {
- Direction d = Stem::get_direction (stem);
- if (d == DOWN)
- {
- Real stem_start = Stem::head_positions (stem) [DOWN];
- Real stem_end = Stem::stem_end_position (stem);
- Interval stem_posns (stem_start <? stem_end,
- stem_end >? stem_start);
-
- stem_posns.intersect (bar_size);
-
- Real corr = abs (stem_posns.length ()/7.) <? 1.0;
- corr *=
- robust_scm2double (me->get_property ("stem-spacing-correction"), 1);
-
- if (d != DOWN)
- corr = 0.0;
- max_corr = max_corr >? corr;
- }
- }
- return max_corr;
-}
+ Real optical_corr = 0.0;
+ Grob *stem = Note_column::get_stem (g);
+ if (!bar_size.is_empty ()
+ && !arpeggio
+ && !accs
+ && stem)
+ {
+ Direction d = get_grob_direction (stem);
+ if (Stem::is_normal_stem (stem) && d == DOWN)
+ {
+
+ /*
+ can't look at stem-end-position, since that triggers
+ beam slope computations.
+ */
+ Real stem_start = Stem::head_positions (stem) [d];
+ Real stem_end = stem_start +
+ d * robust_scm2double (stem->get_property ("length"), 7);
+
+ Interval stem_posns (min (stem_start, stem_end),
+ max (stem_end, stem_start));
+
+ stem_posns.intersect (bar_size);
+
+ optical_corr = min (abs (stem_posns.length () / 7.0), 1.0);
+ optical_corr *= robust_scm2double (me->get_property ("stem-spacing-correction"), 1);
+ }
+ }
+