lilypond-user
[Top][All Lists]
Advanced

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

Re: Absolute font-size for TextScript


From: Paolo Prete
Subject: Re: Absolute font-size for TextScript
Date: Wed, 3 Jun 2020 12:21:16 +0200



On Wed, Jun 3, 2020 at 12:01 AM Aaron Hill <lilypond@hillvisions.com> wrote:

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) }
}
%%%%


That's great too!


reply via email to

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