Taille de police différente pour instrumentName et shortInstrumentName

Une simple dérogation à un contexte particulier permet de différencier la taille des variables instrumentName et shortInstrumentName.

InstrumentNameFontSize =
#(define-music-function (font-size-pair) (pair?)
   "Set the font size of `InstrumentName` grobs.

The first value of FONT-SIZE-PAIR sets the font size of the initial
`instrumentName` property, the second value sets the font size of
`shortInstrumentName`."
   ;; This code could be changed or extended to set different values
   ;; for each occurrence of `shortInstrumentName'.
   #{
     \override InstrumentName.after-line-breaking =
       #(lambda (grob)
          (let* ((orig (ly:grob-original grob))
                 (siblings (if (ly:grob? orig)
                               (ly:spanner-broken-into orig)
                               '())))
            (when (pair? siblings)
              (ly:grob-set-property! (car siblings)
                                     'font-size (car font-size-pair))
              (for-each
               (lambda (g)
                 (ly:grob-set-property! g
                                        'font-size (cdr font-size-pair)))
               (cdr siblings)))))
   #})

\layout {
  indent = 3\cm
  short-indent = 0.8\cm

  \context {
    \Staff
    \InstrumentNameFontSize #'(6 . -3)
  }
}

\new StaffGroup <<
  \new Staff \with {
       instrumentName = "Flute"
       shortInstrumentName = "Fl." } {
    c''1 \break c'' \break c'' }
  \new Staff \with {
       instrumentName = "Violin"
       shortInstrumentName = "Vl." } {
    c''1 \break c'' \break c'' }
>>
[image of music]

LilyPond snippets v2.25.32 (development-branch).