From ec2cc5bb24a4696ad7abb22c90a94154dbbe5f30 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Fri, 13 Aug 2010 12:50:26 -0700 Subject: [PATCH] Make the origin of a connected-shape configurable. `connected-shape-min-max' assumes that the path will start at point '(0 . 0), so we want to decouple this, permitting the origin to start anywhere. --- scm/stencil.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scm/stencil.scm b/scm/stencil.scm index 3e1de98949..446253c4f5 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -291,7 +291,7 @@ the more angular the shape of the parenthesis." (cons (min-max-crawler min cddr possible-extrema) (min-max-crawler max cddr possible-extrema))))) -(define (connected-shape-min-max pointlist) +(define (connected-shape-min-max origin pointlist) (define (line-part-min-max x1 x2) (list (min x1 x2) (max x1 x2))) @@ -353,7 +353,7 @@ the more angular the shape of the parenthesis." (apply line-min-max x))) (map (lambda (x y) (append (list (cadr (reverse x)) (car (reverse x))) y)) - (append (list (list 0 0)) + (append (list origin) (reverse (cdr (reverse pointlist)))) pointlist)))) (define-public (make-connected-shape-stencil pointlist thickness @@ -364,7 +364,9 @@ and @var{y-scale} in the Y direction. @var{connect} and @var{fill} are boolean arguments that specify if the shape should be connected or filled, respectively." - (let* ((boundlist (connected-shape-min-max pointlist))) + ;; a connected shape path must begin at point '(0 . 0) + (let* ((origin (list 0 0)) + (boundlist (connected-shape-min-max origin pointlist))) (ly:make-stencil `(connected-shape ',pointlist -- 2.39.2