lilypond-user
[Top][All Lists]
Advanced

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

Re: Setting global staff size after the \paper block nullifies font sett


From: Aaron Hill
Subject: Re: Setting global staff size after the \paper block nullifies font setting
Date: Sat, 31 Jul 2021 00:42:34 -0700
User-agent: Roundcube Webmail/1.4.9

On 2021-07-30 11:05 pm, Brent Annable wrote:
I've come across a little problem that I don't know how to fix. I've
changed the text font in a vocal score by using the scheme #define font
procedure, and have noticed that if I subsequently use
#(set-global-staff-size) *after* the \paper block, the font reverts back to the default. It doesn't do this if I use #(set-global-staff-size) *before *the
paper block.

This is a long-standing known issue [1] with LilyPond. You need to set the staff size before specifying any custom fonts because layout-set-absolute-staff-size-in-module rebuilds the font tree for the new staff size.

[1]: https://gitlab.com/lilypond/lilypond/-/issues/1129

The best I can come up with is a hack that redefines the make-default-fonts-tree procedure:

%%%%
\version "2.22.0"

changeDefaultFonts =
#(define-void-function
  (roman-str sans-str typewrite-str)
  (string? string? string?)
  (define (proc factor)
   (make-pango-font-tree roman-str sans-str typewrite-str factor))
  (set! make-default-fonts-tree proc))

\paper { indent = 0 }

foo = {
  \mark \markup \sans Sans
  b'1^\markup \typewriter Mono
     _\markup \roman Serif
}
\markup {
  \score { \foo \layout { #(layout-set-staff-size 15) } }
  \score { \foo \layout { #(layout-set-staff-size 20) } }
  \score { \foo \layout { #(layout-set-staff-size 25) } }
}
\changeDefaultFonts "Cambria" "Calibri" "Consolas"
\markup {
  \score { \foo \layout { #(layout-set-staff-size 15) } }
  \score { \foo \layout { #(layout-set-staff-size 20) } }
  \score { \foo \layout { #(layout-set-staff-size 25) } }
}
%%%%


-- Aaron Hill

Attachment: global-staff-size-fonts.cropped.png
Description: PNG image


reply via email to

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