]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/test/add-text-script.ly
ignore .dotest
[lilypond.git] / input / test / add-text-script.ly
index a9c6639c7839b7b176bca227f61a1a9858f3e96f..c0ce18bf7f8b59e3980c62a42cbb718bbd07f19f 100644 (file)
@@ -1,35 +1,38 @@
-\version "1.7.18"  %% or actually: 1.7.1 ...
+\version "2.10.0"
+\sourcefilename "add-text-script.ly"
+
 \header {
 texidoc= "@cindex make-music Fingering
-You can add various stuff to notes using make-music.
-Here is an example of how to add an extra fingering. 
-
-In general, first do a display of the music you want to
-create, then write a function that will build the structure for you.
+You can add various stuff to notes using @code{make-music}.
+In this example, an extra fingering is attached to a note. 
 "
 } 
 
 #(define (make-text-script x) 
-   (let ((m (make-music-by-name 'TextScriptEvent)))
-     (ly:set-mus-property! m 'text-type 'finger)
-     (ly:set-mus-property! m 'text x)
-     m))
-     
+   (make-music 'TextScriptEvent
+               'direction DOWN
+               'text (make-simple-markup x)))
+
 #(define (add-text-script m x)
-   (if (equal? (ly:music-name m) 'RequestChord)
-       (ly:set-mus-property! m 'elements
-                           (cons (make-text-script x)
-                                 (ly:get-mus-property m 'elements)))
-       
-       (let ((es (ly:get-mus-property m 'elements))
-            (e (ly:get-mus-property m 'element)) )
+   (if (equal? (ly:music-property m 'name) 'EventChord)
+       (set! (ly:music-property m 'elements)
+             (cons (make-text-script x)
+                  (ly:music-property m 'elements)))       
+       (let ((es (ly:music-property m 'elements))
+            (e (ly:music-property m 'element)))
         (map (lambda (y) (add-text-script y x)) es)
         (if (ly:music? e)
             (add-text-script e x))))
    m)
 
+addScript =
+#(define-music-function (parser location script music )
+                                       ( string? ly:music? )
+               (add-text-script music script))
+
 \score {
-  \apply #(lambda (x) (add-text-script x "6") (display x) x ) \notes { c4-3 }
+  {
+    \addScript "6" { c'4-3 }
+  }
 }
 
-%% new-chords-done %%