\version "2.22.2" #(define*-public ((box-grob-stencil-with-thickness #:optional (thick 0.1) (pad 0)) grob) (let* ((xext (ly:grob-extent grob grob 0)) (yext (ly:grob-extent grob grob 1)) (xext (interval-widen xext pad)) (yext (interval-widen yext pad))) (ly:stencil-add (make-filled-box-stencil (interval-widen xext thick) (cons (- (car yext) thick) (car yext))) (make-filled-box-stencil (interval-widen xext thick) (cons (cdr yext) (+ (cdr yext) thick))) (make-filled-box-stencil (cons (cdr xext) (+ (cdr xext) thick)) yext) (make-filled-box-stencil (cons (- (car xext) thick) (car xext)) yext)))) \score { \layout { \context { \Score \override System.stencil = #(box-grob-stencil-with-thickness 0.4 0.5) } } { \slurDown c4 ( g4 c''4) } } \markup\vspace #1 #(define-public (box-grob-stencil grob) (let* ((det (ly:grob-property grob 'details)) (thick (assoc-get 'box-thickness det 0.1)) (pad (assoc-get 'box-padding det 0))) ((box-grob-stencil-with-thickness thick pad) grob))) \score { \layout { \context { \Score \override System.stencil = #box-grob-stencil \override System.details.box-thickness = #1 \override System.details.box-padding = #1 } } { \slurDown c4 ( g4 c''4) } }