]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-lib.scm
(bar-line::calc-glyph-name): add dashed liine
[lilypond.git] / scm / output-lib.scm
index 950e552e2acca6906295aeb6c549f657e387289b..2071541029972caf8643e8cb9fd9fe9a080f667b 100644 (file)
@@ -206,6 +206,7 @@ centered, X==1 is at the right, X == -1 is at the left."
         (result (assoc glyph 
                       '((":|:" . (":|" . "|:"))
                         ("||:" . ("||" . "|:"))
+                        ("dashed" . ("dashed" . '())) 
                         ("|" . ("|" . ()))
                         ("||:" . ("||" . "|:"))
                         ("|s" . (() . "|"))
@@ -248,17 +249,17 @@ centered, X==1 is at the right, X == -1 is at the left."
 
 (define-public (tuplet-number::calc-denominator-text grob)
   (let*
-      ((mus (ly:grob-property grob 'cause)))
+      ((ev (ly:grob-property grob 'cause)))
     
-    (number->string (ly:music-property mus 'denominator))))
+    (number->string (ly:event-property ev 'denominator))))
 
 
 (define-public (tuplet-number::calc-fraction-text grob)
   (let*
-      ((mus (ly:grob-property grob 'cause)))
+      ((ev (ly:grob-property grob 'cause)))
     (format "~a:~a" 
-      (ly:music-property mus 'denominator)
-      (ly:music-property mus 'numerator))))
+      (ly:event-property ev 'denominator)
+      (ly:event-property ev 'numerator))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Color
@@ -289,8 +290,7 @@ centered, X==1 is at the right, X == -1 is at the left."
 
 (define (parenthesize-elements grob . rest)
   (let*
-      (
-       (refp (if (null? rest)
+      ((refp (if (null? rest)
                 grob
                 (car rest)))
        (elts (ly:grob-object grob 'elements))
@@ -300,7 +300,7 @@ centered, X==1 is at the right, X == -1 is at the left."
        (lp (ly:font-get-glyph font "accidentals.leftparen"))
        (rp (ly:font-get-glyph font "accidentals.rightparen"))
        (padding (ly:grob-property grob 'padding 0.1)))
-
+    
     (ly:stencil-add
      (ly:stencil-translate-axis lp (- (car x-ext) padding) X)
      (ly:stencil-translate-axis rp (+ (cdr x-ext) padding) X))
@@ -340,3 +340,65 @@ centered, X==1 is at the right, X == -1 is at the left."
 
   value)
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; falls
+
+(define-public (fall::print spanner)
+  (let*
+      ((delta-y (* 0.5 (ly:grob-property spanner 'delta-position)))
+       (left-span (ly:spanner-bound spanner LEFT))
+       (right-span (ly:spanner-bound spanner RIGHT))
+       (thickness (* (ly:grob-property spanner 'thickness)
+                    (ly:output-def-lookup (ly:grob-layout spanner) 'line-thickness)))
+       (padding (ly:grob-property spanner 'padding 0.5))
+       (common (ly:grob-common-refpoint right-span
+                                       (ly:grob-common-refpoint spanner
+                                               left-span X)
+                                       X))
+       (left-x (+ padding  (interval-end  (ly:grob-robust-relative-extent left-span common X))))
+       (right-x (- (interval-start  (ly:grob-robust-relative-extent right-span common X)) padding))
+       (self-x (ly:grob-relative-coordinate spanner common X))
+       (dx (- right-x left-x))
+       (exp (list 'path thickness 
+                 `(quote
+                   (rmoveto
+                    ,(- left-x self-x) 0
+
+                    rcurveto                
+                    ,(/ dx 3)
+                    0
+                    ,dx ,(* 0.66 delta-y)
+                    ,dx ,delta-y
+                    ))))
+       )
+
+    (ly:make-stencil
+     exp
+     (cons 0 dx)
+     (cons (min 0 delta-y)
+          (max 0 delta-y)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; grace spacing
+
+
+(define-public (grace-spacing::calc-shortest-duration grob)
+  (let*
+     ((cols (ly:grob-object grob 'columns))
+      (get-difference
+       (lambda (idx)
+        (ly:moment-sub (ly:grob-property (ly:grob-array-ref cols (1+ idx)) 'when)
+                       (ly:grob-property (ly:grob-array-ref cols idx) 'when))))
+      
+      (moment-min (lambda (x y)
+                   (cond
+                    ((and x y)
+                     (if (ly:moment<? x y)
+                           x
+                           y))
+                    (x x)
+                    (y y)))))
+                    
+    (fold moment-min #f (map get-difference
+                            (iota (1- (ly:grob-array-length cols)))))))
+