Update syntax for (*location*) callbacks
[opus_libre.git] / doc / snippets / postfix-text-spanners.ly
bloba5e879c50fa3191e47cf7536bebe04aed077fdec
1 \version "2.19"
3 \header {
4 texidoc "The traditional way of printing text spanners in
5 LilyPond, is to first specify the text to print, and then
6 start the actual spanner. Here is a way to do it all at
7 once (beware: in order for the spanner to be attached
8 to the previous note or chord, the command has to be
9 preceded with a dash)."
12 #(define (make-text-span str)
13 "Make a TextSpanner that begins with the given STR."
14 (let* ((m (make-music 'TextSpanEvent
15 'span-direction -1))
16 (details (assoc-get 'bound-details
17 (assoc-get 'TextSpanner
18 all-grob-descriptions)))
19 (left-details (assoc-get 'left
20 details)))
21 (ly:music-set-property! m 'tweaks
22 (acons 'bound-details
23 (acons 'left
24 (acons 'text str
25 left-details)
26 details)
27 (ly:music-property m 'tweaks)))
28 m))
30 %% Wrapper for the make-text-span function
31 #(define startText
32 (define-music-function (txt) (markup?)
33 (make-text-span txt)))
35 %% for consistency only.
36 #(define stopText
37 stopTextSpan)
39 \relative c' {
40 c1 d e-\startText "(hum along)" f g a-\stopText b c