]> git.donarmstrong.com Git - lilypond.git/commitdiff
Make loose lines use header/footer padding.
authorJoe Neeman <joeneeman@gmail.com>
Mon, 10 Aug 2009 03:29:40 +0000 (13:29 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 10 Aug 2009 03:53:43 +0000 (13:53 +1000)
input/regression/page-spacing-loose-lines-header-padding.ly [new file with mode: 0644]
lily/include/page-layout-problem.hh
lily/page-layout-problem.cc
ly/engraver-init.ly

diff --git a/input/regression/page-spacing-loose-lines-header-padding.ly b/input/regression/page-spacing-loose-lines-header-padding.ly
new file mode 100644 (file)
index 0000000..a3262da
--- /dev/null
@@ -0,0 +1,32 @@
+\version"2.13.4"
+
+\header {
+  texidoc = "Padding from the header and footer is measured to the first
+line, whether or not it is spaceable."
+}
+
+#(set-default-paper-size "a6")
+
+\book {
+  \paper {
+    first-system-spacing = #'((space . 1) (padding . 10))
+    last-system-spacing = #'((space . 1) (padding . 10))
+    annotate-spacing = ##t
+    ragged-last-bottom = ##f
+  }
+
+  \score {
+    <<
+      \new Lyrics \with { \override VerticalAxisGroup #'staff-affinity = #DOWN } \lyricmode { foo }
+      \new Lyrics \with { \override VerticalAxisGroup #'staff-affinity = #DOWN } \lyricmode { foo }
+      \new Lyrics \with { \override VerticalAxisGroup #'staff-affinity = #DOWN } \lyricmode { foo }
+      \new Lyrics \with { \override VerticalAxisGroup #'staff-affinity = #DOWN } \lyricmode { foo }
+      \new Staff { c'1 }
+      \new Staff { c'1 }
+      \new Lyrics \lyricmode { foo }
+      \new Lyrics \lyricmode { foo }
+      \new Lyrics \lyricmode { foo }
+      \new Lyrics \lyricmode { foo }
+    >>
+  }
+}
\ No newline at end of file
index e67e508b4396e09f2d773da4910b50ab8456a9a5..f5039821f7cefe88f508d977969190c55563b415 100644 (file)
@@ -73,6 +73,8 @@ protected:
   Real page_height_;
   Real header_height_;
   Real footer_height_;
+  Real header_padding_;
+  Real footer_padding_;
 };
 
 #endif /* PAGE_LAYOUT_HH */
index cb344891ca410b43978beb7df08663982b0c7a9e..07013aa2b71a904aabc3d8fb990bbf5e9fba1b81 100644 (file)
@@ -27,6 +27,8 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst
   Prob *page = unsmob_prob (page_scm);
   header_height_ = 0;
   footer_height_ = 0;
+  header_padding_ = 0;
+  footer_padding_ = 0;
   page_height_ = 100;
 
   if (page)
@@ -72,6 +74,9 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst
       // spring at the _top_ of the header.
       page_height_ -= robust_scm2double (paper->c_variable ("top-margin"), 0)
        + robust_scm2double (paper->c_variable ("bottom-margin"), 0);
+
+      read_spacing_spec (first_system_spacing, &header_padding_, ly_symbol2scm ("padding"));
+      read_spacing_spec (last_system_spacing, &footer_padding_, ly_symbol2scm ("padding"));
     }
   bool last_system_was_title = false;
 
@@ -397,7 +402,7 @@ Page_layout_problem::find_system_offsets ()
                                                                           staff,
                                                                           Y_AXIS);
                      else // distance to the top margin
-                       min_dist = header_height_ + staff->extent (staff, Y_AXIS)[UP];
+                       min_dist = header_padding_ + header_height_ + staff->extent (staff, Y_AXIS)[UP];
 
                      loose_line_min_distances.push_back (min_dist);
                    }
@@ -419,7 +424,7 @@ Page_layout_problem::find_system_offsets ()
     {
       Grob *last = loose_lines.back ();
       Interval last_ext = last->extent (last, Y_AXIS);
-      loose_line_min_distances.push_back (-last_ext[DOWN] + footer_height_);
+      loose_line_min_distances.push_back (-last_ext[DOWN] + footer_height_ + footer_padding_);
       loose_lines.push_back (0);
 
       distribute_loose_lines (loose_lines, loose_line_min_distances,
index a6e07b86b95e66078870db96d551d152d962c136..6088acf9cb71e1367c5e60c02c079f67d0cba31a 100644 (file)
@@ -438,7 +438,7 @@ printing of a single line of lyrics."
   \override VerticalAxisGroup #'remove-empty = ##t
   \override VerticalAxisGroup #'staff-affinity = #DOWN
   \override VerticalAxisGroup #'inter-staff-spacing #'padding = #0.5
-  \override VerticalAxisGroup #'inter-loose-line--spacing #'padding = #0.5
+  \override VerticalAxisGroup #'inter-loose-line-spacing #'padding = #0.5
 }