X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Ftitling.scm;h=4bb464ae68cc0bbbb18cde1762d1210ce36bcb59;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=b6c1e0583d1a3dd7fc39977df7e447a90faac538;hpb=08560a1b8076630c4fc6cb9b902614d8b74fd6fc;p=lilypond.git diff --git a/scm/titling.scm b/scm/titling.scm index b6c1e0583d..4bb464ae68 100644 --- a/scm/titling.scm +++ b/scm/titling.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2004--2012 Jan Nieuwenhuizen +;;;; Copyright (C) 2004--2015 Jan Nieuwenhuizen ;;;; Han-Wen Nienhuys ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify @@ -18,86 +18,89 @@ (define-public (layout-extract-page-properties layout) (list (append `((line-width . ,(ly:paper-get-number - layout 'line-width))) - (ly:output-def-lookup layout 'text-font-defaults)))) + layout 'line-width))) + (ly:output-def-lookup layout 'text-font-defaults)))) ;;;;;;;;;;;;;;;;;; -(define-public ((marked-up-headfoot what-odd what-even) +(define ((marked-up-headfoot what-odd what-even) layout scopes page-number is-last-bookpart is-bookpart-last-page) "Read variables @var{what-odd}, @var{what-even} from @var{layout}, and interpret them as markup. The @var{props} argument will include variables set in @var{scopes} and @code{page:is-bookpart-last-page}, @code{page:is-last-bookpart}, @code{page:page-number-string}, and -@code{page:page-number}." +@code{page:page-number}." (define (get sym) (ly:output-def-lookup layout sym)) (define (interpret-in-page-env potential-markup) (if (markup? potential-markup) - (let* ((alists (map ly:module->alist scopes)) - (prefixed-alists - (map (lambda (alist) - (map (lambda (entry) - (cons - (string->symbol - (string-append - "header:" - (symbol->string (car entry)))) - (cdr entry))) - alist)) - alists)) - (pgnum-alist - (list - (cons 'header:tagline - (ly:modules-lookup scopes 'tagline - (ly:output-def-lookup layout 'tagline))) - (cons 'page:is-last-bookpart is-last-bookpart) - (cons 'page:is-bookpart-last-page is-bookpart-last-page) - (cons 'page:page-number-string - (number->string page-number)) - (cons 'page:page-number page-number))) - (props (append - (list pgnum-alist) - prefixed-alists - (layout-extract-page-properties layout)))) - (interpret-markup layout props potential-markup)) + (let* ((alists (map ly:module->alist scopes)) + (prefixed-alists + (map (lambda (alist) + (map (lambda (entry) + (cons + (string->symbol + (string-append + "header:" + (symbol->string (car entry)))) + (cdr entry))) + alist)) + alists)) + (number-type (get 'page-number-type)) + (pgnum-alist + (list + (cons 'header:tagline + (ly:modules-lookup scopes 'tagline + (ly:output-def-lookup layout 'tagline))) + (cons 'page:is-last-bookpart is-last-bookpart) + (cons 'page:is-bookpart-last-page is-bookpart-last-page) + (cons 'page:page-number-string + (number-format number-type page-number)) + (cons 'page:page-number page-number))) + (props (append + (list pgnum-alist) + prefixed-alists + (layout-extract-page-properties layout)))) + (interpret-markup layout props potential-markup)) - empty-stencil)) + empty-stencil)) (interpret-in-page-env (if (and (even? page-number) - (markup? (get what-even))) + (markup? (get what-even))) (get what-even) (get what-odd)))) +(export marked-up-headfoot) -(define-public ((marked-up-title what) layout scopes) +(define ((marked-up-title what) layout scopes) "Read variables @var{what} from @var{scopes}, and interpret it as markup. The @var{props} argument will include variables set in @var{scopes} (prefixed with `header:'." - + (define (get sym) (let ((x (ly:modules-lookup scopes sym))) (if (markup? x) x #f))) (let* ((alists (map ly:module->alist scopes)) - (prefixed-alist - (map (lambda (alist) - (map (lambda (entry) - (cons - (string->symbol - (string-append - "header:" - (symbol->string (car entry)))) - (cdr entry))) - alist)) - alists)) - (props (append prefixed-alist - (layout-extract-page-properties layout))) + (prefixed-alist + (map (lambda (alist) + (map (lambda (entry) + (cons + (string->symbol + (string-append + "header:" + (symbol->string (car entry)))) + (cdr entry))) + alist)) + alists)) + (props (append prefixed-alist + (layout-extract-page-properties layout))) - (markup (ly:output-def-lookup layout what))) + (markup (ly:output-def-lookup layout what))) (if (markup? markup) - (interpret-markup layout props markup) - (ly:make-stencil '() '(1 . -1) '(1 . -1))))) + (interpret-markup layout props markup) + empty-stencil))) +(export marked-up-title)