From b6f94447415dded7c6e146b41b6139fe76cb84c4 Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Thu, 28 Mar 2013 00:13:57 -0700 Subject: [PATCH] Tempo and Rehearsal marks horizontal positioning; issue 3279 Space tempo/rehearsal marks so they do not overlap each other. Do not use side-position interface for their initial vertical position, because they are moved to the top-most staff after line-breaking. --- Documentation/changes.tely | 11 +++++++++++ Documentation/learning/tweaks.itely | 3 +++ Documentation/notation/rhythms.itely | 18 ++++++++++++++++++ Documentation/notation/text.itely | 9 +++++++++ input/regression/metronome-marking.ly | 4 ++-- ly/engraver-init.ly | 3 +++ ly/property-init.ly | 9 +++++++++ scm/define-grobs.scm | 14 ++++++++------ scm/output-lib.scm | 8 ++++++++ 9 files changed, 71 insertions(+), 8 deletions(-) diff --git a/Documentation/changes.tely b/Documentation/changes.tely index 951dabd22b..313f3845be 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -61,6 +61,17 @@ which scares away people. @end ignore +@item +Horizontal space is allowed for tempo and rehearsal marks, +so that these marks do not overlap each other. +A new command @code{\markLengthOff} turns this feature off. +@lilypond[quote,relative=0] +\compressFullBarRests +\tempo "Molto vivace" c''2 c' +\mark\default +\tempo "Meno mosso" R1*16 +@end lilypond + @item When @code{\relative} is used without an explicit reference pitch, the reference pitch now is the middle of the first octave, making diff --git a/Documentation/learning/tweaks.itely b/Documentation/learning/tweaks.itely index 9dc53ff8f9..5e8365a908 100644 --- a/Documentation/learning/tweaks.itely +++ b/Documentation/learning/tweaks.itely @@ -2285,6 +2285,9 @@ The command to revert to the default behavior is @code{\textLengthOff}. Alternatively, @code{\once} may be used with @code{\textLengthOn} if the effect is to be limited to just a single musical moment. +The corresponding spacing behavior for rehearsal marks and tempo +indications is independently controlled with the commands +@code{\markLengthOn} and @code{\markLengthOff}. @cindex markup text, allowing collisions diff --git a/Documentation/notation/rhythms.itely b/Documentation/notation/rhythms.itely index 08d9b7ca13..9250fd1968 100644 --- a/Documentation/notation/rhythms.itely +++ b/Documentation/notation/rhythms.itely @@ -1333,6 +1333,24 @@ written by including an empty string in the input: d4 g e c @end lilypond +@funindex \markLengthOn +@funindex markLengthOn +@funindex \markLengthOff +@funindex markLengthOff + +When tempo indications follow each other closely in the music, +such as in a part for an instrument with long periods of rests, +the measures are stretched horizontally so that the tempo indications +do not overlap. The commands @code{\markLengthOn} and +@code{\markLengthOff} control this behavior. + +@lilypond[quote,relative=0] +\compressFullBarRests +\tempo "Molto vivace" +R1*12 +\tempo "Meno mosso" +R1*16 +@end lilypond @snippets diff --git a/Documentation/notation/text.itely b/Documentation/notation/text.itely index e6a085fc56..82c7a209a3 100644 --- a/Documentation/notation/text.itely +++ b/Documentation/notation/text.itely @@ -268,6 +268,15 @@ c1 c c c @end lilypond +@funindex \markLengthOn +@funindex markLengthOn +@funindex \markLengthOff +@funindex markLengthOff + +@predefined +@code{\markLengthOn}, +@code{\markLengthOff}. +@endpredefined @snippets diff --git a/input/regression/metronome-marking.ly b/input/regression/metronome-marking.ly index e987176b7e..ac115273c3 100644 --- a/input/regression/metronome-marking.ly +++ b/input/regression/metronome-marking.ly @@ -14,10 +14,10 @@ The marking is left aligned with the time signature, if there is one. \layout { ragged-right = ##t } -\version "2.16.0" +\version "2.17.17" \relative c'' { - \tempo \breve = 100 c1 c1 \tempo 8.. = 50 c1 + \tempo \breve = 100 c1 c1 \tempo "Allegro" 8.. = 50 c1 \tempo "Adagio" c2 c' } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 5902b25da9..d6036bc4ef 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -90,6 +90,7 @@ localKeySignature = #'() createSpacing = ##t ignoreFiguredBassRest = ##f + \markLengthOff %% explicitly set instrument, so we don't get %% weird effects when doing instrument names for @@ -172,6 +173,7 @@ contained staves are not connected vertically." \override BarLine.bar-extent = #'(-2 . 2) \override VoltaBracket.staff-padding = #3 \override StaffSymbol.line-count = #1 + \markLengthOff \override Stem.neutral-direction = #UP \override Beam.neutral-direction = #UP @@ -704,6 +706,7 @@ automatically when an output definition (a @code{\\score} or %% figuredBassFormatter = #format-bass-figure metronomeMarkFormatter = #format-metronome-markup + \markLengthOn %% See also make-voice-props-set diff --git a/ly/property-init.ly b/ly/property-init.ly index 633a12909a..fc7c67179a 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -564,6 +564,15 @@ textLengthOff = { \revert TextScript.outside-staff-horizontal-padding } +markLengthOn = { + \override Score.MetronomeMark.extra-spacing-width = #'(-0.5 . 0.5) + \override Score.RehearsalMark.extra-spacing-width = #'(-0.5 . 0.5) +} + +markLengthOff = { + \override Score.MetronomeMark.extra-spacing-width = #'(+inf.0 . -inf.0) + \override Score.RehearsalMark.extra-spacing-width = #'(+inf.0 . -inf.0) +} %% text spanners diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 81e4377ff4..1b834a2e2d 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1418,15 +1418,16 @@ (after-line-breaking . ,ly:side-position-interface::move-to-extremal-staff) (break-visibility . ,end-of-line-invisible) (direction . ,UP) - (extra-spacing-width . (+inf.0 . -inf.0)) (outside-staff-horizontal-padding . 0.12) (outside-staff-priority . 1000) - (padding . 0.8) + (outside-staff-padding . 0.5) (side-axis . ,Y) (skyline-horizontal-padding . 0.2) (stencil . ,ly:text-interface::print) (vertical-skylines . ,grob::always-vertical-skylines-from-stencil) - (Y-offset . ,side-position-interface::y-aligned-side) + (Y-offset . ,(ly:make-unpure-pure-container + side-position-interface::y-aligned-side + outside-staff::pure-Y-offset)) (X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure @@ -1786,12 +1787,11 @@ (break-align-symbols . (staff-bar key-signature clef)) (break-visibility . ,end-of-line-invisible) (direction . ,UP) - (extra-spacing-width . (+inf.0 . -inf.0)) (font-size . 2) (non-musical . #t) (outside-staff-horizontal-padding . 0.12) (outside-staff-priority . 1500) - (padding . 0.8) + (outside-staff-padding . 0.5) (self-alignment-X . ,CENTER) (stencil . ,ly:text-interface::print) (vertical-skylines . ,grob::always-vertical-skylines-from-stencil) @@ -1801,7 +1801,9 @@ (list ly:break-alignable-interface::self-align-callback)) ,(ly:make-simple-closure (list ly:self-alignment-interface::x-aligned-on-self))))) - (Y-offset . ,side-position-interface::y-aligned-side) + (Y-offset . ,(ly:make-unpure-pure-container + side-position-interface::y-aligned-side + outside-staff::pure-Y-offset)) (Y-extent . ,grob::always-Y-extent-from-stencil) (meta . ((class . Item) (interfaces . (break-alignable-interface diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 3348ca470d..caa7032c70 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -854,6 +854,14 @@ and duration-log @var{log}." the previous calculated offset value." prev-offset) +(define-public (outside-staff::pure-Y-offset grob start end) + "Initial vertical placement of items such as tempo and + rehearsal marks, for use in note-spacing." + (* (+ (ly:staff-symbol-staff-radius grob) + (ly:grob-property grob 'outside-staff-padding 0.0) + 1.0) + (ly:grob-property grob 'direction CENTER))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -- 2.39.2