Hi all - 

I'm trying to work on integrating a custom markup function to generate a 
procedurally generated graphic. The below is mainly nonsensical but 
demonstrates the interactions I'm trying to understand. 

%%% BEGIN MWE 
#(define (build-node-string layout props node-count stencil)
   (if
    (eq? node-count 0)
    stencil
    (let (
           (new-markup (markup
                            (#:combine
                             (#:path 0.1 (list
                                          (list 'lineto 1 0)))
                             #:translate (cons 1 0)
                             (#:draw-circle 0.25 0.1 #t)))))
           (build-node-string 
            layout 
            props 
            (1- node-count)
            (ly:stencil-combine-at-edge stencil X RIGHT (interpret-markup 
layout props new-markup) -0.25)))))
      
#(define-markup-command (generate-graph layout props node-count)
   (number?)
   (build-node-string 
     layout 
     props 
     node-count 
     (interpret-markup layout props (markup #:draw-circle 0.25 0.1 #t))))

\markup \generate-graph #4

\version "2.24.4"
%%% END MWE 

1. I would like to create a list of markups as opposed to passing a stencil in 
and then concatenating the new stencil part every time. Ideally, rendering a 
structure like below. The main benefit would be not having to pass in layout 
and props into the second function to call interpret-markup. I noticed the 
interpret-markup-list, but that doesn't seem to be what I'm looking for. 
(interpret-markup 
  layout 
  props 
  ((markup first circle) 
    (markup second circle) 
    (markup third circle))) 

The other thing that I tried was a structure like below but the #:symbols need 
to be added in a markup call, which seems to prevent me from adding them 
outside of the markup constructor. 
(markup (
        (#:draw-circle 0.25 0.1 #t) 
        (#:combine (#:path 0.1 (list (list 'lineto 1 0))) #:translate (cons 1 
0) (#:draw-circle 0.25 0.1 #t))
        (#:combine (#:path 0.1 (list (list 'lineto 1 0))) #:translate (cons 1 
0) (#:draw-circle 0.25 0.1 #t))))

2. It would be nice to define `build-node-string` as a markup function so that 
I can read properties from the props because, as far as I can see, without the 
define-markup-command I am unable to use the #:properties construct. How do I 
call a custom markup command inside another custom markup command? 

Thanks! 

-kwb 













Reply via email to