Hi Reggie,
e.g. :
\version "2.19.80"
#(define-markup-command (n-agon layout props corners radius arg)
(number? number? markup?)
#:category graphic
#:properties ((thickness 1))
(let* ((th (* (ly:output-def-lookup layout 'line-thickness)
thickness))
(alpha-step (if (= corners 0) 99 (/ (* 2 PI) corners)))
(alpha-start (if (>= radius 0) (/ alpha-step 2) 0))
(polypoints
(let loop ((alpha alpha-start))
(if (> alpha (* 2 PI))
'()
(cons (* (abs radius) (sin alpha)) (cons (- 0 (* (abs radius) (cos alpha)))
(loop (+ alpha alpha-step)))))))
(m (interpret-markup layout props arg))
(x-ext (ly:stencil-extent m X))
(y-ext (ly:stencil-extent m Y)))
(ly:stencil-add m
(ly:stencil-translate
(if (equal? polypoints '())
(ly:make-stencil (list 'circle radius th #f))
(ly:make-stencil `(polygon ',polypoints ,th #f)))
(cons (/ (cdr x-ext) 2) (/ (cdr y-ext) 2))))))
% TEST:
{
\mark\markup\n-agon #3 #-3 \bold\fontsize #1.5 "3"
c'
}
HTH, cheers,
Pierre