From 1fa4c73e647c2b3ea2c0b337b58e7699eb7170a2 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Sun, 19 Aug 2007 13:42:13 +1000 Subject: [PATCH] Add a space-to-barline property to allow looser spacing of clefs. --- input/regression/spacing-space-to-barline.ly | 23 ++++++++++++++++++++ lily/note-spacing.cc | 5 ++++- scm/define-grob-properties.scm | 5 +++++ scm/define-grobs.scm | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 input/regression/spacing-space-to-barline.ly diff --git a/input/regression/spacing-space-to-barline.ly b/input/regression/spacing-space-to-barline.ly new file mode 100644 index 0000000000..a1fe2fcfee --- /dev/null +++ b/input/regression/spacing-space-to-barline.ly @@ -0,0 +1,23 @@ +\version "2.11.29" + +\header { + texidoc = "When space-to-barline is false, we measure the space between the note and the +start of the clef. When space-to-barline is true, we measure the space between the note and +the start of the barline." +} + +\paper {ragged-right = ##t} + +{ + \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 16) + c'2 \clef bass c'2 \clef treble + \override NoteSpacing #'space-to-barline = ##f + c'2 \clef bass c'2 \clef treble + + % the following two measures should be spaced identically + \override NoteSpacing #'space-to-barline = ##t + c'2 c'2 + \override NoteSpacing #'space-to-barline = ##f + c'2 c'2 + c'1 +} \ No newline at end of file diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 93be9228e2..96f7b8f8e3 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -74,7 +74,9 @@ Note_spacing::get_spacing (Grob *me, Item *right_col, /* If we have a NonMusical column on the right, we measure the ideal distance to the bar-line (if present), not the start of the column. */ - if (!Paper_column::is_musical (right_col) && !skys[RIGHT].is_empty ()) + if (!Paper_column::is_musical (right_col) + && !skys[RIGHT].is_empty () + && to_boolean (me->get_property ("space-to-barline"))) { Grob *bar = Pointer_group_interface::find_grob (right_col, ly_symbol2scm ("elements"), @@ -315,6 +317,7 @@ ADD_INTERFACE (Note_spacing, "right-items " "same-direction-correction " "stem-spacing-correction " + "space-to-barline " ); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 598e4a838a..847a1aa18f 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -468,6 +468,11 @@ prefatory items, like clef and time-signature. The format is an alist of spacing tuples: @code{(@var{break-align-symbol} @var{type} . @var{distance})}, where @var{type} can be the symbols @code{minimum-space} or @code{extra-space}.") + (space-to-barline ,boolean? "If set, the distance between a note +and the following non-musical column will be measured to the barline +instead of to the beginning of the non-musical column. If there is a +clef change followed by a barline, for example, this means that we will +try to space the non-musical column as though the clef is not there.") (spacing-increment ,number? "Add this much space for a doubled duration. Typically, the width of a note head. See also @internalsref{spacing-spanner-interface}.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 436aa9ebfd..ce76c346f8 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1174,6 +1174,7 @@ . ( (stem-spacing-correction . 0.5) (same-direction-correction . 0.25) + (space-to-barline . #t) ;; Changed this from 0.75. ;; If you ever change this back, please document! --hwn (knee-spacing-correction . 1.0) -- 2.39.2