X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Ftest%2Fadd-text-script.ly;h=c0ce18bf7f8b59e3980c62a42cbb718bbd07f19f;hb=08b2a48bdd102e2e53b4eafaf8bdc4726e4f1119;hp=14a2dfec2d976d7b47800138a322e081dfe49787;hpb=70048d99398924e7ca0eb481925145ec243700c5;p=lilypond.git diff --git a/input/test/add-text-script.ly b/input/test/add-text-script.ly index 14a2dfec2d..c0ce18bf7f 100644 --- a/input/test/add-text-script.ly +++ b/input/test/add-text-script.ly @@ -1,37 +1,38 @@ -\version "1.9.4" +\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 'direction DOWN) - (ly:set-mus-property! m 'text (make-simple-markup x)) - m)) - + (make-music 'TextScriptEvent + 'direction DOWN + 'text (make-simple-markup x))) + #(define (add-text-script m x) - (if (equal? (ly:get-mus-property m 'name) 'EventChord) - (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-music x) x ) \notes { c'4-3 } - \paper{ raggedright = ##t } + { + \addScript "6" { c'4-3 } + } } -