Hi, attached is a patch for bug #218 (see http://code.google.com/p/lilypond/issues/detail?id=218). It simply tests whether the directions of stem and articulation coincide, and if so it shifts the latter sideways. Please note that the patch is just a casual attempt to get more familiar with Lilypond's internals and that the way it is implemented was derived mostly by trial-and-error and sophisticated guessing. So any suggestions for improvement are most welcome.
BTW, in the bug's description it says that only staccato marks should be centered on the stem, but I personally find it more appealing if this applies to any kind of articulation. If you think otherwise, I'd be happy to adapt the patch but I don't know how to test whether the grob actually is a staccato mark or something else. Cheers, Max
From 1922d0676cafafe07e9b613a9788ebc3032837f1 Mon Sep 17 00:00:00 2001 From: Maximilian Albert <[EMAIL PROTECTED](none)> Date: Fri, 28 Nov 2008 00:46:16 +0100 Subject: [PATCH] If articulation is over the stem, it should be centered on it (fixes bug #218) --- lily/script-engraver.cc | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index d0d713b..6ba1072 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -167,11 +167,18 @@ Script_engraver::process_music () void Script_engraver::acknowledge_stem (Grob_info info) { + Grob *stem = info.grob(); + int stem_dir = robust_scm2int(stem->get_property("direction"), 0); int script_count = scripts_.size (); for (int i = 0; i < script_count; i++) { Grob *e = scripts_[i].script_; + /* If articulation is above the stem, it should be centered on it */ + int script_dir = robust_scm2int(e->get_property("direction"), 0); + if (stem_dir == script_dir) + e->translate_axis(stem->relative_coordinate(e, X_AXIS), X_AXIS); + if (to_dir (e->get_property ("side-relative-direction"))) e->set_object ("direction-source", info.grob ()->self_scm ()); -- 1.5.4.3
<<attachment: before.png>>
<<attachment: after.png>>
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel