]> git.donarmstrong.com Git - lilypond.git/commitdiff
Make the origin of a connected-shape configurable.
authorPatrick McCarty <pnorcks@gmail.com>
Fri, 13 Aug 2010 19:50:26 +0000 (12:50 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Fri, 13 Aug 2010 22:03:08 +0000 (15:03 -0700)
`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

index 3e1de989492d157634a1e937de1f4e54a705e610..446253c4f51623a50a1efe5e692e3b5272e6303a 100644 (file)
@@ -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