diff options
author | David Kastrup <dak@gnu.org> | 2013-04-28 14:47:42 +0200 |
---|---|---|
committer | David Kastrup <dak@gnu.org> | 2013-05-26 02:33:02 +0200 |
commit | 56533b5364a0b52502387b2f899a3a58ed0eeba2 (patch) | |
tree | 190480ac96f38958c8b4f3c4d5feb2f76df8e921 /scm | |
parent | 35d5f2e2ff40e0bd35cf00f22c2428eac354e566 (diff) |
simplify stack-stencils and rewrite stack-stencils-padding-list
Diffstat (limited to 'scm')
-rw-r--r-- | scm/stencil.scm | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/scm/stencil.scm b/scm/stencil.scm index fe3a84e4a4..c93dbd16ad 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -42,24 +42,23 @@ (define-public (stack-stencils axis dir padding stils) "Stack stencils @var{stils} in direction @var{axis}, @var{dir}, using @var{padding}." - (cond - ((null? stils) empty-stencil) - ((null? (cdr stils)) (car stils)) - (else (ly:stencil-combine-at-edge - (car stils) axis dir (stack-stencils axis dir padding (cdr stils)) - padding)))) - -(define-public (stack-stencils-padding-list axis dir padding stils) + (reduce + (lambda (next front) + (ly:stencil-stack front axis dir next padding)) + empty-stencil + stils)) + +(define-public (stack-stencils-padding-list axis dir paddings stils) "Stack stencils @var{stils} in direction @var{axis}, @var{dir}, using -a list of @var{padding}." - (cond - ((null? stils) empty-stencil) - ((null? (cdr stils)) (car stils)) - (else (ly:stencil-combine-at-edge - (car stils) - axis dir - (stack-stencils-padding-list axis dir (cdr padding) (cdr stils)) - (car padding))))) +a list of @var{paddings}." + (if (null? stils) + empty-stencil + (fold + (lambda (next padding front) + (ly:stencil-stack front axis dir next padding)) + (car stils) + (cdr stils) + paddings))) (define-public (centered-stencil stencil) "Center stencil @var{stencil} in both the X and Y directions." |