]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 462.
authorJoe Neeman <joeneeman@gmail.com>
Wed, 5 Aug 2009 21:57:41 +0000 (07:57 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Thu, 6 Aug 2009 11:56:16 +0000 (21:56 +1000)
Mark invisible barlines as loose columns.

input/regression/spacing-empty-bar.ly [new file with mode: 0644]
lily/paper-column.cc
lily/spacing-determine-loose-columns.cc
lily/spacing-spanner.cc
scm/define-grob-properties.scm

diff --git a/input/regression/spacing-empty-bar.ly b/input/regression/spacing-empty-bar.ly
new file mode 100644 (file)
index 0000000..3a8cd9c
--- /dev/null
@@ -0,0 +1,10 @@
+\version "2.13.4"
+
+\header {
+  texidoc = "Empty barlines do not affect spacing."
+}
+
+{
+  c'4 c' \bar "" c' c' \break
+  \repeat unfold 10 { c' c' c' c' \bar "" \noBreak }
+}
\ No newline at end of file
index e8533e945327ff5365a9a482846e33ca655a5111..3308cf251cc65a55aaf2302780a4b5abb8b323c3 100644 (file)
@@ -365,6 +365,7 @@ ADD_INTERFACE (Paper_column,
               "line-break-system-details "
               "line-break-penalty "
               "line-break-permission "
+              "maybe-loose "
               "page-break-penalty "
               "page-break-permission "
               "page-turn-penalty "
index 7aa42caeceefec12c7778f71d3336ddfc3fce993..90db1e01e192a82b341a79694b2d2df01cd4d6b8 100644 (file)
@@ -47,8 +47,7 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options)
     }
 
   
-  if (Paper_column::is_musical (col)
-      || Paper_column::is_breakable (col))
+  if (Paper_column::is_musical (col))
     return false;
 
   /*
@@ -79,8 +78,11 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options)
   if (!l_neighbor || !r_neighbor)
     return false;
 
-  if (l == l_neighbor && r == r_neighbor)
-    return false;
+  /* If a non-empty column (ie. not \bar "") is placed nicely in series with
+     its neighbor (ie. no funny polyphonic stuff), don't make it loose.
+  */
+  if (l == l_neighbor && r == r_neighbor && col->extent (col, X_AXIS).length () > 0)
+     return false;
 
   /*
     Only declare loose if the bounds make a little sense.  This means
@@ -106,7 +108,12 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options)
              Grob *h = gelts[j];
 
              if (h && h->get_property ("break-align-symbol") == ly_symbol2scm ("staff-bar"))
-               return false;
+               {
+                 extract_grob_set (h, "elements", helts);
+                 for (vsize k = helts.size (); k--;)
+                   if ("" != robust_scm2string (helts[k]->get_property ("glyph-name"), ""))
+                     return false;
+               }
            }
        }
     }
@@ -185,6 +192,15 @@ Spacing_spanner::prune_loose_columns (Grob *me,
       bool loose = (i > 0 && i + 1 < cols->size ())
        && is_loose_column (cols->at (i - 1), c, cols->at (i + 1), options);
 
+      /* Breakable columns never get pruned; even if they are loose,
+        their broken pieces are not.  However, we mark them so that
+        the spacing can take their mid-line looseness into account. */
+      if (loose && Paper_column::is_breakable (c))
+       {
+         loose = false;
+         c->set_property ("maybe-loose", SCM_BOOL_T);
+       }
+
       if (loose)
        {
          Grob *right_neighbor = unsmob_grob (c->get_object ("right-neighbor"));
index 274905faf54f995f1f11156203739caa891c71f3..cc5170de79eba2763dc1ed5b9406b390542fe705 100644 (file)
@@ -168,7 +168,7 @@ Spacing_spanner::generate_pair_spacing (Grob *me,
   if (Paper_column::is_musical (left_col))
     {
       if (!Paper_column::is_musical (right_col)
-         && options->float_nonmusical_columns_
+         && (options->float_nonmusical_columns_ || to_boolean (right_col->get_property ("maybe-loose")))
          && after_right_col
          && Paper_column::is_musical (after_right_col))
        {
index ac0920104449b59756675de02d51aa62f3ff800d..bdd702bce9e8ebb461a275d0489314658b550fb6 100644 (file)
@@ -1004,6 +1004,8 @@ supported by this object.  It is initialized from the @code{meta} field.")
 
      (least-squares-dy ,number? "The ideal beam slope, without damping.")
 
+     (maybe-loose ,boolean? "Used to mark a breakable column that is
+loose if and only if it is in the middle of a line.")
      (meta ,list? "Provide meta information.  It is an alist with the
 entries @code{name} and @code{interfaces}.")
      (minimum-distances ,list? "A list of rods that have the format