lilypond-user
[Top][All Lists]
Advanced

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

Re: _ underscore lyric hyphen


From: Thomas Morley
Subject: Re: _ underscore lyric hyphen
Date: Fri, 16 Nov 2012 23:30:34 +0100

2012/11/15 Rustik <address@hidden>:
> Rustik wrote
> I have some problems with this code.

[...]

> There is hyphen before first syllable at system («_lei»), but there is no
> hyphen after this syllable.
> Syllable «lei» in word «eleison» is no first and no final. In means what in
> case of this syllable is first at system, it must have hyphen before and
> after oneself.

Hi Rustik,

with my previous code i wrote two stencil-settings. In some cases the
second will override the first.
The solution seems to be not to create a completely new stencil with
the second setting, but rather add sth new to the first setting.

Try:

\version "2.16.0"

\paper {
        ragged-right = ##f
}

strangeLyricHyphens =
\override LyricHyphen #'after-line-breaking =
  #(lambda (grob)
    (let* ((bound-left (ly:spanner-bound grob LEFT))
           (bound-left-stil (ly:grob-property bound-left 'stencil))
           (text-left (ly:grob-property bound-left 'text))
           (bound-right (ly:spanner-bound grob RIGHT))
           (bound-right-stil (ly:grob-property bound-right 'stencil))
           (orig (ly:grob-original grob))
           (siblings (if (ly:grob? orig)
                 (ly:spanner-broken-into orig)
                 '() ))
           ;; Underscore-markup:
           (underscore #{ \markup \override #'(font-name . "Arial") "_" #})
           (underscore-stil (grob-interpret-markup grob underscore))
           (stil-after-line-break
              (ly:stencil-combine-at-edge
                 bound-right-stil
                 X LEFT
                 underscore-stil
                 0))
           (new-text-stil
              (ly:stencil-combine-at-edge
                 bound-left-stil
                 X RIGHT
                 underscore-stil
                 0)))

    (ly:grob-set-property! grob 'transparent #t)

    (if (not (null? text-left))
      (ly:grob-set-property! bound-left 'stencil new-text-stil))

    (if (and (>= (length siblings) 2)
      (eq? (car (last-pair siblings)) grob))
        (ly:grob-set-property! bound-right 'stencil stil-after-line-break))))


lyr = \lyricmode {
        Cy -- ri -- e e -- lei -- son,
        Cy -- rie e -- lei -- son.
}
<<
\new Voice = "mel" \relative c' {
        c d c d c d c2 \break
        d4 c d c
}

\new Lyrics \lyricsto "mel" \lyr
>>

<<
\new Voice = "mel-2" \relative c' {
        c d c d \break
        c d c2
        d4 c d c
}

\new Lyrics \lyricsto "mel-2" \lyr
>>

\new Lyrics \lyr

\layout {
  \context {
    \Lyrics
    \strangeLyricHyphens
    \override LyricText #'font-name = #"Times New Roman"
  }
}


HTH,
  Harm



reply via email to

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