]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add a space-to-barline property to allow looser spacing of clefs.
authorJoe Neeman <joeneeman@gmail.com>
Sun, 19 Aug 2007 03:42:13 +0000 (13:42 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Sun, 19 Aug 2007 03:42:13 +0000 (13:42 +1000)
input/regression/spacing-space-to-barline.ly [new file with mode: 0644]
lily/note-spacing.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

diff --git a/input/regression/spacing-space-to-barline.ly b/input/regression/spacing-space-to-barline.ly
new file mode 100644 (file)
index 0000000..a1fe2fc
--- /dev/null
@@ -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
index 93be9228e2f90ff06a5ec84eee17e2aa4509c471..96f7b8f8e35078da3b53b6be2f5daa18c38d619b 100644 (file)
@@ -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 "
 
               );
 
index 598e4a838ad9f8797d17e54d3b1cfebb8da3647f..847a1aa18fcf6c245a3b6aadb4d2f7150a02484e 100644 (file)
@@ -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}.")
index 436aa9ebfdfabdf1a550c460c444657cb9f0d013..ce76c346f861aae96b3daefcb6446e497e5621f2 100644 (file)
      . (
        (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)