1 ;;;; titling.scm -- titling functions
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2004--2006 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
8 (define-public (layout-extract-page-properties layout)
9 (list (append `((line-width . ,(ly:paper-get-number
11 (ly:output-def-lookup layout 'text-font-defaults))))
15 (define-public ((marked-up-headfoot what-odd what-even) layout scopes page-number last?)
17 "Read variables WHAT-ODD, WHAT-EVEN from LAYOUT, and interpret them
18 as markup. The PROPS argument will include variables set in SCOPES and
19 page:last?, page:page-number-string and page:page-number
23 (ly:output-def-lookup layout sym))
25 (define (interpret-in-page-env potential-markup)
26 (if (markup? potential-markup)
27 (let* ((alists (map ly:module->alist scopes))
35 (symbol->string (car entry))))
42 (ly:modules-lookup scopes 'tagline
43 (ly:output-def-lookup layout 'tagline)))
44 (cons 'page:last? last?)
45 (cons 'page:page-number-string
46 (number->string page-number))
47 (cons 'page:page-number page-number)))
51 (layout-extract-page-properties layout))))
53 (interpret-markup layout props potential-markup))
57 (interpret-in-page-env
58 (if (and (even? page-number)
59 (markup? (get what-even)))
63 (define-public ((marked-up-title what) layout scopes)
64 "Read variables WHAT from SCOPES, and interpret it as markup. The
65 PROPS argument will include variables set in SCOPES (prefixed with
70 (let ((x (ly:modules-lookup scopes sym)))
71 (if (markup? x) x #f)))
73 (let* ((alists (map ly:module->alist scopes))
81 (symbol->string (car entry))))
85 (props (append prefixed-alist
86 (layout-extract-page-properties layout)))
88 (markup (ly:output-def-lookup layout what)))
91 (interpret-markup layout props markup)
92 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))