]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/side-position-interface.cc
lilypond-book: Textwidth detection with included file (issue 3136).
[lilypond.git] / lily / side-position-interface.cc
index 5a8ecb74c91b8eac59f6489995b63daecfee2d80..026a3286c55e9fae2c8d275aa5fb089dc1072c34 100644 (file)
@@ -314,6 +314,27 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i
       dim.set_minimum_height (staff_extents[dir]);
     }
 
+  // Sometimes, we want to side position for grobs but they
+  // don't position against anything.  Some cases where this is true:
+  //   - StanzaNumber if the supporting lyrics are hara-kiri'd
+  //     SystemStartBracket
+  //     InstrumentName
+  // In all these cases, we set the height of the support to 0.
+  // This becomes then like the self-alignment-interface with the
+  // caveat that there is padding added.
+  // TODO: if there is a grob that never has side-support-elements
+  // (like InstrumentName), why are we using this function? Isn't it
+  // overkill? A function like self-alignment-interface with padding
+  // works just fine.
+  // One could even imagine the two interfaces merged, as the only
+  // difference is that in self-alignment-interface we align on the parent
+  // where as here we align on a group of grobs.
+  if (dim.is_empty ())
+    {
+      dim = Skyline (dim.direction ());
+      dim.set_minimum_height (0.0);
+    }
+
   // Many cross-staff grobs do not have good height estimations.
   // We give the grob the best chance of not colliding by shifting
   // it to the maximum height in the case of cross-staff alignment.