lilypond-user
[Top][All Lists]
Advanced

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

Re: Help a newb: Formatting custom instrument names


From: Lukas-Fabian Moser
Subject: Re: Help a newb: Formatting custom instrument names
Date: Tue, 8 Dec 2020 10:47:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Leo,

Am 07.12.20 um 23:36 schrieb Leo Correia de Verdier:
I’m not sure if this is an interesting suggestion, but if you want this as the 
actual clef you could write
%%%%%%%%%%%%%%
\once \override Staff.Clef.stencil = #ly:text-interface::print
   \once \override Staff.Clef.text = \markup {
     \override #'(font-size . -6.5)
     \unit-height-column { First second third fourth fifth sixth seventh eighth 
ninth tenth eleventh } }
   \once \override Staff.Clef.Y-offset = #5
   \clef treble % or whatever
%%%%%%%%%%%%%%

That's an excellent suggestion - I remember when I read Michael's question I thought: If we want "a sort of clef", we should use a \clef for it. But of course that changes the layout (even though one might use a whiteout property to hide the staff lines).

I moved your logic into a function (and replaced your explicit Y-offset by 0 combined with Y-centering the markup):

\version "2.21.80"

#(define-markup-command (force-unit-height layout props arg) (markup?)
   (let* ((y-centered-arg (markup #:general-align 1 0 arg))
          (stil (interpret-markup layout props y-centered-arg))
          (x (ly:stencil-extent stil 0))
          (y (cons -1/2 1/2)))
     (ly:stencil-outline stil (make-filled-box-stencil x y))))

#(define-markup-command (unit-height-column layout props args) (markup-list?)
   (interpret-markup layout props #{
     \markup {
       \override #'(baseline-skip . 0)
       \center-column \force-unit-height #args
                     } #} ))

columnClef =
#(define-music-function (contents) (markup-list?)
   #{
     \once \override Staff.Clef.stencil = #ly:text-interface::print
     \once \override Staff.Clef.Y-offset = 0
     \once \override Staff.Clef.text = \markup {
       \override #'(font-size . -6.5)
       \general-align #Y #CENTER
       \unit-height-column #contents
     }
   #})

\new Staff {
  \columnClef \markuplist { first second third fourth }
  a'4
}

Lukas




reply via email to

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