lilypond-user
[Top][All Lists]
Advanced

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

Re: text spanning


From: Nick Payne
Subject: Re: text spanning
Date: Sat, 28 Nov 2009 15:08:44 +1100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hugh Myers wrote:
Worked fine on supplied example. Does not work at all well on the
piece I'm working on.
Function has to be called immediately before the note where the text spanner starts. If you want a solid rather than dashed line, comment the overrides that setup the dashed line.

\version "2.13.7"

tspan = #(define-music-function (parser location text osp dirn shorten
adjBreak adjEnd) (string? number? number? pair? number? number?) #{
 % set osp to 999 if spanner is colliding with another element
 % this will position the spanner outside all other elements
 % can be normally be set to zero
 \once \override TextSpanner #'outside-staff-priority = #$osp
 \once \override TextSpanner #'bound-details #'left #'text =
\markup\italic\small { \concat { { $text } " " } }
 \once \override TextSpanner #'font-shape = #'upright
 % direction (either #UP or #DOWN)
 \once \override TextSpanner #'direction = #$dirn
 % setup dashed line and draw a bracket edge on RHS
 \once \override TextSpanner #'dash-period = #1.5
 \once \override TextSpanner #'dash-fraction = #0.3
 \once \override TextSpanner #'thickness = #0.8
 \once \override TextSpanner #'bound-details #'right #'text = \markup
{ \draw-line #(cons 0 (/ $dirn -1)) }
 % set alignment of line with reference to left text
 \once \override TextSpanner #'bound-details #'left
#'stencil-align-dir-y = #CENTER
\once \override TextSpanner #'bound-details #'left #'padding = #(car $shorten)
 \once \override TextSpanner #'bound-details #'right #'padding =
#(cdr $shorten)
 % allow adjustment of line end when it wraps to following stave
 \once \override TextSpanner #'bound-details #'right-broken #'padding
= #$adjEnd
% adjust LH end of line when it wraps to following stave so that it doesn't
 % extend to the left of the notes on the stave
 \once \override TextSpanner #'bound-details #'left-broken #'X = #$adjBreak
 % optional override to remove text and bracket edge at line breaks
 \once \override TextSpanner #'bound-details #'left-broken #'text = ##f
 \once \override TextSpanner #'bound-details #'right-broken #'text = ##f
#})

chord = < e b gis e b e, >
upper = {
 \tempo 4=90
 \chord \chord \chord
 \repeat volta 2 {
   \tempo 4=200
   b c d
   d c b
   c a b
   \acciaccatura d8 \voiceOne c4 b a
   b a g
   a g f
 }
 \alternative {
   { r4 \times 2/3 {   \tspan "let ring" #0 #DOWN #'(0 . -0.5) #5 #1
gis8 \startTextSpan b e } e,4 \times 2/3 { gis8
b e } e,2 }
   {
     \repeat volta 2 {
       \bar ":|.|:"
       { e8 [e'] gis, [e'] b [e] }
       e,8 [e'] gis, [e'] b [e]
       a,8 [e'] c [e] b [e]
       a,8 [e'] g, [e'] f, [e']
     }
   }
 }
 e,8 [e'] gis, [e'] b [e]
 d8 [e] c [e] b [e]
 c8 [e] a, [e'] b [e]
 c8 [e] b [e] a, [e']
 b8 [e] a, [e'] g, [e']
 a,8 [e'] g, [e'] f, [e']
 e,4 gis b
 \stopTextSpan
 < e b gis e b e, >2.
}

lower = {
 s2.
 <gis, d e, >2.
 e,2.
 a2.
 a2.
 g2.
 f2.
 { e2.~e2. }
 s2.
 s2.
 s2.
 s2.
 s2.
 s2.
 s2.
 s2.
 s2.
 s2.
}

{
 \time 3/4
 \set Score.barNumberVisibility = #all-bar-numbers-visible
 \bar ""
 \set Score.voltaSpannerDuration = #(ly:make-moment 3 4)
 <<
 \new Staff \relative c'' {
   <<
     \new Voice = "1" { \voiceOne \upper }
     \new Voice = "2" { \voiceTwo \lower }
   >>
 }
 \new TabStaff \relative c' {
   <<
     \new TabVoice = "t1" { \voiceOne \upper }
     \new TabVoice = "t2" { \voiceTwo \lower }
   >>
 }
 >>
}




reply via email to

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