Different font size settings for instrumentName and shortInstrumentName
Appearance
Choose different font sizes for instrumentName and shortInstrumentName as a context override.
\version "2.24"
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/extended to set different values for each
;; occurance 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)
'())))
(if (pair? siblings)
(begin
(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'' }
>>