lilypond-user
[Top][All Lists]
Advanced

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

numbers as arguments in define-markup-command


From: Orm Finnendahl
Subject: numbers as arguments in define-markup-command
Date: Fri, 29 Dec 2006 16:23:09 +0100
User-agent: Mutt/1.5.11

Hi,

I try to define a markup for vertical arrows and can't get the
function to take two numbers as arguments. Using strings as arguments
or a number and a string works. It seems the last argument to
define-markup-command has to be a string. Does anybody know why and
how to make it work with numbers? I'd rather supply the y-offset and
length of the arrow as a number.

This doesn't work:

\version "2.11.2"

#(define-markup-command (varrow layout props yoff len) (number? number?)
  (interpret-markup layout props
   (markup
    #:line
    (#:postscript
     (string-append 
      "1 1 scale 0.1 setlinewidth 0 "
      (number->string yoff)
      " translate 0 0 moveto -0.25 1 lineto 0.25 1 lineto 0 0 lineto closepath 
fill 0 1 moveto 0 "
      (number->string len)
      " rlineto stroke")))))

{c4^\markup {\varrow #3 #10}}

lilypond signals an error about the 10 being an unbound variable. I
don't get this error when supplying the "10" directly as a string:

This works:

\version "2.11.2"

#(define-markup-command (varrow layout props yoff len) (number? string?)
  (interpret-markup layout props
   (markup
    #:line
    (#:postscript
     (string-append 
      "1 1 scale 0.1 setlinewidth 0 "
      (number->string yoff)
      " translate 0 0 moveto -0.25 1 lineto 0.25 1 lineto 0 0 lineto closepath 
fill 0 1 moveto 0 "
      len
      " rlineto stroke")))))

{c4^\markup {\varrow #3 #"10"}}



--
Orm




reply via email to

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