]> git.donarmstrong.com Git - lilypond.git/commitdiff
Restrict spread of symbols in church rests
authorDavid Nalesnik <david.nalesnik@gmail.com>
Fri, 23 Dec 2016 16:39:12 +0000 (10:39 -0600)
committerDavid Nalesnik <david.nalesnik@gmail.com>
Thu, 12 Jan 2017 16:05:01 +0000 (10:05 -0600)
The spacing of symbols in multi-measure church rests varies with
the measure size.  In loose spacing, this can lead to loss of
readability as the symbols are pushed far apart.

This patch introduces the property "max-symbol-separation," which
represents the largest allowed distance between components of a
Kirchenpause.  Distance between symbols will vary with measure size
unless the maximum is exceeded.

Setting the property to a small value will effectively create
constant spacing.  Using a very large value will permit proportional
spacing regardless of measure length (the previous default behavior).

A default value of 8.0 staff spaces is set to allow flexibility in
shorter measures.

lily/multi-measure-rest.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

index 7f2a720d6f809e06736272397e703d577d70f827..38dd598ee95d329be323342eeddb4da4817b946b 100644 (file)
@@ -317,19 +317,30 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measure_cou
       symbol_count++;
     }
 
-  /* Make outer padding this much bigger.  */
+  /*
+    When symbols spread to fullest extent, outer padding is this much
+    bigger.
+  */
   Real outer_padding_factor = 1.5;
+  /* Widest gap between symbols; to be limited by max-symbol-separation */
   Real inner_padding = (space - symbols_width)
                        / (2 * outer_padding_factor + (symbol_count - 1));
   if (inner_padding < 0)
     inner_padding = 1.0;
 
+  Real max_separation = max (robust_scm2double (me->get_property ("max-symbol-separation"), 8.0),
+                             1.0);
+
+  inner_padding = min (inner_padding, max_separation);
+  Real left_offset = (space - symbols_width - (inner_padding * (symbol_count - 1)))
+                     / 2;
+
   Stencil mol;
   for (SCM s = mols; scm_is_pair (s); s = scm_cdr (s))
     mol.add_at_edge (X_AXIS, LEFT, *unsmob<Stencil> (scm_car (s)),
                      inner_padding);
   mol.align_to (X_AXIS, LEFT);
-  mol.translate_axis (outer_padding_factor * inner_padding, X_AXIS);
+  mol.translate_axis (left_offset, X_AXIS);
 
   return mol;
 }
@@ -432,6 +443,7 @@ ADD_INTERFACE (Multi_measure_rest,
                "bound-padding "
                "expand-limit "
                "hair-thickness "
+               "max-symbol-separation "
                "measure-count "
                "minimum-length "
                "round-up-exceptions "
index 238febedbfaa95e007a59e9dc1a015819a2c019f..3f7a94d9c2e251683924831fef9b64f550ac0d51 100644 (file)
@@ -617,6 +617,8 @@ visual output is influenced by changes to
 to beams from this stem.  Further beams are typeset as beamlets.")
      (maximum-gap ,number? "Maximum value allowed for @code{gap}
 property.")
+     (max-symbol-separation ,number? "The maximum distance between
+symbols making up a church rest.")
      (measure-count ,integer? "The number of measures for a
 multi-measure rest.")
      (measure-length ,ly:moment? "Length of a measure.  Used in some
index 6ca25b586e69ce735effaf5bd61a2f941270a794..a04e07018cc0a3a07c27550927ef8a9052a39af8 100644 (file)
         (hair-thickness . 2.0)
         (round-up-exceptions . ())
         (bound-padding . 0.5)
+        (max-symbol-separation . 8.0)
         (space-increment . 2.0)
         (spacing-pair . (break-alignment . break-alignment))
         (springs-and-rods . ,ly:multi-measure-rest::set-spacing-rods)