After I didn’t find anything for it in the LSR or mailing list, I came up with a scheme procedure for centering one stencil on another, on either the X or Y axis. I uploaded it to the LSR and I’m posting it here for future seekers of centered stencils.
http://lsr.di.unimi.it/LSR/Item?id=1009 <http://lsr.di.unimi.it/LSR/Item?id=1009> Cheers, -Paul %%%%%%%%%%%%% \version "2.18.2" #(define (center-stencil-on-stencil axis stil-a stil-b) "Return a copy of stencil @var{stil-b} that has been moved so it is centered on stencil @var{stil-a} on @var{axis}. @var{axis} is 0 for X axis, 1 for Y axis." (let* ((ext-a (ly:stencil-extent stil-a axis)) (ext-b (ly:stencil-extent stil-b axis)) (width-a (- (cdr ext-a) (car ext-a))) (width-b (- (cdr ext-b) (car ext-b))) (width-diff (- width-a width-b)) (position-diff (- (car ext-a) (car ext-b))) (offset (+ position-diff (/ width-diff 2))) (new-stil-b (ly:stencil-translate-axis stil-b offset axis))) new-stil-b)) %%%%%%%%%%%%% circle = #(make-circle-stencil 3 0.4 #f) square = #(stencil-with-color (make-connected-path-stencil '((0 0) (3 0) (3 3) (0 3) (0 0)) 0.4 1 1 #f #f) blue) \markup \line { \stencil #(ly:stencil-add circle square) " " \stencil #(ly:stencil-add circle (center-stencil-on-stencil X circle square)) " " \stencil #(ly:stencil-add circle (center-stencil-on-stencil Y circle square)) " " \stencil #(ly:stencil-add circle (center-stencil-on-stencil Y circle (center-stencil-on-stencil X circle square))) } %%%%%%%%%%%%%
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user