1 %------------------------------------------------------------------%
2 % Opéra Libre -- text-functions.ly %
4 % (c) Valentin Villenave, 2008, 2009 %
5 %------------------------------------------------------------------%
7 %% FIXME: adapt to new framework
10 %%%%%%%%%%%%%%%%%%%%%%%%%% In-score Text %%%%%%%%%%%%%%%%%%%%%%%%%%%
13 %% Non-standard synamics ------------------------------------------%
15 fpp
= #(make-dynamic-script
"fpp")
16 sffz
= #(make-dynamic-script
"sffz")
19 %% Composite Dynamics ---------------------------------------------%
21 % because of the use of a music-function,
22 % non-predefined composite dynamics have to be entered *before*
23 % the affected beat (unlike standard or predefined dynamics).
25 #(define-music-function
(parser location dyn str
) (string? string?
)
26 (make-music
'SequentialMusic
'elements
28 (make-music
'OverrideProperty
30 'grob-property-path
(list
'self-alignment-X
)
31 'grob-value -
0.6 'once
#t
)
32 (make-music
'AbsoluteDynamicEvent
34 (markup
#:rounded-whiteout
1
37 #:text
#:medium
#:italic str
))))))
40 #(define-music-function
(parser location str dyn
) (string? string?
)
41 (make-music
'SequentialMusic
'elements
43 (make-music
'OverrideProperty
45 'grob-property-path
(list
'self-alignment-X
)
46 'grob-value -
0.6 'once
#t
)
47 (make-music
'AbsoluteDynamicEvent
49 (markup
#:rounded-whiteout
1
50 #:line
(#:text
#:medium
#:italic str
54 %% Predefined commands
56 ffsubito
= #(make-dynamic-extra
"ff" "subito")
57 fsubito
= #(make-dynamic-extra
"f" "subito")
58 fsempre
= #(make-dynamic-extra
"f" "sempre")
59 mfsubito
= #(make-dynamic-extra
"mf" "subito")
60 fmolto
= #(make-dynamic-extra
"f" "molto")
61 psempre
= #(make-dynamic-extra
"p" "sempre")
62 ppsempre
= #(make-dynamic-extra
"pp" "sempre")
63 mpsempre
= #(make-dynamic-extra
"mp" "sempre")
64 mfsempre
= #(make-dynamic-extra
"mf" "sempre")
65 mfintenso
= #(make-dynamic-extra
"mf" "intenso")
66 mpsostenuto
= #(make-dynamic-extra
"mp" "sostenuto")
67 psubito
= #(make-dynamic-extra
"p" "subito")
68 pdolce
= #(make-dynamic-extra
"p" "dolce")
69 ppdolce
= #(make-dynamic-extra
"pp" "dolce")
70 pleggiero
= #(make-dynamic-extra
"p" "leggiero")
71 ppleggiero
= #(make-dynamic-extra
"pp" "leggiero")
72 ppsubito
= #(make-dynamic-extra
"pp" "subito")
73 mfleggiero
= #(make-dynamic-extra
"mf" "leggiero")
74 piuf
= #(make-extra-dynamic
"più" "f")
75 pocof
= #(make-extra-dynamic
"poco" "f")
78 %% Text indications -----------------------------------------------%
81 #(define-music-function
(parser location text music
) (string? ly
:music?
)
83 (equal?
(ly
:music-property music
'name
) 'EventChord
)
84 (set
! (ly
:music-property music
'elements
)
85 (append
(ly
:music-property music
'elements
)
86 (list
(make-music
'TextScriptEvent
'direction
1
87 'text
(markup
#:indic text
))))))
91 #(define-music-function
(parser location texte
)
94 (markup
#:text
#:indic texte
)))
96 %% Predefined commands
98 #(define-music-function
(parser location music
) (ly
:music?
)
99 #{ \ind #"pizz." $music
#})
102 #(define-music-function
(parser location music
) (ly
:music?
)
103 #{ \ind #"arco" $music
#})
106 #(define-music-function
(parser location music
) (ly
:music?
)
107 #{ \ind #"flautando" $music
#})
110 #(define-music-function
(parser location music
) (ly
:music?
)
111 #{ \ind #"simile" $music
#})
114 #(define-music-function
(parser location music
) (ly
:music?
)
115 #{ \ind #"loco" $music
#})
118 #(define-music-function
(parser location music
) (ly
:music?
)
119 #{ \ind #"(ordin.)" $music
#})
122 #(define-music-function
(parser location music
) (ly
:music?
)
123 #{ \ind #"meno" $music
#})
126 #(define-music-function
(parser location music
) (ly
:music?
)
127 #{ \ind #"jeté" $music
#})
129 %%%%%%%%%%%%%%%%%%%%%%%%%%%% Other Text %%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 %% Lyrics formatting ----------------------------------------------%
135 \override Lyrics
. LyricExtender
#'stencil
= ##f }
138 \revert Lyrics
. LyricExtender
#'stencil
}
141 \once \override LyricText
#'self-alignment-X
= #0.9 }
144 \once \override LyricHyphen
#'minimum-distance
= #4
145 \once \override LyricHyphen
#'length
= #2
146 \once \override LyricHyphen
#'thickness
= #1.2
150 \once \override LyricText
#'font-shape
= #'italic
}
153 \override LyricText
#'font-shape
= #'caps
}
156 \revert LyricText
#'font-shape
}
159 %% Scenography formatting ---------------------------------------%
161 \once \override TextScript
#'extra-spacing-width
= #'(0 . 0)
162 \once \override TextScript
#'infinite-spacing-height
= ##t
165 #(define-markup-command
(did layout props text
) (markup?
)
166 (interpret-markup layout props
167 (markup
#:override
'(line-width
. 40)
168 #:override
'(box-padding
. 1)
169 #:override
'(corner-radius
. 2)
170 #:rounded-box
#:sans
#:italic
#:small
#:justify-string text
)))
172 #(define-markup-command
(init-did layout props text
) (markup?
)
173 (interpret-markup layout props
175 ;
#:override
(cons
'line-width
(* 1 (chain-assoc-get
'line-width props
)))
177 #:override
'(line-width
. 60)
178 #:override
'(box-padding
. 1.5)
179 #:override
'(corner-radius
. 2)
180 #:rounded-box
#:sans
#:italic
#:small
#:justify-string text
))))
183 %% Table of contents --------------------------------------------%
185 #(define-music-function
(parser location text
) (markup?
)
186 (add-toc-item
! 'tocActMarkup text
))
189 #(define-music-function
(parser location text
) (markup?
)
190 (add-toc-item
! 'tocQuoteMarkup text
))
192 %% Characters and instrument names ------------------------------%
194 #(define characters `
((dummy
. "")))
195 #(define instruments `
((dummy
. "")))
197 #(define
(char-name n
) (car
(car
(assoc-get n characters
))))
198 #(define
(char-shortname n
) (cdr
(car
(assoc-get n characters
))))
199 #(define
(instr-name n
) (car
(car
(assoc-get n instruments
))))
200 #(define
(instr-shortname n
) (cdr
(car
(assoc-get n instruments
))))
202 #(define
(make-char-name n
. pad
)
203 (let
* ((txt
(char-name n
))
204 (srt
(char-shortname n
))
206 (markup
#:hcenter-in
(car pad
) txt
)
208 (n
(markup srt
))) fixme
: shortname has no padding
209 (ly
:export
(make-sequential-music
(list
210 (context-spec-music
(make-property-set
'instrumentName m
)
212 (context-spec-music
(make-property-set
'shortInstrumentName n
)
214 (context-spec-music
(make-property-set
'midiInstrument
"voice oohs")
217 #(define
(make-instrument-name n midi
. pad
)
218 (let
* ((txt
(instr-name n
))
219 (srt
(instr-shortname n
))
221 (markup
#:hcenter-in
(car pad
) txt
)
223 (n
(markup srt
))) ;; fixme
: shortname has no padding
224 (ly
:export
(make-sequential-music
(list
225 (context-spec-music
(make-property-set
'instrumentName m
)
227 (context-spec-music
(make-property-set
'shortInstrumentName n
)
229 (context-spec-music
(make-property-set
'midiInstrument midi
)