lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: markup in lyrics


From: Jan-Peter Voigt
Subject: Re: markup in lyrics
Date: Wed, 05 Oct 2011 11:55:09 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Lightning/1.0b2 Thunderbird/3.1.15

Hello Vaughan,

there is a known issue with caps/smallcaps and fromproperty (or nested markups? see below): http://code.google.com/p/lilypond/issues/detail?id=1482 If you take the little snippet from that site, you can use this (exchange caps/smallCaps as you like):
--snip--
#(define-markup-command (frompropertysmallcaps layout props symbol)(symbol?)
  (let ((m (chain-assoc-get symbol props)))
    (if (markup? m)
        (interpret-markup layout props (markup #:smallCaps m))
        empty-stencil)))
lyrcaps = #(define-lyric-markup (markup #:caps (#:frompropertysmallcaps 'lyric:text)))
--snip--
But still there is a problem with nested parts. Also the following will not work:
--snip--
\markup {
  \caps { Hello \italic World }
}
--snip--
The world will be italic but no caps?!

Cheers,
Jan-Peter

Am 05.10.2011 11:32, schrieb Vaughan McAlley:
On 5 October 2011 18:48, Jan-Peter Voigt<address@hidden>  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
address@hidden
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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

[Prev in Thread] Current Thread [Next in Thread]