On 5 October 2011 18:48, Jan-Peter Voigt <jp.vo...@gmx.de> wrote: > Hello list, > > for the simple case of italic lyrics, the answer withe override/revert is > already given. But I just wanted to point out another possibility for more > complex markups in lyrics: > In the following snippet I define a function to create music functions, that > wraps all lyric syllables in another markup. The actual syllable is given in > a property 'lyric:text, so \markup { \fromproperty #'lyric:text } prints the > lyrics unmodified. If there are only few places to modify font-shape or > font-size, I'd recommend the override/revert solution (you still might have > a function with an \override $mus \revert construct). But if you have > another markup command, that is not covered by the standard > LyricText-properties, you can use this function. And you can have a central > place to define, how all lyrics in places, marked with a special function, > look like. > > Cheers, Jan-Peter > > --snip-- > \version "2.14.2" > % create music-functions to markup lyrics > #(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))) > ;;; the syllable text is found in property 'lyric:text > (ly:music-set-property! m 'text (markup #:override > (cons 'lyric:text syl) mup)))) > m)) > lyrics))) > > % create italic lyrics > lita = \markup { > \italic \fromproperty #'lyric:text > } > lyritalic = #(define-lyric-markup lita) > > % create a wrapper for lyricsize with parameter > lyricsize = #(define-music-function (parser location size lyrics) (number? > ly:music?) > (let ((lsf (ly:music-function-extract (define-lyric-markup (markup > #:fontsize size #:fromproperty 'lyric:text))))) > (lsf parser location lyrics)) > ) > > % create some other markup cmd > #(define-markup-command (hilite layout props mup)(markup?) > "hilite markup" > (let* ((wextent (lambda (ext diff) `(,(- (car ext) diff) . ,(+ (cdr ext) > diff) ))) > (gob (chain-assoc-get 'edge-round props 0.1)) > (gauge-stencil (interpret-markup layout props mup)) > (x-ext (wextent (ly:stencil-extent gauge-stencil X) gob)) > (y-ext (wextent (ly:stencil-extent gauge-stencil Y) gob)) > (color (chain-assoc-get 'hilite-color props yellow))) > (interpret-markup layout props > (markup #:combine #:with-color color #:filled-box x-ext y-ext gob > #:with-color red mup)))) > % use the new markup command > lite = \markup { > \hilite \fromproperty #'lyric:text > } > lyrhilite = #(define-lyric-markup lite) > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %%% example > \relative c' { > e4 a b c b bes a aes g ges f e ees d des c > } \addlyrics { > a \lyritalic { b c } d e \lyricsize #3 { f g h } i j k \lyrhilite { l m n o > p } > } > --snip-- > > > _______________________________________________ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user > >
Wow, if you could define a function for small caps, you would be my hero! My first introduction to marking up lyrics was small caps, which I suspect is “not covered by the standard LyricText-properties”, as far as I can tell anyway. Vaughan _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user