I did some further work on it. It looks pretty great, IMO. It works with left- and right-aligning, too. No scaling horizontally (just 1sp margins), but it automatically scales vertically.
``` #(define (expand-add pair n) (cons (- (car pair) n) (+ (cdr pair) n))) #(define (expand-mul mul pair) (let* ((a (car pair)) (b (cdr pair)) (mid (/ (+ a b) 2)) (A (+ (* (- a mid) mul) mid)) (B (+ (* (- b mid) mul) mid))) (cons A B))) #(define (add-brackets mols th) (define (line x1 y1 x2 y2) (stencil-with-color (make-line-stencil th x1 y1 x2 y2) '(3/5 3/5 3/5))) (let ((max-extent (ly:stencil-extent (car mols) X))) (map (lambda (x) (let ((stil-ext (ly:stencil-extent x X))) (if (not (equal? max-extent stil-ext)) (let ((me (expand-add max-extent -2)) (se (expand-add stil-ext 1)) (ye (expand-mul 1/2 (ly:stencil-extent x Y)))) (if (< (car me) (car se)) (set! x (ly:stencil-add (line (car me) (car ye) (car se) (car ye)) (line (car me) (car ye) (car me) (cdr ye)) x))) (if (> (cdr me) (cdr se)) (set! x (ly:stencil-add (line (cdr se) (car ye) (cdr me) (car ye)) (line (cdr me) (car ye) (cdr me) (cdr ye)) x)))))) x) mols))) #(define (general-column-bracket align-dir baseline mols) (let* ((aligned-mols (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)) (aligned-mols (add-brackets aligned-mols 0.1)) (stacked-stencil (stack-lines -1 0.0 baseline aligned-mols)) (stacked-extent (ly:stencil-extent stacked-stencil X))) (ly:stencil-translate-axis stacked-stencil (- (car stacked-extent)) X))) #(define-markup-command (jp-column layout props args) (markup-list?) #:category align #:properties ((baseline-skip)) (general-column-bracket CENTER baseline-skip (interpret-markup-list layout props args))) ``` On 04/23/17 00:56, caag...@gmail.com wrote: > This is great, thanks! I was trying to mess around with \hbracket and > \whiteout, but this is far better. > > Just a few questions: > Is it possible to scale the protrusions (and other things) by font size? > How can I change the color of the lines? > What does "mols" mean?
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user