lilypond-user
[Top][All Lists]
Advanced

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

LyricExtender suicide when past last note of melisma


From: Kieren MacMillan
Subject: LyricExtender suicide when past last note of melisma
Date: Sat, 19 Oct 2013 10:32:32 -0400

Hello all,

Attached is a snippet which includes a function which I sponsored (Mike S. 
developed it) to fix the problem that LyricExtender doesn't disappear when the 
LyricText extends beyond the last note of the melisma.

Would love to see this — or something similar — as part of the standard distro, 
so I thought I'd get the conversation started in that direction.
Any suggestions, improvements, enhancements, etc. greatly appreciated.

Cheers,
Kieren.
___________________________

\version "2.17.13"

#(define (lyric-extender::print grob)
 (let* ((orig (ly:grob-original grob))
        (siblings (if (ly:grob? orig)
                       (ly:spanner-broken-into orig)
                       '())))
   (if (not (eq? siblings '()))
       (ly:lyric-extender::print grob)
       (let* ((left-edge (ly:spanner-bound grob LEFT))
              (common (ly:grob-common-refpoint grob left-edge X))
              (heads (ly:grob-object grob 'heads))
              (common (ly:grob-common-refpoint-of-array grob heads X))
              (left-point (cdr (ly:grob-extent left-edge common X)))
              (heads-l (ly:grob-array->list heads))
              (right-point (if (null? heads-l)
                               100000
                               (cdr (ly:grob-extent (car (reverse heads-l))
                                                    common X)))))
      (if (> (- right-point left-point) 0.0)
         (ly:lyric-extender::print grob)
         (begin (ly:grob-suicide! grob) #f))))))


\paper {
  line-width = 4.5\in
  ragged-right = ##f
}

theNotes = \relative c' {
  c8( d e f g4) a
}

theWords = \lyricmode {
  reallylongwordundermelisma __ done.
}

\markup \huge \bold "Default extenders:"
\markup \vspace #1
\score {
  <<
    \new Staff \theNotes
    \addlyrics { \theWords }
  >>
}

\markup \vspace #6
\markup \huge \bold "Fixed extenders:"
\markup \vspace #1
\score {
  <<
    \new Staff \theNotes
    \addlyrics { \theWords }
  >>
  \layout {
    \context {
      \Lyrics
      \override LyricExtender #'stencil = #lyric-extender::print
    }
  }
}


reply via email to

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