1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 2004--2010 Jan Nieuwenhuizen <janneke@gnu.org>
4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
6 ;;;; LilyPond is free software: you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation, either version 3 of the License, or
9 ;;;; (at your option) any later version.
11 ;;;; LilyPond is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;;; GNU General Public License for more details.
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 (define-public (layout-extract-page-properties layout)
20 (list (append `((line-width . ,(ly:paper-get-number
22 (ly:output-def-lookup layout 'text-font-defaults))))
26 (define-public ((marked-up-headfoot what-odd what-even)
27 layout scopes page-number is-last-bookpart is-bookpart-last-page)
29 "Read variables WHAT-ODD, WHAT-EVEN from LAYOUT, and interpret them
30 as markup. The PROPS argument will include variables set in SCOPES and
31 page:is-bookpart-last-page, page:is-last-bookpart, page:page-number-string
35 (ly:output-def-lookup layout sym))
37 (define (interpret-in-page-env potential-markup)
38 (if (markup? potential-markup)
39 (let* ((alists (map ly:module->alist scopes))
47 (symbol->string (car entry))))
54 (ly:modules-lookup scopes 'tagline
55 (ly:output-def-lookup layout 'tagline)))
56 (cons 'page:is-last-bookpart is-last-bookpart)
57 (cons 'page:is-bookpart-last-page is-bookpart-last-page)
58 (cons 'page:page-number-string
59 (number->string page-number))
60 (cons 'page:page-number page-number)))
64 (layout-extract-page-properties layout))))
65 (interpret-markup layout props potential-markup))
69 (interpret-in-page-env
70 (if (and (even? page-number)
71 (markup? (get what-even)))
75 (define-public ((marked-up-title what) layout scopes)
76 "Read variables WHAT from SCOPES, and interpret it as markup. The
77 PROPS argument will include variables set in SCOPES (prefixed with
82 (let ((x (ly:modules-lookup scopes sym)))
83 (if (markup? x) x #f)))
85 (let* ((alists (map ly:module->alist scopes))
93 (symbol->string (car entry))))
97 (props (append prefixed-alist
98 (layout-extract-page-properties layout)))
100 (markup (ly:output-def-lookup layout what)))
103 (interpret-markup layout props markup)
104 (ly:make-stencil '() '(1 . -1) '(1 . -1)))))