bug-lilypond
[Top][All Lists]
Advanced

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

LSR-snippet 1046


From: Thomas Morley
Subject: LSR-snippet 1046
Date: Mon, 3 Oct 2016 13:29:57 +0200

Hi,

I had a closer look at the currently unapproved LSR-snippet
http://lsr.di.unimi.it/LSR/Item?u=1&id=1046
It is tagged docs.

I'm not realy happy with the new markups created there. Why not set
font-size directly?
Leading to:

\version "2.18.0"

InstrumentNameFontSize =
#(define-music-function (parser location font-size-pair)(pair?)
"Sets the @code{font-size} of @code{InstrumentName}.
The font-size for the initial @code{instrumentName} is taken from the first
value in @var{font-size-pair}.  @code{shortInstrumentName} will get the second
value of @var{font-size-pair}.
"

;; 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 {
  \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'' }
>>

Pierre, I know it is your snippet. What do you think?

@all
Are there any problems with my proposal, that I didn't consider?

Cheers,
  Harm



reply via email to

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