lilypond-devel
[Top][All Lists]
Advanced

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

Issue 5387: align brackets only to visible Stems (issue 346130043 by add


From: lilypond
Subject: Issue 5387: align brackets only to visible Stems (issue 346130043 by address@hidden)
Date: Thu, 19 Jul 2018 07:58:47 -0700

Reviewers: ,

Message:
This doesn’t follow Gould (see sf tracker for her suggestion) but
modifies LilyPond’s current behaviour: If there is a stem on the same
side/direction, align to that. Else align to the rest/note head.


https://codereview.appspot.com/346130043/diff/1/lily/tuplet-bracket.cc
File lily/tuplet-bracket.cc (right):

https://codereview.appspot.com/346130043/diff/1/lily/tuplet-bracket.cc#newcode75
lily/tuplet-bracket.cc:75: && unsmob<Stencil> (s->get_property
("stencil")))
I tried to put this check (does the Stem have a stencil?) into
Stem::is_invisible but that seems to be the wrong thing.

Description:
Issue 5387: align brackets only to visible Stems

TupletBrackets and LigatureBrackets now don’t take into account stems of
rests, whole and longer notes and stems that are omitted.

Contains regtests.

Please review this at https://codereview.appspot.com/346130043/

Affected files (+41, -1 lines):
  A input/regression/ligature-bracket-X-positions.ly
  A input/regression/tuplet-bracket-X-positions.ly
  M lily/tuplet-bracket.cc


Index: input/regression/ligature-bracket-X-positions.ly
diff --git a/input/regression/ligature-bracket-X-positions.ly b/input/regression/ligature-bracket-X-positions.ly
new file mode 100644
index 0000000000000000000000000000000000000000..88299c5643a1772920337d8144b60788cbb5c98b
--- /dev/null
+++ b/input/regression/ligature-bracket-X-positions.ly
@@ -0,0 +1,17 @@
+\version "2.21.0"
+
+\header {
+  texidoc = "Ligature brackets should align to visible or transparent
+stems only. For stemless notes they should span the whole note width."
+}
+
+\relative {
+  \[ a'1 b \]
+  \[ a4 b \]
+  \hide Stem
+  \[ a b \]
+  \omit Stem % stencil = ##f
+  \[ a4 b \]
+  \override Stem.stencil = #'()
+  \[ a b \]
+}
\ No newline at end of file
Index: input/regression/tuplet-bracket-X-positions.ly
diff --git a/input/regression/tuplet-bracket-X-positions.ly b/input/regression/tuplet-bracket-X-positions.ly
new file mode 100644
index 0000000000000000000000000000000000000000..ad6d814dcc29e552ec92311544dca633aad85137
--- /dev/null
+++ b/input/regression/tuplet-bracket-X-positions.ly
@@ -0,0 +1,18 @@
+\version "2.21.0"
+
+\header {
+  texidoc = "Tuplet brackets should align to visible or transparent
+stems only. For stemless notes or rests they should span the whole
+note width."
+}
+
+\relative {
+  \override TupletBracket.bracket-visibility = ##t
+  \override TupletBracket.shorten-pair = #'(0 . 0)
+
+  \tuplet 3/2 1 { g'1 g2 g g1 }
+
+  \tuplet 3/2 4 { a8[ a r] r[ a a] }
+  \override Stem.stemlet-length = #1
+  \tuplet 3/2 4 { a[ a r] r[ a a] }
+}
\ No newline at end of file
Index: lily/tuplet-bracket.cc
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index 3228c9f7b6edab7b79b7c7dbea8500b3284fafe0..47355ebe3d6cd6256ecf9f891b9a80e02f7058c0 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -69,7 +69,12 @@ get_x_bound_item (Grob *me_grob, Direction hdir, Direction my_dir)
   if (has_interface<Note_column> (g)
       && Note_column::get_stem (g)
       && Note_column::dir (g) == my_dir)
-    g = Note_column::get_stem (g);
+    {
+      Item *s = Note_column::get_stem (g);
+      if (!Stem::is_invisible (s)
+          && unsmob<Stencil> (s->get_property ("stencil")))
+        g = s;
+    }

   return g;
 }



reply via email to

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