lilypond-devel
[Top][All Lists]
Advanced

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

Re: Fix issues 1259 and 1433 (\breakDynamicSpan and a spanner's style=#


From: reinhold . kainhofer
Subject: Re: Fix issues 1259 and 1433 (\breakDynamicSpan and a spanner's style=#'none over a line break) (issue4630070)
Date: Sun, 26 Jun 2011 11:56:33 +0000

Reviewers: Neil Puttock,

Message:
On 2011/06/26 11:34:20, Neil Puttock wrote:
Hi Reinhold,

I'm afraid this fails `make check'.
dynamics-alignment-no-line-linebreak.ly
weirdly works directly without a hitch, but crashes under test
conditions:

Hmm, okay, it seems that -ddump-signatures also has problems with
spanners without a parent...

lilypond -ddump-signatures=#t dynamics-alignment-no-line-linebreak.ly
address@hidden:~/lilypond/lilypond/input/regression$ lilypond
-ddump-signatures=#t dynamics-alignment-no-line-linebreak.ly
GNU LilyPond 2.15.3
»dynamics-alignment-no-line-linebreak.ly« wird verarbeitet
Analysieren...
Interpretation der Musik...
Vorverarbeitung der grafischen Elemente...
Ideale Seitenanzahl wird gefunden...
Musik wird auf eine Seite angepasst...
Systeme erstellen...
Layout nach »dynamics-alignment-no-line-linebreak.ps« ausgeben...
Writing dynamics-alignment-no-line-linebreak-1.signature
Writing dynamics-alignment-no-line-linebreak-2.signatureERROR: In
procedure ly_grob_extent:
ERROR: Wrong type argument in position 2 (expecting common refpoint):
#<Grob System >


BTW, did you notice that the altered regtest you posted still doesn't
work
properly?  The final diminuendo spanner is still suicided due to
invalid bounds.

Hmm, you are right. If the spanner ends on the first note after a line
break, there are still problems...


Cheers,
Reinhold



Description:
Fix  issues 1259 and 1433 (\breakDynamicSpan and a spanner's
style=#'none over a line break)

With \breakDynamicSpan and \override DynamicTextSpanner #'style = #'none
the DynamicLineSpanner will be artificially shortened to allow
independent
vertical alignment. In these cases, the dynamic spanners will no longer
be fully contained in their parent DynamicLineSpanner.

The Spanner::do_break_processing() function, however, checks if the
spanner is fully contained in its parent. The above cases are valid
cases where this is violated, so an exception is added to that check.

The only way to achieve this is to set a property
(parent-spanner-shortened)
for all children of the shortened DynamicLineSpanner. The
Spanner::do_break_processing function then can simply check
for this property and allow all spanners with that property to span
more than the parent spanner.

This fixes both issues 1259 and 1433:
http://code.google.com/p/lilypond/issues/detail?id=1259
http://code.google.com/p/lilypond/issues/detail?id=1433

Please review this at http://codereview.appspot.com/4630070/

Affected files:
  A input/regression/dynamics-alignment-breaker-linebreak.ly
  A input/regression/dynamics-alignment-no-line-linebreak.ly
  M lily/dynamic-align-engraver.cc
  M lily/spanner.cc
  M scm/define-grob-properties.scm


Index: input/regression/dynamics-alignment-breaker-linebreak.ly
diff --git a/input/regression/dynamics-alignment-breaker-linebreak.ly b/input/regression/dynamics-alignment-breaker-linebreak.ly
new file mode 100644
index 0000000000000000000000000000000000000000..39402b76d3b968cb5131269a515378aec6afd545
--- /dev/null
+++ b/input/regression/dynamics-alignment-breaker-linebreak.ly
@@ -0,0 +1,14 @@
+\version "2.15.3"
+
+\header {
+  texidoc = "@code{\\breakDynamicSpan} shall also work if a
+dynamic spanner goes over a line break.
+"
+}
+
+\relative c' {
+  c1 c1_\< \break
+  c1 \breakDynamicSpan
+  c1_\dim
+  f,1\p
+}
Index: input/regression/dynamics-alignment-no-line-linebreak.ly
diff --git a/input/regression/dynamics-alignment-no-line-linebreak.ly b/input/regression/dynamics-alignment-no-line-linebreak.ly
new file mode 100644
index 0000000000000000000000000000000000000000..20b515fa7b4ec75fb4b3c857e61b6481509ba9dc
--- /dev/null
+++ b/input/regression/dynamics-alignment-no-line-linebreak.ly
@@ -0,0 +1,14 @@
+\version "2.15.3"
+
+\header {
+ texidoc = "Setting the style of a @code{DynamicTextSpanner} to @code{'none}
+to hide the line altogether should also work over line breaks.
+"
+}
+
+\relative c'' {
+  \override DynamicTextSpanner #'style = #'none
+  c2\cresc c2
+  \break
+  g,2 c'2\f
+}
Index: lily/dynamic-align-engraver.cc
diff --git a/lily/dynamic-align-engraver.cc b/lily/dynamic-align-engraver.cc
index f62c45f0dc6d3adec09cccf6e700fa1722806a24..205826b0386ce5db53e36e4d45d4e73eef57f342 100644
--- a/lily/dynamic-align-engraver.cc
+++ b/lily/dynamic-align-engraver.cc
@@ -177,6 +177,16 @@ Dynamic_align_engraver::stop_translation_timestep ()
            }

          line_->set_bound (d, bound);
+          /* Indicate that the line spanner was shortened and the child
+           * spanners are not necessarily contained (check in
+           * Spanner::do_break_processing)!  This can only be done
+           * by setting the partent-spanner-shortened flag for all child
+           * spanners of the dynamic line spanner. */
+          set<Spanner *>::iterator it;
+          for ( it=running_.begin() ; it != running_.end(); it++ )
+            {
+              (*it)->set_property ("parent-spanner-shortened", SCM_BOOL_T);
+            }
        }
     }
   while (flip (&d) != LEFT);
Index: lily/spanner.cc
diff --git a/lily/spanner.cc b/lily/spanner.cc
index 30638bfed44d64f7c44743b8a2a465d0b543ee47..796536ec24409a6ff05348230f5d6fa01e845439 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -83,7 +83,8 @@ Spanner::do_break_processing ()

       /*
        Check if our parent in X-direction spans equally wide
-       or wider than we do.
+       or wider than we do. If the parent-spanner-shortened property
+       is set, this may be violated.
       */
       for (int a = X_AXIS; a < NO_AXES; a++)
        {
@@ -91,6 +92,8 @@ Spanner::do_break_processing ()
            parent_rank_slice.intersect (parent->spanned_rank_interval ());
        }

+ bool parent_shortened = to_boolean(get_property ("parent-spanner-shortened"));
+
       for (vsize i = 1; i < break_points.size (); i++)
        {
          Drul_array<Item *> bounds;
@@ -112,6 +115,10 @@ Spanner::do_break_processing ()

bool ok = parent_rank_slice.contains (bounds[LEFT]->get_column ()->get_rank ()); ok = ok && parent_rank_slice.contains (bounds[RIGHT]->get_column ()->get_rank ());
+         /* A dynamic line spanner may be broken (with \breakDynamicSpan or
+          * because of a DynamicTextSpanner's style of none). In these cases,
+          * the parent spanner does NOT contain the whole child. */
+         ok = ok || parent_shortened;

          if (!ok)
            {
@@ -548,4 +555,5 @@ ADD_INTERFACE (Spanner,
               "normalized-endpoints "
               "minimum-length "
               "to-barline "
+              "parent-spanner-shortened "
               );
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 8f05a8b324a366f90fb9227b9f893fa6fdf7f57e..3cc9b1d0ccce3f9deda00c75d94d00b90d2fecb6 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -1111,6 +1111,9 @@ entries @code{name} and @code{interfaces}.")
      (minimum-distances ,list? "A list of rods that have the format
 @code{(@var{obj} . @var{dist})}.")

+     (parent-spanner-shortened ,boolean? "Indicates that a spanner's parent
+spanner was artificially shortened and the spanner may not be fully contained
+in the spanner.")
      (positioning-done ,boolean? "Used to signal that a positioning element
 did its job.  This ensures that a positioning is only done once.")
      (pure-Y-extent ,number-pair? "The estimated height of a system.")



reply via email to

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