]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix refpoints in align-interface.
authorJoe Neeman <joeneeman@gmail.com>
Thu, 21 Dec 2006 12:03:54 +0000 (14:03 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Thu, 21 Dec 2006 12:03:54 +0000 (14:03 +0200)
Fine-tune padding/minimum-Y-extent of staves

lily/align-interface.cc
ly/engraver-init.ly
scm/define-grobs.scm

index e4505675dff7620cf08f68bff9015f86b4d8e013..690f2a4921d7bd0c97297948364f7848297ac123 100644 (file)
@@ -138,13 +138,25 @@ get_skylines (Grob *me,
              bool pure, int start, int end,
              vector<Skyline_pair> *const ret)
 {
-  Grob *other_axis_common = common_refpoint_of_array (*elements, me, other_axis (a));
+  /* each child's skyline was calculated according to the common refpoint of its
+     elements. Here we need all the skylines to be positioned with respect to
+     a single refpoint, so we need the common refpoint of the common refpoints
+     of the elements of the children */
+  vector<Grob*> child_refpoints;
+  for (vsize i = 0; i < elements->size (); i++)
+    {
+      extract_grob_set ((*elements)[i], "elements", child_elts);
+      Grob *child_common = common_refpoint_of_array (child_elts, (*elements)[i], other_axis (a));
+      child_refpoints.push_back (child_common);
+    }
+  Grob *common_refpoint = common_refpoint_of_array (child_refpoints, me, other_axis (a));
+  
   for (vsize i = elements->size (); i--;)
     {
       Grob *g = (*elements)[i];
       Interval extent = g->maybe_pure_extent (g, a, pure, start, end);
       Interval other_extent = pure ? Interval (-infinity_f, infinity_f)
-       : g->extent (other_axis_common, other_axis (a));
+       : g->extent (common_refpoint, other_axis (a));
       Box b = (a == X_AXIS) ? Box (extent, other_extent) : Box (other_extent, extent);
       
       if (extent.is_empty ())
@@ -179,8 +191,9 @@ get_skylines (Grob *me,
              b[a] = ly_scm2interval (min_extent);
              skylines.insert (b, 0, other_axis (a));
            }
-         Real offset = g->relative_coordinate (other_axis_common, other_axis (a));
-         skylines.shift (-offset);
+
+         Real offset = child_refpoints[i]->relative_coordinate (common_refpoint, other_axis (a));
+         skylines.shift (offset);
        }
 
 
@@ -234,7 +247,7 @@ Align_interface::get_extents_aligned_translates (Grob *me,
       else
        dy = skylines[j-1][stacking_dir].distance (skylines[j][-stacking_dir]);
 
-      where += stacking_dir * (dy + padding + extra_space / elems.size ());
+      where += stacking_dir * max (0.0, dy + padding + extra_space / elems.size ());
       translates.push_back (where);
     }
 
index 6907308aab1577977113ec9653f528c088af8f6e..f69cc77fbc6b75a7f9aa22783d8abde7239c0952 100644 (file)
@@ -57,7 +57,7 @@
   \consists "Figured_bass_position_engraver"
   \consists "Script_row_engraver"
 
-  \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4)
+  \override VerticalAxisGroup #'minimum-Y-extent = #'(-3.5 . 3.5)
   localKeySignature = #'()
   createSpacing = ##t
   ignoreFiguredBassRest = ##t 
@@ -358,7 +358,7 @@ staffs, with a bracket in front and spanning bar lines. "
 
 \context{
   \type "Engraver_group"
-  \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.2 . 2.4)
+  \override VerticalAxisGroup #'minimum-Y-extent = #'(-0.75 . 2.0)
 
   \description " Corresponds to a voice with lyrics.  Handles the
 printing of a single line of lyrics.  "
@@ -416,7 +416,7 @@ printing of a single line of lyrics.  "
   \consists "Hara_kiri_engraver"
 %  \consists "Note_spacing_engraver"
   voltaOnThisStaff = ##f
-  \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 2.5)
+  \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 2)
   \override SeparatingGroupSpanner #'padding = #0.8
   \override VerticalAxisGroup #'remove-first = ##t
   \override VerticalAxisGroup #'remove-empty = ##t
@@ -635,7 +635,7 @@ AncientRemoveEmptyStaffContext = \context {
 
   \override VerticalAxisGroup #'remove-empty = ##t
   \override VerticalAxisGroup #'remove-first = ##t
-  \override VerticalAxisGroup #'minimum-Y-extent = #'(-0.5 . 2.5)
+  \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 2)
 }
 
 \context {
index a794f75470ba16e892353429638d2b6c955b8598..f6f778b150bd72552670df6265f4cc2551e5b7da 100644 (file)
        (positioning-done . ,ly:align-interface::calc-positioning-done)
        (Y-extent . ,ly:axis-group-interface::height)
        (stacking-dir . -1)
+       (padding . 0.2)
        (meta . ((class . Spanner)
                 (interfaces . (align-interface
                                bass-figure-alignment-interface
        (Y-extent . ,ly:axis-group-interface::height)
        (X-extent . ,ly:axis-group-interface::width)
        (stacking-dir . -1)
-       (padding . 0.1)
+       (padding . 0.5)
        (skylines . ,ly:axis-group-interface::combine-skylines)
        (meta . ((class . Spanner)
                 (interfaces . (align-interface