Reviewers: ,
Message:
Please review.
Thanks,
Torsten
Description:
issue 5413: X-aligning problem with chords containing unisons
Changes to be committed:
modified: ../lily/stem.cc Stem::extremal_heads
- To avoid confusion, process noteheads in <> from left to right
- lowest note: return FIRST unison note (punctum saliens!)
- highest note: return LAST unison note
Separate DOWN/UP processing now (because of < vs. >=).
Result: consistent spacing plus correct first/last/main notehead
detection.
new file: ../input/regression/chord-X-align-on-main-noteheads.ly
- Regression test added
Please review this at https://codereview.appspot.com/369840043/
Affected files (+24, -7 lines):
A input/regression/chord-X-align-on-main-noteheads.ly
M lily/stem.cc
Index: input/regression/chord-X-align-on-main-noteheads.ly
diff --git a/input/regression/chord-X-align-on-main-noteheads.ly
b/input/regression/chord-X-align-on-main-noteheads.ly
new file mode 100644
index
..a3fab79f70fb07425e16eb07147437b3b7a35319
--- /dev/null
+++ b/input/regression/chord-X-align-on-main-noteheads.ly
@@ -0,0 +1,14 @@
+\version "2.21.0"
+
+\header {
+ texidoc = "Chords containing unisons or seconds:
+Center articulation marks, dynamics, slurs, etc. on the notehead that
+is on the “correct” side of the stem."
+}
+
+{
+ e''4-^ -^\p -^\f -^
+ (\< )\! \> ~ \!
+ f'-^ -^\p -^\f -^
+ (\< )\! \> ~ \!
+}
Index: lily/stem.cc
diff --git a/lily/stem.cc b/lily/stem.cc
index
947a429c23f472770474dd10c9fb8abb8a4053e6..239b15b07fd415a2b0e6c6d55d971df8adc8580f
100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -220,20 +220,23 @@ Stem::extremal_heads (Grob *me)
Drul_array exthead (0, 0);
extract_grob_set (me, "note-heads", heads);
- for (vsize i = heads.size (); i--;)
+ for (vsize i = 0; i < heads.size (); i++)
{
Grob *n = heads[i];
int p = Staff_symbol_referencer::get_rounded_position (n);
- for (LEFT_and_RIGHT (d))
+ if (p < extpos[DOWN]) /* < lowest note unison: take FIRST one */
{
- if (d * p > d * extpos[d])
-{
- exthead[d] = n;
- extpos[d] = p;
-}
+ exthead[DOWN] = n;
+ extpos[DOWN] = p;
+}
+ if (p >= extpos[UP])/* >= highest note unison: take LAST one */
+{
+ exthead[UP] = n;
+ extpos[UP] = p;
}
}
+
return exthead;
}
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel