lilypond-user
[Top][All Lists]
Advanced

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

Define markup with iteration


From: Pierre Perol-Schneider
Subject: Define markup with iteration
Date: Tue, 14 Apr 2015 14:22:58 +0200

Hi List, Hi Schemers,

I'd like to put an iteration in a markup command. I've never done that before so I'm a little lost (I've already tried hundreds of alternatives... :( ):
Here's where I am so far:

%%%%%
\version "2.19.18"

#(define-markup-command (staff-lines-it layout props n pad long) (number? number? number?)
     (interpret-markup layout props
       (define (iter n)
         (if (= n 0)
             (markup (#:path 0.15 `((moveto  0  ,(* pad 0))(lineto  ,long  ,(* pad 0)))))
             (iter (- 1 n))
             (markup
                 (#:combine
                     (#:path 0.15
                       `(
                           (moveto  0  ,(* pad n))(lineto  ,long  ,(* pad n))     ; n
                          
                           ;;iteration:
                           ;(moveto  0  ,(* pad 0))(lineto  ,long  ,(* pad 0))     ; 0
                           ;(moveto  0  ,(* pad 1))(lineto  ,long  ,(* pad 1))     ; 1
                           ;(moveto  0  ,(* pad 2))(lineto  ,long  ,(* pad 2))     ; 2   
                           ;...
                           ;(moveto  0  ,(* pad n))(lineto  ,long  ,(* pad n))     ; n
                        )))
                     )
                   ))))

%% Test: should show 5 staff lines with padding #1 and length #10:
\markup\staff-lines-it #5 #1 #10

%%%%%%%%%%%%%%%%%%%


Thanks in advance for any help.

Cheers,
Pierre

reply via email to

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