On 2020-06-02 2:00 pm, Paolo Prete wrote:
On Tue, Jun 2, 2020 at 8:57 PM Kieren MacMillan <
[email protected]> wrote:

Hi Paolo,

> is it possible to set an absolute font-size for *all* the TextScript
objects?

As is tradition, I am almost certainly over-engineering here. However, would the following approach be of any use:

%%%%
\version "2.20.0"

transformText =
#(define-music-function
  (grob-path proc)
  ((key-list? 'TextScript) procedure?)
  #{ \override $grob-path . before-line-breaking =
       #(grob-transformer 'before-line-breaking
         (lambda (grob orig)
           (ly:grob-set-property! grob 'text
             (proc (ly:grob-property grob 'text))))) #})

boxIt = #(lambda (text) (markup #:box text))
flipIt = #(lambda (text) (markup #:rotate 180 text))
sizeIt =
#(define-scheme-function (size) (number?)
  (lambda (text) (markup #:abs-fontsize size text)))

\layout {
  \context {
    \Staff
    \transformText \sizeIt #8
  }
}

\score {
  \new Staff { b'2.^"Lorem" \once \transformText \boxIt b'4_"ipsum" }
  \layout { #(layout-set-staff-size 8) }
}
\score {
  \new Staff { b'2.^"Lorem" b'4_"ipsum" }
  \layout { #(layout-set-staff-size 13) }
}
\score {
  \new Staff { \once \transformText \flipIt b'2.^"Lorem" b'4_"ipsum" }
  \layout { #(layout-set-staff-size 21) }
}
%%%%


-- Aaron Hill

Reply via email to