On 26/03/2024 14:01, Maurits Lamers via LilyPond user discussion wrote:

- is there a way to get a listener or callback of some kind to capture out-of-music markup? - is there a way to get access to the global headers and / or score headers (in case of score specific headers)? - is there documentation on how to get a reference to the required parameters for these scheme functions?


Here is an example for printing the global headers and score headers. You can also print the global headers from the initialize translator step of your engraver.

\version "2.24.0"

Header_export =
#(lambda (context)
  (make-engraver
    ((initialize translator)
      (ly:message "Print global headers with engraver\n")
      (printheader $defaultheader))))

#(define (headerfield header field)
  (if (and header (module-defined? header field))
    (ly:message "header field: ~a — value: ~a \n" field (module-ref header field))))

#(define (printheader header)
  (headerfield header 'opus)
  (headerfield header 'title)
  (headerfield header 'piece))

\layout { \context { \Score \consists \Header_export } }

\header {
  title = "Title"
  opus = "Op 1"
}

myscore = \score { \header { piece = "Piece" } { c'1 } }
\myscore

#(printheader $defaultheader)
#(printheader (ly:score-header myscore))


--
Timothy Lanfear, Bristol, UK.

Reply via email to