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: Tue, 2 Jun 2020 23:51:41 +0200



On Tue, Jun 2, 2020 at 11:18 PM Kieren MacMillan <kieren_macmillan@sympatico.ca> wrote:
Hi Paolo,

> how exactly do I have to call \absFontSize

%%%%
\version "2.19.83"

allowGrobCallback =
#(define-scheme-function (parser location syms) (symbol-list?)
   (let ((interface (car syms))
         (sym (cadr syms)))
     #{
       \with {
         \consists #(lambda (context)
                      `((acknowledgers .
                          ((,interface . ,(lambda (engraver grob source-engraver)
                                            (let ((prop (ly:grob-property grob sym)))
                                              (if (procedure? prop) (ly:grob-set-property! grob sym (prop grob)))
                                              ))))
                          ))
                      )
       }
     #}))

absFontSize =
#(define-scheme-function (parser location pt)(number?)
   (lambda (grob)
     (let* ((layout (ly:grob-layout grob))
            (ref-size (ly:output-def-lookup (ly:grob-layout grob) 'text-font-size 12)))
       (magnification->font-size (/ pt ref-size))
       )))

% LilyBin
\score {

  { c'1^"foobar" d'2-> \once \override Script.font-size = \absFontSize #72  2-> }

  \layout {
    \context {
      \Score
      \allowGrobCallback font-interface.font-size
      \override TextScript.font-size = \absFontSize #22
    }
  }
}
%%%%


Just tested, it works greatly!
Thanks

 

reply via email to

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