lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Header fields in custom footer


From: Thomas Morley
Subject: Re: Header fields in custom footer
Date: Sat, 26 Nov 2016 11:39:08 +0100

2016-11-26 1:18 GMT+01:00 Andrew Bernard <address@hidden>:
> Hi Joram,
>
> Post an example of what is not working. The code I sent works fine, but I
> can't quite understand what you mean therefore.
>
> Andrew
>
>
> -----Original Message-----
> From: lilypond-user
> [mailto:address@hidden On Behalf Of
> Noeck
> Sent: Saturday, 26 November 2016 6:59 AM
> To: address@hidden
> Subject: Re: Header fields in custom footer
>
> Hi,
>
> I still need help. I am not able to get this working. Either it fails (does
> not compile) or it does not print the header fields.
>
> This back and forth between LP and Scheme does not help either. I am not
> sure if my goal is reachable:
> oddFooterMarkup would be a scheme function and the arguments to this
> function would be filled with \fromproperty. But the evaluation is taking
> place in the end on the oddFooterMarkup so the scheme function would have to
> transparently pass the header fields.



Hi Joram,

I second Andrew's call for an example.
Would be nice do know more exactly what you're trying to achieve.
Please post some example you would like to see working, even if it
fails currnetly.

That said, probably the code below may be a starting point.
It's only a proof-of-concept based on fromproperty-markup. Right now
it's likely easy to break.

Anyway:

\version "2.19.51"

#(define-markup-command (test layout props arg)(symbol?)
  #:properties ((proc '()))
  (let* ((target (chain-assoc-get arg props))
         (target-string (markup->string target))
         (output
           (if (or (null? proc) (string-null? target-string))
               target
               (proc target-string))))

    (if (markup? output)
        ;; prevent infinite loops by clearing the interpreted property:
        (interpret-markup
          layout
          (cons
            (list (cons symbol `(,property-recursive-markup ,symbol))) props)
          output)
        empty-stencil)))

#(define (test-proc xy)
  (lambda (strg)
    (if (string? strg)
        (format #f "My ~a is: ~a" xy (string-upcase strg))
        strg)))

\paper {
  oddFooterMarkup =
  \markup \column \box {
        \override #`(proc . ,(test-proc "title")) \test #'header:title
        \override #`(proc . ,(test-proc "subtitle")) \test #'header:subtitle
        \override #`(proc . ,(test-proc "subsubtitle")) \test
#'header:subsubtitle
        \override #`(proc . ,(test-proc "composer")) \test #'header:composer
        \override #`(proc . ,(test-proc "meter")) \test #'header:meter
  }
}

\header {
    composer = \markup { "xxyyzz" "foo" }
    title = "title"
    meter = \markup \rounded-box { "meter" \musicglyph #"scripts.segno" }
    subtitle = \markup \draw-line #'(10 . 0)
    subsubtitle = \markup \with-color #red"subsubtitle"
}

\markup \null



Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]