%%% DEFINITIONS FOR IMPROVED BOXING (NOT NESCESSARY BUT SPECIFYING THICKNESS AND PADDING WILL NOT WORK WITHOUT THIS!) #(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)))) #(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))) %%% DEFINITION FOR BOXING SYSTEMS #(define (find-parent-system grob) (if (null? grob) grob (if (grob::has-interface grob 'system-interface) grob (let ((X-dir (find-parent-system (ly:grob-parent grob X)))) (if (null? X-dir) (find-parent-system (ly:grob-parent grob Y)) X-dir))))) boxCurrentSystem = <> -\tweak after-line-breaking #(lambda (grob) (let ((sys (find-parent-system grob))) (ly:grob-set-property! sys 'stencil box-grob-stencil))) -\tweak stencil ##f -\markup"" boxCurrentSystemWith = #(define-music-function (thick pad) (number? number?) #{ <> -\tweak after-line-breaking #(lambda (grob) (let* ((sys (find-parent-system grob)) (det (ly:grob-property sys 'details)) (det (cons* (cons 'box-thickness thick) (cons 'box-padding pad) det))) (ly:grob-set-property! sys 'stencil box-grob-stencil) (ly:grob-set-property! sys 'details det))) -\tweak stencil ##f -\markup"" #}) %%% EXAMPLE { c1 \break \boxCurrentSystem c \break c \break \boxCurrentSystemWith #0.4 #1 c }