]> git.donarmstrong.com Git - lilypond.git/commitdiff
Use the full pure Y-extent for complete systems.
authorJoe Neeman <joeneeman@gmail.com>
Mon, 24 Aug 2009 21:03:50 +0000 (14:03 -0700)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 24 Aug 2009 21:07:11 +0000 (14:07 -0700)
For staves within a system, we split up the pure Y-extent into the Y-extent of
the prefatory matter and the Y-extent of the rest (thereby emulating a crude
skyline).  Between systems, we use a single extent box.  Before this commit, we
were ignoring the Y-extent of the prefatory matter altogether; now the extent
box is correct.

lily/align-interface.cc
lily/axis-group-interface.cc
lily/constrained-breaking.cc
lily/include/axis-group-interface.hh

index 2931043303a42b04f22666d1fc60d2f7405e81e0..3d68bce912115b9bf16baba295895b428e8d6002 100644 (file)
@@ -89,13 +89,6 @@ get_skylines (Grob *me,
        {
          assert (a == Y_AXIS);
          Interval extent = g->pure_height (g, start, end);
-         if (!extent.is_empty ())
-           {
-             Box b;
-             b[a] = extent;
-             b[other_axis (a)] = Interval (0, infinity_f);
-             skylines.insert (b, 0, other_axis (a));
-           }
 
          // This is a hack to get better accuracy on the pure-height of VerticalAlignment.
          // It's quite common for a treble clef to be the highest element of one system
@@ -111,6 +104,7 @@ get_skylines (Grob *me,
          if (Axis_group_interface::has_interface (g)
              && !Hara_kiri_group_spanner::request_suicide (g, start, end))
            {
+             extent = Axis_group_interface::rest_of_line_pure_height (g, start, end);
              Interval begin_of_line_extent = Axis_group_interface::begin_of_line_pure_height (g, start);
              if (!begin_of_line_extent.is_empty ())
                {
@@ -120,6 +114,14 @@ get_skylines (Grob *me,
                  skylines.insert (b, 0, other_axis (a));
                }
            }
+
+         if (!extent.is_empty ())
+           {
+             Box b;
+             b[a] = extent;
+             b[other_axis (a)] = Interval (0, infinity_f);
+             skylines.insert (b, 0, other_axis (a));
+           }
        }
 
       if (skylines.is_empty ())
index 00a8219ec044ee526a36b3f075c90485a79d82e4..396a95857c38a56b306bc0a9b26eb3b35fc44220 100644 (file)
@@ -77,6 +77,15 @@ Axis_group_interface::relative_group_extent (vector<Grob*> const &elts,
 
 Interval
 Axis_group_interface::cached_pure_height (Grob *me, int start, int end)
+{
+  Interval iv = begin_of_line_pure_height (me, start);
+  iv.unite (rest_of_line_pure_height (me, start, end));
+
+  return iv;
+}
+
+Interval
+Axis_group_interface::rest_of_line_pure_height (Grob *me, int start, int end)
 {
   SCM adjacent_pure_heights = me->get_property ("adjacent-pure-heights");
 
index 8fb24f1eab90f668b40e7de5eecd034547bf91e3..98722c53db4d1fc9f4a11b26423512e470cbabd3 100644 (file)
@@ -387,6 +387,12 @@ Constrained_breaking::initialize ()
          line.turn_permission_ = min_permission (line.page_permission_,
                                                  line.turn_permission_);
 
+         // TODO: see the hack regarding begin_of_line and
+         // rest_of_line extents in align-interface.  Perhaps we
+         // should do the same thing here so that the effect extends
+         // between systems as well as within systems.  It isn't as
+         // crucial here, however, because the effect is largest when
+         // dealing with large systems.
          line.extent_ = (extent.is_empty ()
                          || isnan (extent[LEFT])
                          || isnan (extent[RIGHT]))
index 95aa9f3bc555c2e5695445df70bd5fe1c736ae79..0e8aae57b0ed5e4386d9dbec237e22db937bee5d 100644 (file)
@@ -34,6 +34,7 @@ struct Axis_group_interface
   static Interval combine_pure_heights (Grob *me, SCM, int, int);
   static Interval cached_pure_height (Grob *me, int, int);
   static Interval begin_of_line_pure_height (Grob *me, int);
+  static Interval rest_of_line_pure_height (Grob *me, int, int);
 
   static Grob *calc_pure_elts_and_common (Grob*);
   static Skyline_pair skyline_spacing (Grob *me, vector<Grob*> elements);