2006-11-05 Han-Wen Nienhuys <hanwen@lilypond.org>
+ * lily/dynamic-engraver.cc:
+ formatting cleanup
+
+ * input/regression/note-head-harmonic.ly:
+ * lily/stem.cc:
+ * input/regression/note-head-harmonic-whole.ly:
+ Center harmonic heads if stem is invisible. Fixes #140
+
* lily/input.cc:
end context snippet with '\n'
texidoc = " The handling of stems for harmonic notes must be
completely identical to normal note heads.
- Harmonic heads do not get dots. If @code{harmonicAccidentals} is unset, they also don't get accidentals."
+ Harmonic heads do not get dots. If @code{harmonicAccidentals} is
+ unset, they also don't get accidentals."
}
"alignments. The symbols are collected onto a DynamicLineSpanner grob\n"
"which takes care of vertical positioning. ",
- /* create */ "DynamicLineSpanner DynamicText Hairpin TextSpanner",
+ /* create */
+ "DynamicLineSpanner "
+ "DynamicText "
+ "Hairpin "
+ "TextSpanner ",
+
/* read */ "",
/* write */ "");
dir = UP;
set_grob_direction (me, dir);
}
-
+
+ bool is_harmonic_centered = false;
+ for (vsize i = 0; i < heads.size (); i++)
+ is_harmonic_centered = is_harmonic_centered
+ || heads[i]->get_property ("style") == ly_symbol2scm ("harmonic");
+ is_harmonic_centered = is_harmonic_centered && is_invisible (me);
+
Real w = hed->extent (hed, X_AXIS)[dir];
for (vsize i = 0; i < heads.size (); i++)
- heads[i]->translate_axis (w - heads[i]->extent (heads[i], X_AXIS)[dir],
- X_AXIS);
+ {
+ Real amount = w - heads[i]->extent (heads[i], X_AXIS)[dir];
+ if (is_harmonic_centered)
+ amount =
+ hed->extent (hed, X_AXIS).linear_combination (CENTER)
+ - heads[i]->extent (heads[i], X_AXIS).linear_combination (CENTER);
+
+ heads[i]->translate_axis (amount, X_AXIS);
+ }
bool parity = true;
Real lastpos = Real (Staff_symbol_referencer::get_position (heads[0]));
for (vsize i = 1; i < heads.size (); i++)