lilypond-user
[Top][All Lists]
Advanced

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

Re: Text centralized above a TextSpan


From: David Nalesnik
Subject: Re: Text centralized above a TextSpan
Date: Sat, 19 Sep 2015 13:14:16 -0500


On Sat, Sep 19, 2015 at 12:10 PM, David Kastrup <address@hidden> wrote:
"Trevor Daniels" <address@hidden> writes:

> http://www.lilypond.org/doc/v2.19/Documentation/notation/opera-and-stage-musicals#dialogue-over-music
>
> I'd like to see this developed and added to LP core.
>
> Trevor
>
>   ----- Original Message -----
>   From: David Nalesnik
>   To: Simon Albrecht
>   Cc: lilypond-user
>   Sent: Friday, September 18, 2015 11:58 PM
>   Subject: Re: Text centralized above a TextSpan
>
>
>   Hi,
>
>
>   Alright!  This should do it...
>
>
>   You can:
>
>
>   --Adapt this for versions < 2.19.27 with a loss of overriding power
> (style, dash-fraction, etc.)--see comments beginning in line 435
>
>
>   --Use/mix markups and strings.
>
>
>   --Specify any number of texts >= 2 for your spanner.
>
>
>   --Break it across an arbitrary number of lines, with an acceptable
> distribution.
>
>
>   --Use spacers ("") to force texts closer/farther apart.  You can
> also move them like this:
>   \markup \translate [...]
>   \markup \right-align [...]
>   etc.
>
>
>   --Override the number of texts per line if you don't like the
> automatic distribution.  There's a warning if the numbers don't tally.
>
>
>   --Specify which texts will be joined by a line and which won't using
> TextSpanner.connectors. I noticed this request in another related
> thread:
>   http://www.mail-archive.com/lilypond-user%40gnu.org/msg103939.html

Well, it looks to me like being able to use something in \lyricsmode
would be useful for specifying extenders, hyphens, rhythmic
distribution, text without creating lots of new commands and properties
for the user.


Right now LyricHyphen will draw something resembling the spanner line, but comprised of a succession of round-filled boxes.  An enhancement of the stencil callback would be needed to allow for all the possibilities of TextSpanner, 'style, for example.

Here's a sketch:


\version "2.19.27"  %%% REQUIRED

#(define (connector grob)
   (let* ((lb (ly:spanner-bound grob LEFT))
          (rb (ly:spanner-bound grob RIGHT))
          (common-x (ly:grob-common-refpoint lb rb X))
          (l-ext (ly:grob-extent lb common-x X))
          (r-ext (ly:grob-extent rb common-x X))
          (x-coord (ly:grob-relative-coordinate lb common-x X)))
     (ly:stencil-translate-axis
      (ly:line-interface::line grob (cdr l-ext) 0.0 (car r-ext) 0.0)
      (- x-coord)
      X)))
<<
  \new Lyrics \lyricmode {
    %\once \override LyricText.self-alignment-X = #RIGHT
    "rit"1*2 --
    "tar"2*5 --
    "dan"2*3 --
    "do"1
  }
  \new Staff {
    c2 c
    c2 c
    c2 c
    c2 c
    \break
    c2 c
    c2 c
    c2 c
    c2 c
  }
>>

\layout {
  \context {
    \Lyrics
    \override LyricHyphen.style = #'dashed-line
    \override LyricHyphen.dash-fraction = 0.2
    \override LyricHyphen.dash-period = 3.0
    \override LyricText.font-shape = #'italic
    \override LyricHyphen.stencil = #connector
  }
}

%%%

DN

reply via email to

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