Am 07.10.2011 11:03, schrieb David Kastrup:
Which Lilypond version? This should have worked with rather old
versions actually (the newest feature I use are markup arguments in
music functions I think, and those are not all that new).
But it doesn't work in 2.14 stable, wich I actually use.
Yes in my lilydev machine your code compiles, but I still prefer my
solution, because hyphens and extenders are handled by the lyricmode.
And when
talking new functionality, there is no point in restricting one-self to
anything older than the current development version, since obviously new
functionality is not going to get integrated in any older versions.
In production I only use stable, but sometimes I still need new
functionalities like styled lyrics.
The code is not correct concerning hyphens and extenders, but that can
be fixed reasonably easy.
it can? Why didn't you already? ;)
This is the way my code works both in 2.14 and 2.15:
--snip--
%%%% 1. define function/macro/method
#(define-public (define-lyric-markup mup)
(define-music-function (parser location lyrics) (ly:music?)
(music-map
(lambda (m)
(begin
(if (equal? (ly:music-property m 'name) 'LyricEvent)
(let ((syl (ly:music-property m 'text)))
(ly:music-set-property! m 'text (markup
#:override (cons 'lyric:text syl) mup))))
m))
lyrics)))
%%%% 2. define lyric markups
lyrita = \markup { \italic \fromproperty #'lyric:text }
lyrita = #(define-lyric-markup lyrita)
lyrbold = \markup { \bold \fromproperty #'lyric:text }
lyrbold = #(define-lyric-markup lyrbold)
lyrred = \markup { \with-color #red \fromproperty #'lyric:text }
lyrred = #(define-lyric-markup lyrred)
%%%% 3. use it
\new Staff <<
\new Voice { c'2. d'4 e'2 c'2 }
\addlyrics { \lyrred { A -- ve Ma -- ter! } }
\addlyrics { \lyrita { Et Pa -- tri -- a! } }
\addlyrics { \lyrbold { A -- _ men __ _ } } >>
--snip--
But talking new functionality: With markup arguments in 2.15 you can do:
--snip--
\version "2.15"
#(define-public lyrmup (define-music-function (parser location mup
lyrics) (markup? ly:music?)
(music-map
(lambda (m)
(begin
(if (equal? (ly:music-property m 'name) 'LyricEvent)
(let ((syl (ly:music-property m 'text)))
(ly:music-set-property! m 'text (markup
#:override (cons 'lyric:text syl) mup))))
m))
lyrics)))
#(define-markup-command (syl layout props)()
(interpret-markup layout props (markup
#:fromproperty 'lyric:text)))
bolit = \markup { \italic \bold \syl }
\new Staff <<
\new Voice { c'2. d'4 e'2 c'2}
\addlyrics \notemode { \lyrmup \markup { \italic \syl } \lyricmode {
A -- ve Ma -- ter! } }
\addlyrics \notemode { \lyrmup \markup { \bold \syl } \lyricmode { Et
Pa -- tr -- ia! } }
\addlyrics \notemode { \lyrmup \bolit \lyricmode { A -- _ men __ _ } }
>>
--snip--
This way you don't need to split up a markup-list to LyricEvents and
look for Hyphens, Extenders and so on. Every syllable is just wrapped in
a markup.
... well I didn't use caps because they don't work with fromproperty in
stable *and* devel ... btw, they don't work with fontsize either - just
look at your own code! (sorry, I had to ;) )
And if I need to produce caps in my current environment, I have to
create a hack that does it right.
Cheers,
Jan-Peter
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user