lilypond-user
[Top][All Lists]
Advanced

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

Re: Making markup functions parametric


From: Lukas-Fabian Moser
Subject: Re: Making markup functions parametric
Date: Sat, 4 Jul 2020 10:22:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

Hi Urs,

I have tried various things, but I don't seem to understand how that
primitive-eval actually works here. Your solution does only work when
the input is a simple markup (string), not when it is wrapped in other
markup commands.

It seems to work quite robustly if you draw the given content markup into a stencil and insert this stencil in the markup expression that will be fly-evaluated:

\version "2.20"

#(define (get-scheme-markup-function func)
   (symbol-append 'make- func '-markup))

#(define-markup-command (enclose layout props func content)(symbol? markup?)
   (interpret-markup layout props
                     (primitive-eval
                      (list 'markup
                            (list
                             (get-scheme-markup-function func)
                             `(make-stencil-markup ,(interpret-markup layout props content)))))))

\markup \enclose #'box "C"
\markup \enclose #'circle \italic \concat { "Camel" "Case" }
\markup \enclose #'circle \enclose #'box \italic "E"

Does this help?

Best
Lukas





reply via email to

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