From 7ba578d0e75eab7d78b4906bc6cdf7de10e077a2 Mon Sep 17 00:00:00 2001 From: David Nalesnik Date: Fri, 23 Dec 2016 10:39:12 -0600 Subject: [PATCH] Restrict spread of symbols in church rests 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 | 16 ++++++++++++++-- scm/define-grob-properties.scm | 2 ++ scm/define-grobs.scm | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 7f2a720d6f..38dd598ee9 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -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 (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 " diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 238febedbf..3f7a94d9c2 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -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 diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 6ca25b586e..a04e07018c 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1509,6 +1509,7 @@ (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) -- 2.39.2