]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/stencil.scm
* lily/translator.cc (derived_mark): new function.
[lilypond.git] / scm / stencil.scm
index 1e88d6c4dc8e121b533c0065183f4d39464f7a0a..f1faee20f87da2038238eff8f165cd016bc15f71 100644 (file)
@@ -1,11 +1,11 @@
-;;;; stenicil.scm -- 
+;;;; stencil.scm -- 
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
 ;;;; (c)  2003--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
 (define-public (stack-stencils axis dir padding stils)
-  "Stack stencils STILS in direction AXIS,DIR, using PADDING."
+  "Stack stencils STILS in direction AXIS, DIR, using PADDING."
   (if (null? stils)
       '()
       (if (pair? stils)
           (stack-lines dir padding baseline (cdr stils))
           padding baseline))))
 
-(define-public (fontify-text font-metric text)
-  "Set TEXT with font FONT-METRIC, returning a stencil."
-  (let* ((b  (ly:text-dimension font-metric text)))
-    (ly:make-stencil
-     (ly:fontify-atom font-metric `(text ,text)) (car b) (cdr b))))
-
 (define-public (bracketify-stencil stil axis thick protusion padding)
   "Add brackets around STIL, producing a new stencil."
 
-  (let* ((ext (ly:stencil-get-extent stil axis))
+  (let* ((ext (ly:stencil-extent stil axis))
         (lb (ly:bracket axis ext thick (- protusion)))
         (rb (ly:bracket axis ext thick protusion)))
     (set! stil
@@ -58,7 +52,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)))
@@ -68,8 +62,8 @@ encloses the contents.
 ;; TODO merge this and prev function. 
 (define-public (box-stencil stil thick padding)
   "Add a box around STIL, producing a new stencil."
-  (let* ((x-ext (interval-widen (ly:stencil-get-extent stil 0) padding))
-        (y-ext (interval-widen (ly:stencil-get-extent stil 1) padding))
+  (let* ((x-ext (interval-widen (ly:stencil-extent stil 0) padding))
+        (y-ext (interval-widen (ly:stencil-extent stil 1) padding))
         (y-rule (make-filled-box-stencil (cons 0 thick) y-ext))
         (x-rule (make-filled-box-stencil (interval-widen x-ext thick)
                                           (cons 0 thick))))
@@ -80,3 +74,15 @@ encloses the contents.
     (set! stil (ly:stencil-combine-at-edge stil Y -1 x-rule 0.0))
     
     stil))
+
+(define-public (fontify-text font-metric text)
+  "Set TEXT with font FONT-METRIC, returning a stencil."
+  (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