lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instrument Name Not Appearing


From: Thomas Morley
Subject: Re: Instrument Name Not Appearing
Date: Sat, 2 Dec 2017 22:05:41 +0100

2017-12-02 21:41 GMT+01:00 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> The stencil-procedure for InstrumentName, system-start-text::print,
>> explecitely disallows printing an InstrumentName in the middle of a
>> system.
>> No clue about the reasoning.
>
> Well, otherwise an InstrumentName would appear everywhere, wouldn't it?

I don't see any problem, even with the extended example below.
Ofcourse there's a collision with the SpanBar, but this is expected, imho.

#(define-public (my-system-start-text::print grob)
  (let* ((orig (ly:grob-original grob))
         (siblings (if (ly:grob? orig)
                       (ly:spanner-broken-into orig) '() ))
         (long-text (ly:grob-property grob 'long-text #f))
         (text (ly:grob-property grob 'text #f)))
    (cond ((and long-text
                (pair? siblings)
                (equal? grob (car siblings)))
             (grob-interpret-markup grob long-text))
          ((and text
                (pair? siblings)
                (member grob (cdr siblings)))
             (grob-interpret-markup grob text))
          (else (ly:grob-suicide! grob)))))

\layout {
  \override Staff.InstrumentName.stencil = #my-system-start-text::print
}

\score {
  \new StaffGroup
  <<
    \new Staff = "1" \with { instrumentName = "Top" shortInstrumentName = "t " }
      \repeat unfold 40 c'1

    \new Staff \with { instrumentName = "Bottom" shortInstrumentName = "b " }
      {
        d'
        d'
        <<
            \repeat unfold 38 d'
            \new Staff = "2"
              \with {
              instrumentName = "staff 2"
              shortInstrumentName = "s2 "
                alignAboveContext = "1"
              }
              {
                e'
                e'
              <<
                  \repeat unfold 36 e'
                  \new Staff
                    \with {
                    instrumentName = "staff 3"
                    shortInstrumentName = "s3 "
                      alignAboveContext = "1"
                    }
                  \repeat unfold 36 f'
               >>
              }
          >>
      }

  >>
}


Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]