X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Ftest%2Fadd-text-script.ly;h=6d66b21fe73d9f19d9e9e83725f1b0c400138810;hb=39c26505b5e2af9f0529548dd3b27ffddf499057;hp=dada29c77b969ab8ed879896701fb44ba8c9d084;hpb=e1ef1410eeca1c9470c186da306e1f87b1b1a600;p=lilypond.git diff --git a/input/test/add-text-script.ly b/input/test/add-text-script.ly index dada29c77b..6d66b21fe7 100644 --- a/input/test/add-text-script.ly +++ b/input/test/add-text-script.ly @@ -1,34 +1,38 @@ -\version "1.7.6" %% or actually: 1.7.1 ... -\header { -texidoc= "Using make-music, you can add -various stuff to notes. Here is an example -how to add an extra fingering. +\version "2.9.7" +\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 (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 %%