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