X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Ftest%2Fadd-text-script.ly;h=c0ce18bf7f8b59e3980c62a42cbb718bbd07f19f;hb=1e7c646a6e134d17896f8895fe6780678a4b0c27;hp=6b0effff0ea4f21a263af1b7ce84f82579e65f53;hpb=12a99f3c1730cf0c59e2ac4955ed7db4f52aaf61;p=lilypond.git diff --git a/input/test/add-text-script.ly b/input/test/add-text-script.ly index 6b0effff0e..c0ce18bf7f 100644 --- a/input/test/add-text-script.ly +++ b/input/test/add-text-script.ly @@ -1,33 +1,38 @@ -\version "1.3.146" -\header { -texidoc= "Using make-music, you can add -various stuff to notes. Here is an example -how to add an extra fingering. +\version "2.10.0" +\sourcefilename "add-text-script.ly" -In general, first do a display of the music you want ot -create, then write a function that will build the structure for you." +\header { +texidoc= "@cindex make-music Fingering +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 (ly-make-music "Text_script_req"))) - (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) "Request_chord") - (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 (music? e) + (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-script x "6") (display x) x ) \notes { c4-3 } + { + \addScript "6" { c'4-3 } + } }