[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: text spanning
From:       Nick Payne <nick.payne () internode ! on ! net>
Date:       2009-11-28 4:08:44
Message-ID: 4B10A24C.1060900 () internode ! on ! net
[Download RAW message or body]

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 }
    >>
  }
  >>
}



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic