]> git.donarmstrong.com Git - lilypond.git/commitdiff
Ensure instrument names attached to hara-kiried axis groups are killed.
authorNeil Puttock <n.puttock@gmail.com>
Tue, 11 Aug 2009 00:43:06 +0000 (01:43 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Tue, 11 Aug 2009 00:43:06 +0000 (01:43 +0100)
input/regression/instrument-name-hara-kiri.ly
scm/output-lib.scm

index 55b209d3499ac4ba23b78535a697bdc65bef8671..4083620d39b3b9caab7d4d79b0661b75f65fcad7 100644 (file)
@@ -1,21 +1,18 @@
+\version "2.12.0"
 
 \header {
+  texidoc = "Instrument names are removed when the staves are
+killed off.
 
-  texidoc = "@code{PianoStaff.instrument} and
-@code{PianoStaff.instr} are removed when the staves are killed off.
-
-In this example, the 2nd staff (marked by the barnumber 2) disappears
-as does the instrument name.  "
-
+In this example, the second staff (marked by the bar number 2)
+disappears, as does the instrument name."
 }
-
-\version "2.12.0"
         
-  \new PianoStaff <<
-    \new Staff {
-      \override Staff.VerticalAxisGroup #'remove-empty = ##t  
-      \set PianoStaff.instrumentName ="up" 
-      \set PianoStaff.shortInstrumentName ="u"
-      c'1\break R
-    }
-  >>
+\new PianoStaff <<
+  \new Staff {
+    \override Staff.VerticalAxisGroup #'remove-empty = ##t  
+    \set PianoStaff.instrumentName = #"up" 
+    \set PianoStaff.shortInstrumentName = #"u"
+    c'1\break R
+  }
+>>
index e2c86d5e8d685efbe309864ea4dfccd53ca3433a..b2d7bea66b5e52867d7e7b0a7d752708e72f4672 100644 (file)
 
     (if (and (pair? live-elts)
             (interval-sane? (ly:grob-extent grob system Y)))
-       (let get-extent ((lst live-elts))
-         (if (pair? lst)
-             (let ((axis-group (car lst)))
-
-               (if (and (ly:spanner? axis-group)
-                        (equal? (ly:spanner-bound axis-group LEFT)
-                                left-bound))
-                   (set! extent (add-point extent
-                                           (ly:grob-relative-coordinate
-                                            axis-group system Y))))
-               (get-extent (cdr lst))))))
+       (begin
+         (let get-extent ((lst live-elts))
+           (if (pair? lst)
+               (let ((axis-group (car lst)))
+
+                 (if (and (ly:spanner? axis-group)
+                          (equal? (ly:spanner-bound axis-group LEFT)
+                                  left-bound))
+                     (set! extent (add-point extent
+                                             (ly:grob-relative-coordinate
+                                              axis-group system Y))))
+                 (get-extent (cdr lst)))))
+         (+
+          (ly:self-alignment-interface::y-aligned-on-self grob)
+          (interval-center extent)))
+       ;; no live axis group(s) for this instrument name -> remove from system
+       (ly:grob-suicide! grob))))
 
-    (+
-     (ly:self-alignment-interface::y-aligned-on-self grob)
-     (interval-center extent))))