2003-06-15 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * scm/define-grobs.scm (all-grob-descriptions): set
+ knee-spacing-correction to 1.0
+
+ * lily/note-spacing.cc (stem_dir_correction): compute knee
+ correction using stem-thickness and head width.
+
* input/regression/beam-quanting-horizontal.ly: update texidoc
* scm/define-grobs.scm (all-grob-descriptions): set
\version "1.7.18"
\header {
-texidoc = "For knees, the spacing correction is such that the
-stems are put at regular distances.
+
+ texidoc = "For knees, the spacing correction is such that the
+stems are put at regular distances. This effect takes into account the
+width of the note heads and the thickness of the stem.
"
}
\score { \notes
{
+g'8-[ g'8-]
g''8-[ g g'' g'']
+ %\property Voice.Stem \override #'thickness = #10
+ %g''8-[ g g'' g'']
}
\paper { raggedright = ##t}
}
#include "separation-item.hh"
#include "staff-spacing.hh"
#include "accidental-placement.hh"
+#include "paper-def.hh"
void
Note_spacing::get_spacing (Grob *me, Item* right_col,
me->get_grob_property ("right-items"));
Drul_array<Grob*> beams_drul(0,0);
+ Drul_array<Grob*> stems_drul(0,0);
stem_dirs[LEFT] = stem_dirs[RIGHT] = CENTER;
Interval intersect;
continue;
}
+ stems_drul[d] = stem;
beams_drul[d] = Stem::get_beam (stem);
correct_stem_dirs = false;
}
-
-
Interval hp = Stem::head_positions (stem);
Real chord_start = hp[sd];
Real stem_end = Stem::stem_end_position (stem);
{
if (beams_drul[LEFT] && beams_drul[LEFT] == beams_drul[RIGHT])
{
+
/*
this is a knee: maximal correction.
*/
-
- correction = increment* stem_dirs[LEFT];
+ 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.empty_b())
+ note_head_width = head_extent[RIGHT];
+
+ if (st)
+ {
+ Real thick = gh_scm2double (st->get_grob_property ("thickness"))
+ * st->get_paper ()->get_var ("linethickness");
+
+ note_head_width -= thick;
+ }
+ }
+
+ correction = note_head_width* stem_dirs[LEFT];
correction *= gh_scm2double (me->get_grob_property ("knee-spacing-correction"));
*fixed += correction;
}
. (
(breakable . #t)
(stem-spacing-correction . 0.4)
- (knee-spacing-correction . 0.75)
+
(meta . ((interfaces . (spacing-interface staff-spacing-interface item-interface ))))
))
(NoteSpacing
. (
(stem-spacing-correction . 0.5)
- (knee-spacing-correction . 0.75)
+
+ ;; Changed this from 0.75.
+ ;; If you ever change this back, please document! --hwn
+
+ (knee-spacing-correction . 1.0)
(meta . ((interfaces . (spacing-interface note-spacing-interface item-interface ))))
))