lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

issue 5413: X-aligning problem with chords containing unisons (issue 369


From: torsten . haemmerle
Subject: issue 5413: X-aligning problem with chords containing unisons (issue 369840043 by address@hidden)
Date: Wed, 05 Sep 2018 13:05:12 -0700

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 0000000000000000000000000000000000000000..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-^ <e'' e''>-^\p <c'' e'' e''>-^\f <a' d'' e''>-^
+  <f'' f''>(\< <e'' e''>)\! <f'' f''>\> ~ <f'' f''>\!
+  f'-^ <f' f'>-^\p <f' f' a'>-^\f <f' g' c''>-^
+  <e' e'>(\< <f' f'>)\! <e' e'>\> ~ <e' e'>\!
+}
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<Grob *> 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;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]