lilypond-devel
[Top][All Lists]
Advanced

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

don't abort aligning when grob's parent is a PaperColumn (issue 7564044)


From: janek . lilypond
Subject: don't abort aligning when grob's parent is a PaperColumn (issue 7564044)
Date: Sun, 17 Mar 2013 23:58:50 +0000

Reviewers: dak,

Message:
Please review.
You'll find a sample test file in tracker issue:
http://code.google.com/p/lilypond/issues/detail?id=3254

Description:
don't abort aligning when grob's parent is a PaperColumn

This results in all lyrics being aligned according to self-alignment-X,
including unassociated lyrics that were previously all left-aligned.

this should pass regtests with expected differencies in the following
files:
lyrics centered instead of left-aligned:
alignment-order.ly
midi/lyrics-addlyrics-midi.ly
page-spacing-nonstaff-lines-between.ly
page-spacing-nonstaff-lines-top.ly
lyric-no-association-rhythm.ly
hairpin-ending.ly
markup-special-characters.ly
span-bar.ly
lyric-tweak.ly
instrument-name.ly
instrument-name-pedal-lyrics.ly

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

Affected files:
  M lily/self-alignment-interface.cc


Index: lily/self-alignment-interface.cc
diff --git a/lily/self-alignment-interface.cc b/lily/self-alignment-interface.cc index 59adfc3e6ca04d878349f6e3425843c703694c45..c3c8d6cfa01278afcd9ea9274d98b259d2b2cc5a 100644
--- a/lily/self-alignment-interface.cc
+++ b/lily/self-alignment-interface.cc
@@ -131,10 +131,17 @@ SCM
 Self_alignment_interface::aligned_on_parent (Grob *me, Axis a)
 {
   Grob *him = me->get_parent (a);
-  if (Paper_column::has_interface (him))
-    return scm_from_double (0.0);

-  Interval he = him->extent (him, a);
+  Interval he;
+  if (Paper_column::has_interface (him))
+ // PaperColumn extents aren't reliable (they depend on size and alignment + // of grobs that are children of the PaperColumn), so we cannot use them.
+    // Therefore we just fake an average NoteHead extent.
+ // This situation (i.e. having PaperColumn as a parent) happens for example
+    // for unassociated lyrics (i.e. lyrics without associatedVoice).
+    he = Interval (0, 1.4);
+  else
+    he = Interval (him->extent (him, a));

   SCM sym = (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X")
             : ly_symbol2scm ("self-alignment-Y");





reply via email to

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