1 ;;;; titling.scm -- titling functions
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2004--2008 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)
16 layout scopes page-number is-last-bookpart is-bookpart-last-page)
18 "Read variables WHAT-ODD, WHAT-EVEN from LAYOUT, and interpret them
19 as markup. The PROPS argument will include variables set in SCOPES and
20 page:is-bookpart-last-page, page:is-last-bookpart, page:page-number-string
24 (ly:output-def-lookup layout sym))
26 (define (interpret-in-page-env potential-markup)
27 (if (markup? potential-markup)
28 (let* ((alists (map ly:module->alist scopes))
36 (symbol->string (car entry))))
43 (ly:modules-lookup scopes 'tagline
44 (ly:output-def-lookup layout 'tagline)))
45 (cons 'page:is-last-bookpart is-last-bookpart)
46 (cons 'page:is-bookpart-last-page is-bookpart-last-page)
47 (cons 'page:page-number-string
48 (number->string page-number))
49 (cons 'page:page-number page-number)))
53 (layout-extract-page-properties layout))))
54 (interpret-markup layout props potential-markup))
58 (interpret-in-page-env
59 (if (and (even? page-number)
60 (markup? (get what-even)))
64 (define-public ((marked-up-title what) layout scopes)
65 "Read variables WHAT from SCOPES, and interpret it as markup. The
66 PROPS argument will include variables set in SCOPES (prefixed with
71 (let ((x (ly:modules-lookup scopes sym)))
72 (if (markup? x) x #f)))
74 (let* ((alists (map ly:module->alist scopes))
82 (symbol->string (car entry))))
86 (props (append prefixed-alist
87 (layout-extract-page-properties layout)))
89 (markup (ly:output-def-lookup layout what)))
92 (interpret-markup layout props markup)
93 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))