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: Aaron Hill
Subject: Re: Absolute font-size for TextScript
Date: Tue, 02 Jun 2020 14:47:15 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-06-02 2:00 pm, Paolo Prete wrote:
On Tue, Jun 2, 2020 at 8:57 PM Kieren MacMillan <
kieren_macmillan@sympatico.ca> 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

Attachment: absfontsize.cropped.png
Description: PNG image


reply via email to

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