Hi,

On Mon, Jan 5, 2015 at 10:50 AM, tisimst <tisimst.lilyp...@gmail.com> wrote:

> Francois,
>
>
> Francois Planiol wrote
> > How do you:
> > - set stanza # repeating at each new system?
>
> I'm not aware of any automagic way of doing it (but that doesn't mean it
> can't be done, of course :), so in the mean time, simply add the "\set
> stanza = #" wherever you want it to appear! It's that easy! You might want
> to add it once you know where the line breaks are, though, or you could get
> stanza numbers in the middle of a system :) May be a hassle, but it works
> without that much effort.
>

Unfortunately, the attached won't work properly when repeating the stanza
number like this.  I'll fiddle around with it, but first things first :)

>
>
> Francois Planiol wrote
> > - draw a line-separator between lyrics
>

There is an old thread which describes how to adapt input/regression/
scheme-text-spanner.ly to create intelligent underlining of lyrics:
http://www.mail-archive.com/lilypond-user%40gnu.org/msg60732.html

I've adapted this to create the divider.

Notice in the comments to "add-grob-definition" near the top of the file
that there is a change you need to make for versions 2.19.13 or before.
 (Depending on how old the version you're using, there may be other changes
needed.)

Hope this is helpful!

--David
\version "2.19.15"

\header {
  tagline = ##f
}

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
          (class        (assoc-get 'class meta-entry))
          (ifaces-entry (assoc-get 'interfaces meta-entry)))
     ; if version is 2.19.13 or before, replace ly:grob-properties?
     ; in the following line with list?
     (set-object-property! grob-name 'translation-type? ly:grob-properties?)
     (set-object-property! grob-name 'is-grob? #t)
     (set! ifaces-entry (append (case class
                                  ((Item) '(item-interface))
                                  ((Spanner) '(spanner-interface))
                                  ((Paper_column) '((item-interface
                                                     paper-column-interface)))
                                  ((System) '((system-interface
                                               spanner-interface)))
                                  (else '(unknown-interface)))
                          ifaces-entry))
     (set! ifaces-entry (uniq-list (sort ifaces-entry symbol<?)))
     (set! ifaces-entry (cons 'grob-interface ifaces-entry))
     (set! meta-entry (assoc-set! meta-entry 'name grob-name))
     (set! meta-entry (assoc-set! meta-entry 'interfaces
                        ifaces-entry))
     (set! grob-entry (assoc-set! grob-entry 'meta meta-entry))
     (set! all-grob-descriptions
           (cons (cons grob-name grob-entry)
             all-grob-descriptions))))

#(add-grob-definition
  'LyricSeparator
  `(
     (bound-details . ((left . ((Y . 0)
                                (padding . 0.25)
                                (attach-dir . ,LEFT)
                                ))
                       (left-broken . ((end-on-note . #t)))
                       (right . ((Y . 0)
                                 (padding . 0.25)
                                 ))
                       ))
     (dash-fraction . 0.2)
     (dash-period . 3.0)
     (direction . ,UP)
     (font-shape . italic)
     (left-bound-info . ,ly:line-spanner::calc-left-bound-info)
     (outside-staff-priority . 350)
     (right-bound-info . ,ly:line-spanner::calc-right-bound-info)
     (staff-padding . 0.8)
     (stencil . ,ly:line-spanner::print)
     (style . dashed-line)

     (meta . ((class . Spanner)
              (interfaces . (font-interface
                             line-interface
                             line-spanner-interface
                             outside-staff-interface
                             side-position-interface))))))


#(define (add-bound-item spanner item)
   (if (null? (ly:spanner-bound spanner LEFT))
       (ly:spanner-set-bound! spanner LEFT item)
       (ly:spanner-set-bound! spanner RIGHT item)))

#(define (axis-offset-symbol axis)
   (if (eq? axis X) 'X-offset 'Y-offset))

#(define (set-axis! grob axis)
   (if (not (number? (ly:grob-property grob 'side-axis)))
       (begin
        (set! (ly:grob-property grob 'side-axis) axis)
        (ly:grob-chain-callback
         grob
         (if (eq? axis X)
             ly:side-position-interface::x-aligned-side
             side-position-interface::y-aligned-side)
         (axis-offset-symbol axis)))))

LyricSeparatorEngraver =
#(lambda (context)
   (let ((span '()))
     (make-engraver
      (acknowledgers
       ((stanza-number-interface engraver grob source-engraver)
        (if (ly:spanner? span)
            (begin
             (ly:pointer-group-interface::add-grob span 'lyric-bits grob)
             (ly:spanner-set-bound! span LEFT grob))))
       ((lyric-syllable-interface engraver grob source-engraver)
        (if (ly:spanner? span)
            (begin
             (ly:pointer-group-interface::add-grob span 'lyric-bits grob)
             (add-bound-item span grob)))))
      ((process-music trans)
       (if (not (ly:spanner? span))
           (let ((ccc (ly:context-property context 'currentCommandColumn)))
             (set! span (ly:engraver-make-grob trans 'LyricSeparator ccc))
             (set-axis! span Y))))
      ((finalize trans)
       (set! span '())))))


\score {
  \new Staff <<
    \new Voice = "melody" {
      \time 3/4
      g'2 g'4
      \break
      e'2 a'4
      g'2. e'
    }
    \new Lyrics \lyricsto "melody"{
      \set stanza = #"1. "
      Na na na na na na  
    }
    \new Lyrics \lyricsto "melody"{
      \set stanza = #"2. "
      Na na na na na na  
    }
    \new Lyrics \with {
      \consists \LyricSeparatorEngraver
      \override LyricSeparator #'direction = #DOWN
      \override LyricSeparator #'style = #'line    
      \override LyricSeparator #'outside-staff-priority = ##f
      % the following line controls space above and below
      \override LyricSeparator #'Y-extent = #'(-1 . 1)
      \override LyricSeparator #'bound-details =
      #`((left . ((Y . 0)
                  (padding . 0)
                  (attach-dir . ,LEFT)))
         (left-broken . ((end-on-note . #t)))
         (right . ((Y . 0)
                   (padding . 0)
                   (attach-dir . ,RIGHT))))
    }
    \lyricsto "melody" {
      \set stanza = #"3. "
      Na na na na na naaaaaaaaaaah
    } 
    \new Lyrics \lyricsto "melody"{
      \set stanza = #"4. "
      Na na na na na na  
    }
    \new Lyrics \lyricsto "melody"{
      \set stanza = #"5. "
      Na na na na na na  
    }
  >>
  \layout {
    \context {
      \Global
      \grobdescriptions #all-grob-descriptions
    }
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to