From: Neil Puttock Date: Tue, 11 Aug 2009 00:43:06 +0000 (+0100) Subject: Ensure instrument names attached to hara-kiried axis groups are killed. X-Git-Tag: release/2.13.4-1~179^2~114 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f0440dedd223df1d1db122a61c0aa52166929438;p=lilypond.git Ensure instrument names attached to hara-kiried axis groups are killed. --- diff --git a/input/regression/instrument-name-hara-kiri.ly b/input/regression/instrument-name-hara-kiri.ly index 55b209d349..4083620d39 100644 --- a/input/regression/instrument-name-hara-kiri.ly +++ b/input/regression/instrument-name-hara-kiri.ly @@ -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 + } +>> diff --git a/scm/output-lib.scm b/scm/output-lib.scm index e2c86d5e8d..b2d7bea66b 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -786,18 +786,21 @@ (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))))