From: Han-Wen Nienhuys Date: Wed, 17 Jan 2007 14:37:34 +0000 (+0100) Subject: reimplement stack-stencils without minimum-translation argument. X-Git-Tag: release/2.11.12-1~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c0dae03eb0da10199d5e183d99ebeaab1d61fe0f;p=lilypond.git reimplement stack-stencils without minimum-translation argument. --- diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 70faac6a82..0746876ca3 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -380,6 +380,9 @@ found." (define-public interval-end cdr) +(define-public (interval-bound interval dir) + ((if (= dir RIGHT) cdr car) interval)) + (define-public (interval-index interval dir) "Interpolate INTERVAL between between left (DIR=-1) and right (DIR=+1)" diff --git a/scm/stencil.scm b/scm/stencil.scm index 410e0eebe1..463a082fd3 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -30,14 +30,33 @@ (define-public (stack-lines dir padding baseline stils) "Stack vertically with a baseline-skip." - (if (null? stils) - empty-stencil - (if (null? (cdr stils)) - (car stils) - (ly:stencil-combine-at-edge - (car stils) Y dir - (stack-lines dir padding baseline (cdr stils)) - padding baseline)))) + (define result empty-stencil) + (define last-y #f) + (do + ((last-stencil #f (car p)) + (p stils (cdr p))) + + ((null? p)) + + (if (number? last-y) + (begin + (let* ((dy (max (+ (* dir (interval-bound (ly:stencil-extent last-stencil Y) dir)) + padding + (* (- dir) (interval-bound (ly:stencil-extent (car p) Y) (- dir)))) + baseline)) + (y (+ last-y (* dir dy)))) + + + + (set! result + (ly:stencil-add result (ly:stencil-translate-axis (car p) y Y))) + (set! last-y y))) + (begin + (set! last-y 0) + (set! result (car p))))) + + result) + (define-public (bracketify-stencil stil axis thick protusion padding) "Add brackets around STIL, producing a new stencil."