]> git.donarmstrong.com Git - lilypond.git/blob - input/test/add-text-script.ly
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / input / test / add-text-script.ly
1 \version "2.7.39"
2
3 \header {
4 texidoc= "@cindex make-music Fingering
5 You can add various stuff to notes using @code{make-music}.
6 In this example, an extra fingering is attached to a note. 
7
8 In general, first do a @code{display} of the music you want to
9 create, then write a function that will structure the music for you.
10 "
11
12
13 #(define (make-text-script x) 
14    (make-music 'TextScriptEvent
15                'direction DOWN
16                'text (make-simple-markup x)))
17      
18 #(define (add-text-script m x)
19    (if (equal? (ly:music-property m 'name) 'EventChord)
20        (set! (ly:music-property m 'elements)
21              (cons (make-text-script x)
22                   (ly:music-property m 'elements)))       
23        (let ((es (ly:music-property m 'elements))
24              (e (ly:music-property m 'element)))
25          (map (lambda (y) (add-text-script y x)) es)
26          (if (ly:music? e)
27              (add-text-script e x))))
28    m)
29
30 \score {
31   \applyMusic #(lambda (x)  (add-text-script x "6") (display-music x) x )  { c'4-3 }
32         \layout{ ragged-right = ##t }
33 }
34
35