]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/stencil.scm
* Documentation/topdocs/NEWS.tely: add inputfileref macro.
[lilypond.git] / scm / stencil.scm
index c8518d76f7d7b125cfa414a3aff81ac99375dc63..8880f6d02d9c1664b6b31379c5b125e4b1e4c659 100644 (file)
@@ -2,21 +2,30 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c)  2003--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 2003--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
 (define-public (stack-stencils axis dir padding stils)
   "Stack stencils STILS in direction AXIS, DIR, using PADDING."
-  (if (null? stils)
-      '()
-      (if (pair? stils)
-         (ly:stencil-combine-at-edge
-          (car stils) axis dir (stack-stencils axis dir padding (cdr stils))
-          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)
+  "Stack stencils STILS in direction AXIS, DIR, using a list of 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)))))
 
 (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
@@ -44,7 +53,6 @@
                        (- (car yext)) (cdr yext))
       xext yext))
 
-
 (define-public (box-grob-stencil grob)
   "Make a box of exactly the extents of the grob.  The box precisely
 encloses the contents.
@@ -52,7 +60,7 @@ encloses the contents.
   (let* ((xext (ly:grob-extent grob grob 0))
         (yext (ly:grob-extent grob grob 1))
         (thick 0.1))
-
+    
     (ly:stencil-add
      (make-filled-box-stencil xext (cons (- (car yext) thick) (car yext)))
      (make-filled-box-stencil xext (cons  (cdr yext) (+ (cdr yext) thick)))
@@ -77,12 +85,14 @@ encloses the contents.
 
 (define-public (fontify-text font-metric text)
   "Set TEXT with font FONT-METRIC, returning a stencil."
-  (let* ((b  (ly:text-dimension font-metric text)))
+  (let* ((b (ly:text-dimension font-metric text)))
     (ly:make-stencil
      `(text ,font-metric ,text) (car b) (cdr b))))
      
 (define-public (fontify-text-white scale font-metric text)
   "Set TEXT with scale factor s"
-  (let* ((b  (ly:text-dimension font-metric text))
-         (c  `(white-text ,(* 2 scale) ,text))) ;urg -- workaround for using ps font
-    (ly:make-stencil c  (car b) (cdr b))))  ;urg -- extent is not from ps font, but we hope it's close
+  (let* ((b (ly:text-dimension font-metric text))
+        ;;urg -- workaround for using ps font
+         (c `(white-text ,(* 2 scale) ,text)))
+    ;;urg -- extent is not from ps font, but we hope it's close
+    (ly:make-stencil c (car b) (cdr b))))