lilypond-user
[Top][All Lists]
Advanced

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

Re: \path in markup dashed line


From: Aaron Hill
Subject: Re: \path in markup dashed line
Date: Thu, 28 Jan 2021 06:49:24 -0800
User-agent: Roundcube Webmail/1.4.9

On 2021-01-28 6:39 am, Dimitris Marinakis wrote:
Both systems report this error

warning: unknown line-cap-style: (quote round)

/Applications/LilyPond23.app/Contents/Resources/share/lilypond/current/scm/output-ps.scm:275:49
<0>: In procedure symbol->string in expression (symbol->string join):

/Applications/LilyPond23.app/Contents/Resources/share/lilypond/current/scm/output-ps.scm:275:49
<1>: Wrong type argument in position 1 (expecting symbol): (quote round)


My apologies. I made another change in the dashed-path markup command that mattered. Here's the complete code for reference:

%%%%
\version "2.22.0"

#(define* (dashed-path-ps thickness on off phase exps
                          #:optional (cap 'round) (join 'round))
  (let* ((path (module-ref (resolve-module '(scm output-ps)) 'path #f))
         (ps (path thickness exps cap join))
         (lines (string-split ps #\nl)))
    (set! lines (cons (car lines)
      (cons (ly:format "[ ~4f ~4f ] ~4f setdash" on off phase)
            (cdr lines))))
    (string-join lines "\n")))

#(let* ((module (resolve-module '(scm output-ps)))
        (alist (module-ref module 'stencil-dispatch-alist '())))
  (module-define! module 'stencil-dispatch-alist
   (acons 'dashed-path dashed-path-ps alist)))

#(ly:register-stencil-expression 'dashed-path)

#(define-markup-command
  (dashed-path layout props thickness commands)
  (number? list?)
  #:category graphic
  #:properties ((line-cap-style 'round)
                (line-join-style 'round)
                (on 1) (off 1) (phase 0))
  (let ((sten (path-markup layout props thickness commands))
        (command-list (fold-right append '() commands)))
    (ly:make-stencil
      `(dashed-path ,thickness ,on ,off ,phase
        ,command-list ,line-cap-style ,line-join-style)
      (ly:stencil-extent sten X)
      (ly:stencil-extent sten Y))))

samplePath =
  #'((moveto 0 0)
     (lineto -1 1)
     (lineto 1 1)
     (lineto 1 -1)
     (curveto -5 -5 -5 5 -1 0)
     (closepath))

\markup \path #0.25 #samplePath
\markup \dashed-path #0.25 #samplePath
\markup
  \override #'(on . 0.2)
  \override #'(off . 0.2)
  \override #'(line-cap-style . butt)
  \dashed-path #0.25 #samplePath
%%%%

-- Aaron Hill



reply via email to

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