lilypond-user
[Top][All Lists]
Advanced

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

Re: problem with installed font when set-global-staff-size is changed


From: tisimst
Subject: Re: problem with installed font when set-global-staff-size is changed
Date: Thu, 13 Aug 2015 07:55:07 -0700 (MST)

Jonathan

On 8/11/2015 5:15 PM, jonathan.scholbach [via Lilypond] wrote:
(Setting the font-sizes manually is necessary since for some unknown
reason, the font-size decreases.)

This is because virtually everything that has any kind of font property is scaled relative to the staff-height. So, at 20pt staff-height, a 12pt font looks just right, but at 17pt staff-height, it ends up being scaled down to 12*(17/20) = 10.2pt. There are ways around this, though. Markups have the \abs-fontsize macro, but there isn't a built-in one for anything else, like Lyrics. A really nice macro was put together by Mike Solomon so the "absolute" nature of font size can be applied to any other kind of text object. Here's the code for it:

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


which you then can use like this:

\override LyricText.font-size = \absFontSize 11.5


Without this, then to get back up to 12pt you'd need to manually increase the font-size, which is what you've learned already.

Regards,
Abraham




View this message in context: Re: problem with installed font when set-global-staff-size is changed
Sent from the User mailing list archive at Nabble.com.

reply via email to

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