lilypond-user
[Top][All Lists]
Advanced

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

Re: Add prefix to lyrics


From: Neil Puttock
Subject: Re: Add prefix to lyrics
Date: Thu, 2 Sep 2010 01:06:11 +0100

On 31 August 2010 13:42, Robert Clausecker <address@hidden> wrote:

> I want to write a small snippet for demonstration purposes, which
> contains lyrics. The problem is, that the first measure of the cited
> fragment is the second syllable of a word (Pro - phe - ten, the "Pro" is
> missing). In order to increase the readability of this snippet, I wanted
> to use a stanza to add this, eg:
>
>        \set stanza = \markup {\medium Pro ‐}
>
> This works as expected, but unfortunately the dash "-" doesn't looks
> like the dash which  usually indicates a word-continuation (Entered
> uding "--"). Does anybody know, how to get exactly this hyphen?

If you're using 2.13 you can span a hyphen between the stanza and the
first lyric syllable via a scheme engraver:

\version "2.13.31"

#(define (stanza-lyric-hyphen-engraver ctx)
   (let ((hyphen '()))

     `((initialize . ,(lambda (trans)
                        ;; if 'stanza is set, make a hyphen before anything
                        ;; else has happened
                        (and (markup? (ly:context-property ctx 'stanza))
                             (set! hyphen (ly:engraver-make-grob trans
                                                                 'LyricHyphen
                                                                 '())))))

       (acknowledgers
        (lyric-syllable-interface
         . ,(lambda (trans grob source)
              ;; if a hyphen has been created, set the first
              ;; syllable acknowledged as its right bound
              (and (ly:spanner? hyphen)
                   (ly:spanner-set-bound! hyphen RIGHT grob))))

        (stanza-number-interface
         . ,(lambda (trans grob source)
              ;; if a hyphen has been created, set the stanza
              ;; as its left bound
              (and (ly:spanner? hyphen)
                   (ly:spanner-set-bound! hyphen LEFT grob)))))

       (stop-translation-timestep
        . ,(lambda (trans)
             ;; clear hyphen at end of first timestep
             (and hyphen
                  (set! hyphen '())))))))

<<
  \new Voice = melody \relative c' {
    c2 c
  }
  \new Lyrics \with {
    stanza = #"Pro"
    % make stanza look like a lyric syllable
    \override StanzaNumber #'font-size = #1
    \override StanzaNumber #'font-series = #'bold-narrow
    % tweak stanza position to match lyric spacing
    \override StanzaNumber #'X-offset = #-5.8
    \consists #stanza-lyric-hyphen-engraver
  }
  \lyricsto melody {
    phe -- ten
  }
>>

Cheers,
Neil

Attachment: propheten.png
Description: PNG image


reply via email to

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