[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Allow fixed spacing of symbols in church rests (issue 319910043 by addre
From: |
david . nalesnik |
Subject: |
Allow fixed spacing of symbols in church rests (issue 319910043 by address@hidden) |
Date: |
Thu, 29 Dec 2016 09:47:46 -0800 |
Reviewers: ,
Message:
Please review. Thanks!
Description:
Allow fixed spacing of symbols in church rests
By default, the symbols making up a church rest are spread to fill
the available space in a measure.
Setting the new property "church-rest-inner-padding" places symbols
at the given distance from each other independently of measure width.
Settings are disregarded if symbols would overlap as a consequence
or would exceed the default separation, which is taken as a maximum.
Please review this at https://codereview.appspot.com/319910043/
Affected files (+33, -6 lines):
M lily/multi-measure-rest.cc
M scm/define-grob-interfaces.scm
M scm/define-grob-properties.scm
Index: lily/multi-measure-rest.cc
diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc
index
7f2a720d6f809e06736272397e703d577d70f827..916fa49139d728ffb7409deba991c189582e5dfb
100644
--- a/lily/multi-measure-rest.cc
+++ b/lily/multi-measure-rest.cc
@@ -319,17 +319,41 @@ 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)
- / (2 * outer_padding_factor + (symbol_count - 1));
- if (inner_padding < 0)
- inner_padding = 1.0;
+
+ Real default_inner_padding = (space - symbols_width)
+ / (2 * outer_padding_factor + (symbol_count
- 1));
+ if (default_inner_padding < 0)
+ default_inner_padding = 1.0;
+
+ Real inner_padding;
+ Real left_offset;
+
+ SCM symbol_separation = me->get_property ("church-rest-inner-padding");
+
+ if (scm_is_number (symbol_separation))
+ {
+ inner_padding = max (0.0, robust_scm2double (symbol_separation,
1.0));
+ /*
+ Default is to spread symbols as widely as possible (with an
+ outer margin) within the available space. Use default as a
+ sensible maximum for user values.
+ */
+ inner_padding = min (default_inner_padding, inner_padding);
+ left_offset = (space - symbols_width - (inner_padding *
(symbol_count - 1)))
+ / 2;
+ }
+ else
+ {
+ inner_padding = default_inner_padding;
+ left_offset = outer_padding_factor * inner_padding;
+ }
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;
}
Index: scm/define-grob-interfaces.scm
diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm
index
d5f23113961f88049016d1670f252d535c9fb3ee..864e2b04966ffdb8a8f098de9f4ddc1c0c90d5db
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
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index
06358986b077bad2934e73eeac7fac2c4850c4af..6ceb67b65016fd6275a71092c8528dc35fdf1d5f
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 is
+proportional to 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Allow fixed spacing of symbols in church rests (issue 319910043 by address@hidden),
david . nalesnik <=