Hi all,

thanks to answers on this list I managed to set up a 'compilation engine' that works somewhat like in the attached minimal example. (The actually used function compileScore is more complex and creates different output based on several conditions.)

\compileScore takes a \score {}, then creates a \book{} object from it, injecting another include (test-include.ily) and then passes this object to \writeScore.

It works nearly perfect, but there is one thing that puzzles me:
The line " #(set-global-staff-size 14)" from test-include.ily doesn't have any effect, whil the other Scheme expressions and the header from the include file work. If I include the file directly (uncomment the line towards the end of the file) the staff size is changed as I expect.

Is there anything special about #(set-global-staff-size) that makes it behave differently from other top-level expressions? Or is this a bug? The main question is: How can I set the global staff size from a file included that way (that's necessary because \compileScore includes different style sheets based on a custom score-type variable)?

Thanks for any help
Urs




\version "2.17.11"

writeBook =
#(define-void-function (parser location book paper layout file)
   (ly:book? list? ly:output-def? string?)
   ; set all given paper vars in book paper
   (for-each (lambda (p)
               (if (pair? p)
                   (ly:output-def-set-variable! (ly:book-paper book) (car p)(cdr p))))
     paper)
   (ly:book-process book #{ \paper {} #} layout file))


compileScore = 
#(define-void-function (parser location score)
   (ly:score?)
   (let ((book #{ \book { 
                    \include "test-include.ily"
                    \score { $score } 
                  } #}))
          #{ \writeBook \book { $book } $'(()) \layout {} $(ly:parser-output-name parser) #}))

%\include "test-include.ily"

\compileScore \score {
  \relative c' {
    d g a b
  }
}
\header {
  title = "Test"
}

#(ly:set-option 'preview #t)
#(ly:set-option 'print-pages #f)
#(ly:set-option 'include-book-title-preview #f)

#(set-global-staff-size 14)
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to