Hi,

On Fri, Dec 23, 2016 at 11:01 AM, David Nalesnik
<david.nales...@gmail.com> wrote:

>
> The default is actually to allow the components of the church rest to
> expand to fill the available space within the measure.  The symbols
> making up the rest are assigned a padding value proportional to the
> visual size of the measure.
>
> I think what you're after is some means to limit this expansion.  I've
> attached a patch which creates a property ("no-stretch") which keeps
> internal padding at its minimum value -- 1 staff space.  Note also the
> test file.  I haven't tested it beyond what you see there.
>
> It might be nice to allow a maximum padding.  (I find 1.0 for padding
> a little close.)  That would be easily done.
>
> Sorry that this is a patch you need to apply.  Putting this in Scheme
> would require extensive recoding.
>

The following patch may be more sensible.

It creates a new property, "church-rest-inner-padding," which when set
controls the space between the symbols making up the rest.  This space
is fixed.

If the property is left unset, we get the current default behavior:
the rest is spread out to fill the available space.

If the "no spread" behavior" is desired as a default, we'd just need
to add an entry for church-rest-inner-padding to scm/define-grobs.scm.
To get the spreading back, you'd override to '().

HTH,
David

P. S.  This patch is to current master, not to the patch in my earlier email.
From 23bf0e636e86440c3d28418c091eddae33e54670 Mon Sep 17 00:00:00 2001
From: David Nalesnik <david.nales...@gmail.com>
Date: Fri, 23 Dec 2016 10:39:12 -0600
Subject: [PATCH] Implement church-rest-inner-padding

If this property is set, the symbols making up a church rest will
be separated by this much.  If unset, separation is proportional to
the measure size (the previous default).
---
 lily/multi-measure-rest.cc     | 14 ++++++++++++--
 scm/define-grob-interfaces.scm |  2 +-
 scm/define-grob-properties.scm |  3 +++
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc
index 7f2a720..8599f07 100644
--- a/lily/multi-measure-rest.cc
+++ b/lily/multi-measure-rest.cc
@@ -319,8 +319,16 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measure_cou
 
   /* Make outer padding this much bigger.  */
   Real outer_padding_factor = 1.5;
-  Real inner_padding = (space - symbols_width)
+
+  SCM symbol_separation = me->get_property ("church-rest-inner-padding");
+  Real max_separation = (space - symbols_width)
                        / (2 * outer_padding_factor + (symbol_count - 1));
+  Real inner_padding = max_separation;
+  if (scm_is_number (symbol_separation))
+    {
+      inner_padding = min (robust_scm2double (symbol_separation, 1.0), inner_padding);
+	}
+
   if (inner_padding < 0)
     inner_padding = 1.0;
 
@@ -329,7 +337,9 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measure_cou
     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 ((space - symbols_width - (inner_padding * (symbol_count - 1))) / 2,
+    X_AXIS);
 
   return mol;
 }
diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm
index d5f2311..864e2b0 100644
--- a/scm/define-grob-interfaces.scm
+++ b/scm/define-grob-interfaces.scm
@@ -209,7 +209,7 @@ accidentals)."
 (ly:add-interface
  'multi-measure-interface
  "Multi measure rest, and the text or number that is printed over it."
- '(bound-padding))
+ '(bound-padding church-rest-inner-padding))
 
 (ly:add-interface
  'note-name-interface
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 0635898..b683f82 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -177,6 +177,9 @@ when a spanner is broken at a line break.")
      (chord-dots-limit ,integer? "Limits the column of dots
 on each chord to the height of the chord plus
 @code{chord-dots-limit} staff-positions.")
+     (church-rest-inner-padding ,number? "The distance between
+symbols in a multi-measure church rest.  If unset, distance will vary
+based on the size of the measure.")
      (circled-tip ,boolean? "Put a circle at start/@/end of
 hairpins (al/@/del niente).")
      (clef-alignments ,list? "An alist of parent-alignments
-- 
2.1.4

\version "2.19.54"

\paper {
  ragged-last = ##f
}

\markup \bold \huge "DEFAULT"

{
  \compressFullBarRests R1*3
  \break
  R1*9
  \break
  R1*12
  \break
  R1*3
  R1*9
  R1*12
  \break
  \repeat unfold 8 { R1*3 }
}

\markup \bold \huge "FIXED SPACING"
\markup \vspace #0
\markup \concat {
  "When padding is set, church rests do not expand with increased measure size. "
  \italic "Rests drawn as lines do."
}

{
  \override Staff.MultiMeasureRest.church-rest-inner-padding = #2
  \compressFullBarRests R1*3
  \break
  R1*9
  \break
  R1*12
  \break
  R1*3
  R1*9
  R1*12
  \break
  \repeat unfold 8 { R1*3 }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to