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: Mon, 7 Dec 2020 22:39:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Michael,

Maybe something like this?

\version "2.21.80"

\layout {
  indent = 5
}

#(define-markup-command (unit-height layout props arg) (markup?)
  (let* ((stil (interpret-markup layout props arg))
         (x (ly:stencil-extent stil 0)))
    (interpret-markup layout props
                      (make-with-dimensions-markup x '(-0.5 . 0.5) (markup #:general-align 1 0 arg)))))

Of course that's insane, because the same markup is interpreted twice, and because 0.5 isn't an exact number. Hopefully better version:

\version "2.21.80"

\layout {
  indent = 5
}

#(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
                     } #} ))

\new Staff \with {
  \override StaffSymbol.line-count = 12
  instrumentName = \markup {
    \override #'(font-size . -10)
    \unit-height-column { First second third fourth fifth sixth seventh eighth ninth tenth eleventh }
  }
}
{ a'4 }

Lukas



reply via email to

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