lilypond-user
[Top][All Lists]
Advanced

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

Re: Extended mensuration signs in markup via Scheme


From: David Kastrup
Subject: Re: Extended mensuration signs in markup via Scheme
Date: Tue, 10 Sep 2013 20:01:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Graham King <address@hidden> writes:

> On Tue, 2013-09-10 at 04:39 +0200, David Kastrup wrote:
>
>> Inside of markups, you can't use functions defined with
>> define-scheme-function (their argument parsing is just not compatible
>> with markup mode).  Check out define-markup-command instead.
>> 
>> As a note aside: case can't be used with strings as (eqv? "x" "x") => #f
>
>
>
> David, many thanks.  A few hours reading and programming later, and I'm
> nearly there.
>
> #(define-markup-command (mensSign layout props text) (markup?)
>   "Create the markup for an extended list of mensuration signs"
>   (interpret-markup layout props
>     (if (string=? text "C")

Since you use an argument of markup?, you might want to use equal?
instead of string=? here.  Otherwise, if the argument is something like
\box { f }
you get into trouble.

>       (markup (#:musicglyph "timesig.mensural44"))
> %......
> )))
>
> mensuration = #(define-music-function (P L mensuralTimesig .....)
>                   (string? .....)
>     #{ \mark \markup {
>             \concat {
>                 \mensSign mensuralTimesig  

You probably mean \mensSign #mensuralTimesig here.

>                 " ("
> %................
>
> cantusMusic = \relative c' {
>     %.....
>     \mensuration #"C"  %....
>
> This code is compiling successfully, but with two instances of
> "programming error: Object is not a markup."

Probably because of what you return when
(if (string=? "mensuralTimesig" "C") ...
goes into the else part.

> However, if I edit the mensuration function and replace
>
>         \mensSign mensuralTimesig
>
> with
>
>         \mensSign "C"
>
> the errors disappear and everything works beautifully.

Note that \mensSign mensuralTimesig is the same as \mensSign "mensuralTimesig"
and probably not what you expected.

-- 
David Kastrup




reply via email to

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