Folks,

I want to (programatically) add books to my projects each using a new global staff size setting. (It's important to me to use set-global-staff-size, as using only set-layout-staff-size famously messes up spacing).

Consider the following example. This works as it should - I get four scores, the first in standard 20pt size, the following ones with 40, 100, 150 respectively. But if I turn the top-level bookpart into a \book, all of the next three added books get the wrong staff size (namely the size intended for the previous one).

Can anybody explain what's happening here?

Lukas



\version "2.25.23"

test = \score { \repeat unfold 50 { c'1 } }

printBook =
#(define-void-function (book) (ly:book?)
   (print-book-with-defaults book))

resizableBook =
#(define-scheme-function (size) (integer?)
   #{
     \book {
       #(set-global-staff-size size)
       \test
     }
   #})

\bookpart %% Turning this into a \book messes up the staff sizes of subsequent books
{
  \test
}

\printBook \resizableBook 40
\printBook \resizableBook 100
\printBook \resizableBook 150


Reply via email to