- if (!correct)
- return 0.0;
- /*
- Ugh. 7 is hardcoded.
- */
- Real correction = abs (intersect.length ());
- correction = (correction/7) <? 1.0;
- correction *= stem_dirs[LEFT] ;
- correction *= gh_scm2double (me->get_grob_property ("stem-spacing-correction"));
- return correction;
+ if (correct_stem_dirs && stem_dirs[LEFT] * stem_dirs[RIGHT] == -1)
+ {
+ if (beams_drul[LEFT] && beams_drul[LEFT] == beams_drul[RIGHT])
+ {
+
+ /*
+ this is a knee: maximal correction.
+ */
+ Real note_head_width = increment;
+ Grob *st = stems_drul[RIGHT];
+ Grob *head = st ? Stem::support_head (st) : 0;
+
+ Interval head_extent;
+ if (head)
+ {
+ head_extent = head->extent (rcolumn, X_AXIS);
+
+ if (!head_extent.is_empty ())
+ note_head_width = head_extent[RIGHT];
+
+ if (st)
+ {
+ Real thick = Stem::thickness (st);
+
+ note_head_width -= thick;
+ }
+ }
+
+ correction = note_head_width * stem_dirs[LEFT];
+ correction *= robust_scm2double (me->get_property ("knee-spacing-correction"), 0);
+ *fixed += correction;
+ }
+ else
+ {
+ intersect = stem_posns[LEFT];
+ intersect.intersect (stem_posns[RIGHT]);
+ correct_stem_dirs = correct_stem_dirs && !intersect.is_empty ();
+
+ if (correct_stem_dirs)
+ {
+ correction = abs (intersect.length ());
+
+ /*
+ Ugh. 7 is hardcoded.
+ */
+ correction = min (correction / 7, 1.0);
+ correction *= stem_dirs[LEFT];
+ correction
+ *= robust_scm2double (me->get_property ("stem-spacing-correction"), 0);
+ }
+
+ if (!bar_yextent.is_empty ())
+ correction *= 0.5;
+ }