Hello Andrew,
is there any reason for using a custom circle approximation instead of simply
using (make-circle-stencil r th #f)?
The reason why your note heads are off is that a path stencil does not have an
extent. A path cotains arbitrary drawing commands, which means that Lilypond
does not really know how large the result would be. As such your Note Heads
are handled as points, but then draw outside of this, which means that
Lilypond cannot handle spacing properly.
What you need to do is to give the stencil an actual extent by using
ly:stencil-outline, as done here:
\version "2.23.11"
circa =
#(let* ((k 0.5522)
(r 1)
(th 0.1)
(th2 (/ th 2))
(rth (+ r th2)))
(ly:stencil-outline
(ly:make-stencil `(path ,th
(moveto ,r 0
curveto ,r ,k ,k ,r 0 ,r
curveto ,(- k) ,r ,(- r) ,k ,(- r) 0
curveto ,(- r) ,(- k) ,(- k) ,(- r) 0 ,(- r)
curveto ,k -1 1 ,(- k) 1 0
))
(cons 1 1) (cons 1 1))
(make-filled-box-stencil (cons (- rth) rth) (cons (- rth) rth))))