bug-lilypond
[Top][All Lists]
Advanced

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

Re: Feature request: some way of manually breaking slurs, ties and lyric


From: Ben Rudiak-Gould
Subject: Re: Feature request: some way of manually breaking slurs, ties and lyric extenders
Date: Sun, 16 Dec 2012 10:11:24 -0800

I have hacked something up (see code below), but it doesn't work very well:

* It works for slurs on either end as long as they span at least two
notes. I can get it to work with single-note slurs at the end of the
line by writing c'( s1*0) or c'( <>), but I get the warning
"programming error: bounds of this piece aren't breakable." I haven't
found a way to make it work with single-note slurs at the beginning of
the line.

* It works for lyric hyphens and extenders if there's an extra note
with no lyric to extend to. I have to use "" as the lyric for this
note, not _. This has the side effect that the lyric syllable isn't
aligned properly at the end of the line (it's centered under the note
instead of left-aligned).

* I can't get it to work for ties in either direction no matter what I try.

* It doesn't do anything to explicit beams (not that I suppose anyone
would want to break beams this way), and it doesn't work properly with
ligature brackets or tuplet brackets -- the bracket extends to the bar
line but appears to begin/end there instead of being broken.

MS, I hope you can tell me if there's a way to work around these
problems in Scheme alone.

-- Ben

--------8<--------

\version "2.17.9"

% This is necessary to avoid a warning
#(set-object-property! 'fake-break-left 'backend-type? boolean?)
#(set-object-property! 'fake-break-right 'backend-type? boolean?)

#(define (fake-break-engraver score-context)

   (let ((last-barline #f) (open-spanners '()))

     (define (handle-barline barline)
       (set! last-barline barline)
       (set! open-spanners (filter try-extend-right open-spanners)) )

     (define (try-extend-right spanner)
       (let ((still-open (null? (ly:spanner-bound spanner RIGHT))))
         (if (not still-open)
             (ly:spanner-set-bound! spanner RIGHT last-barline) )
         still-open ))

     (define (handle-spanner-start spanner)
       (if (eq? #t (ly:grob-property spanner 'fake-break-left))
           (if last-barline
               (ly:spanner-set-bound! spanner LEFT last-barline) ))
       (if (eq? #t (ly:grob-property spanner 'fake-break-right))
           (set! open-spanners (cons spanner open-spanners)) ))

     `((acknowledgers

        (paper-column-interface .
         ,(lambda (engraver grob source-engraver)
            (if (and (eq? 'NonMusicalPaperColumn
                          (assoc-ref (ly:grob-property grob 'meta) 'name) )
                     (not (null? (ly:grob-property grob 'measure-length))) )
                (handle-barline grob) )))

        (spanner-interface .
         ,(lambda (engraver grob source-engraver)
            (handle-spanner-start grob) ))))))


\layout { \context { \Score \consists #fake-break-engraver } }

\paper { ragged-right = ##t }

\score {
  <<
    \new Staff {
      c' d' \once \override PhrasingSlur #'fake-break-right = ##t e'\( f'\)
    }
    \addlyrics {
      First to \once \override LyricHyphen #'fake-break-right = ##t sec -- ""
    }
    \new Staff {
      \once \override Slur #'fake-break-left = ##t g'( a') b'2
    }
    \addlyrics {
      \once \override LyricHyphen #'fake-break-left = ##t _ -- ond.
    }
    \new Staff {
      c'16 c' c' c' c'4 c' c'16 c' c' c'
    }
  >>
}

--------8<--------



reply via email to

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