Hi Paul, 2015-08-13 19:50 GMT+02:00 Paul Morris <p...@paulwmorris.com>: > Here’s another possibility that uses an optional axis argument. -Paul > > \version "2.19.22" > > #(define* (center-stencil-on-stencil stil-a stil-b #:optional axis) > "Return a copy of stencil @var{stil-b} that has been moved > so it is centered on stencil @var{stil-a} on @var{axis}. When > @var{axis} is omitted, the centering is done on both X and > Y axes. @var{axis} is 0 for X axis, 1 for Y axis." > (if axis > ;; center on one axis only > (ly:stencil-translate-axis > (ly:stencil-aligned-to stil-b axis CENTER) > (interval-center (ly:stencil-extent stil-a axis)) > axis) > ;; center on both X and Y axes > (ly:stencil-translate > (centered-stencil stil-b) > (cons > (interval-center (ly:stencil-extent stil-a X)) > (interval-center (ly:stencil-extent stil-a Y)))))) > > square = > #(make-connected-path-stencil > '((0 0) (4 0) (4 4) (0 4) (0 0)) > 0.4 1 1 #f #f) > > blue-square = > #(stencil-with-color (make-filled-box-stencil '(0.4 . 2) '(0.4 . 2)) blue) > > \markup > \override #'(word-space . 3) > \line { > \stencil #(ly:stencil-add square blue-square) > \stencil #(ly:stencil-add square > (center-stencil-on-stencil square blue-square X)) > \stencil #(ly:stencil-add square > (center-stencil-on-stencil square blue-square Y)) > \stencil #(ly:stencil-add square > (center-stencil-on-stencil square blue-square)) > }
I like this best and would go for it. Regretable my vacations ended. Meaning I've reasonable less time :( Cheers, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user