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?
>
> I use this (from an include file):
>
> %%%%
> 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))
>        )))
>
> \layout {
>   \context {
>     \Score
>     \allowGrobCallback font-interface.font-size
>   }
> }
> %%%%
>
>
Thanks!!

But how exactly do I have to call \absFontSize ? I tried in the following
way, but could not obtain the wanted result:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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{
{
  \absFontSize 16
  c'^"foobar"
}

\layout {
  \context {
    \Score
    \allowGrobCallback font-interface.font-size
  }
}

}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Best,
P

Reply via email to