]> git.donarmstrong.com Git - lilypond.git/commitdiff
Prevent accidentals and articulations from moving over leftmost NonMusicalPaperColumns.
authorMike Solomon <mike@apollinemike.com>
Wed, 30 Nov 2011 10:10:36 +0000 (11:10 +0100)
committerMike Solomon <mike@apollinemike.com>
Wed, 30 Nov 2011 10:10:36 +0000 (11:10 +0100)
Inversely, allows accidentals to tuck over change clefs and prevents ledger lines
from overlapping barlines in cramped situations.

This is done by allowing the pure-from-neighbor-interface to add
extra-spacing-height to certain non-musical grobs and removing the
blanked skyline-padding applied to NonMusicalPaperColumns.

input/regression/spacing-folded-clef3.ly
lily/spacing-loose-columns.cc
scm/define-grobs.scm
scm/output-lib.scm

index ed94152b5ae8f52f694065fd28f3551b3d4af701..a428a4e4f72c3c9bdf2c0b52101b73f6819aebef 100644 (file)
                 s2.
         }
 >>
+
+\new PianoStaff <<
+        \new Staff = "rh" \relative c'' {
+                \time 6/8
+                bes16 c d
+                \change Staff = lh
+                \stemUp bes a g
+                \change Staff = rh
+                \stemDown bes c d
+                \change Staff = lh
+                \clef bass
+                \stemUp ces, a g
+
+        }
+        \new Staff = "lh" \relative c' {
+                s2.
+        }
+>>
index cc706fb6b0b9f5944753649e254672802333e84c..b73f193d2dd6b2264a1b83eb622e0d884f04b69f 100644 (file)
@@ -176,6 +176,10 @@ set_loose_columns (System *which, Column_x_positions const *posns)
               tight_note_space = spring.min_distance ();
             }
 
+          Real loose_col_horizontal_length = loose_col->extent (loose_col, X_AXIS).length ();
+          base_note_space = max (base_note_space, loose_col_horizontal_length);
+          tight_note_space = max (tight_note_space, loose_col_horizontal_length);
+
           clique_spacing.push_back (base_note_space);
           clique_tight_spacing.push_back (tight_note_space);
         }
index 9cb0e6b5e1a6c9818f4c53c8006c858f1c6eef7c..2723ffbfb02820a52bc8256d2a7e917e46ad9887 100644 (file)
        (break-align-anchor . ,ly:break-aligned-interface::calc-extent-aligned-anchor)
        (break-align-symbol . clef)
        (break-visibility . ,begin-of-line-visible)
-       ;(extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height)
+       (extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-at-beginning-of-line)
        (glyph-name . ,ly:clef::calc-glyph-name)
        (non-musical . #t)
        (space-alist . ((cue-clef . (extra-space . 2.0))
        (stencil . ,ly:clef::print)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
-                 ;(object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
-                 ;                     (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
+                 (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                      (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
                 (interfaces . (break-aligned-interface
                                clef-interface
                                font-interface
-                               ;pure-from-neighbor-interface
+                               pure-from-neighbor-interface
                                staff-symbol-referencer-interface))))))
 
     (ClusterSpanner
        (break-align-anchor . ,ly:break-aligned-interface::calc-extent-aligned-anchor)
        (break-align-symbol . cue-clef)
        (break-visibility . ,begin-of-line-visible)
-       ;(extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height)
+       (extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-at-beginning-of-line)
        (font-size . -4)
        (glyph-name . ,ly:clef::calc-glyph-name)
        (non-musical . #t)
        (stencil . ,ly:clef::print)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
-                 ;(object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
-                 ;                     (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
+                 (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                      (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
                 (interfaces . (break-aligned-interface
                                clef-interface
                                font-interface
-                               ;pure-from-neighbor-interface
+                               pure-from-neighbor-interface
                                staff-symbol-referencer-interface))))))
 
     (CueEndClef
        (break-align-anchor . ,ly:break-aligned-interface::calc-extent-aligned-anchor)
        (break-align-symbol . cue-end-clef)
        (break-visibility . ,begin-of-line-invisible)
-       ;(extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height)
+       (extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-at-beginning-of-line)
        (font-size . -4)
        (glyph-name . ,ly:clef::calc-glyph-name)
        (non-musical . #t)
        (stencil . ,ly:clef::print)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
-                 ;(object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
-                 ;                     (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
+                 (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                      (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
                 (interfaces . (break-aligned-interface
                                clef-interface
                                font-interface
-                               ;pure-from-neighbor-interface
+                               pure-from-neighbor-interface
                                staff-symbol-referencer-interface))))))
 
     (Custos
                        (first-note . (fixed-space . 2.5))))
        (stencil . ,ly:key-signature-interface::print)
        (extra-spacing-width . (0.0 . 1.0))
+       (extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-including-staff)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
+                 (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                      (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
                 (interfaces . (break-aligned-interface
                                font-interface
                                key-cancellation-interface
                                key-signature-interface
+                               pure-from-neighbor-interface
                                staff-symbol-referencer-interface))))))
 
     (KeySignature
                        (first-note . (fixed-space . 2.5))))
        (stencil . ,ly:key-signature-interface::print)
        (extra-spacing-width . (0.0 . 1.0))
-       ;(extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-including-staff)
+       (extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-including-staff)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)
-                 ;(object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
-                 ;                     (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
+                 (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                      (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
                 (interfaces . (break-aligned-interface
                                font-interface
                                key-signature-interface
-                               ;pure-from-neighbor-interface
+                               pure-from-neighbor-interface
                                staff-symbol-referencer-interface))))))
 
 
        (before-line-breaking . ,ly:paper-column::before-line-breaking)
        (full-measure-extra-space . 1.0)
        (horizontal-skylines . ,ly:separation-item::calc-skylines)
-       ;; sufficient padding to prevent ledger lines from moving over/under
-       (skyline-vertical-padding . 0.6)
        ;;                    (stencil . ,ly:paper-column::print)
 
        (keep-inside-line . #t)
        (break-align-symbol . time-signature)
        (break-align-anchor-alignment . ,LEFT)
        (break-visibility . ,all-visible)
-       ;(extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-including-staff)
-       (extra-spacing-height . (-1.0 . 1.0))
+       (extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height-including-staff)
        (extra-spacing-width . (0.0 . 0.8))
        (non-musical . #t)
        (space-alist . (
        (stencil . ,ly:time-signature::print)
        (style . C)
        (meta . ((class . Item)
-                 ;(object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
-                 ;                     (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
+                 (object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
+                                      (pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
                 (interfaces . (break-aligned-interface
                                font-interface
-                               ;pure-from-neighbor-interface
+                               pure-from-neighbor-interface
                                time-signature-interface))))))
 
     (TrillPitchAccidental
index 57f89eeb3bab661fa1661c2dff0b6d8fe3d3c012..9227787b8cb40d14ead03b817fdcd0d85e02c88f 100644 (file)
@@ -390,6 +390,11 @@ and duration-log @var{log}."
           (equal? (ly:item-break-dir g) RIGHT))
       (ly:grob-translate-axis! g 3.5 X)))
 
+(define-public (pure-from-neighbor-interface::extra-spacing-height-at-beginning-of-line grob)
+  (if (= 1 (ly:item-break-dir grob))
+      (pure-from-neighbor-interface::extra-spacing-height grob)
+      (cons -0.1 0.1)))
+
 (define-public (pure-from-neighbor-interface::extra-spacing-height grob)
   (let* ((height (ly:grob::stencil-height grob))
          (from-neighbors (interval-union
@@ -411,9 +416,9 @@ and duration-log @var{log}."
                    (not (and (eq? x car)
                              (not (ly:grob-property grob 'allow-span-bar)))))
               (x esh)
-              0))
+              (x (cons -1.01 1.01))))
         (cons car cdr))
-      '(0 . 0))))
+      '(-1.01 . 1.01))))
 
 (define (pure-from-neighbor-interface::extra-spacing-height-including-staff grob)
   (let ((esh (pure-from-neighbor-interface::extra-spacing-height grob))