Aah, thank you for clarifying that Aaron. And thank you for the hack, I'll
give that a go!

Regards,

Brent.

On Sat, 31 Jul 2021, 5:42 pm Aaron Hill, <lilyp...@hillvisions.com> wrote:

> 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

Reply via email to