lilypond-user
[Top][All Lists]
Advanced

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

Re: Four Bars per Line/System, again :)


From: David Nalesnik
Subject: Re: Four Bars per Line/System, again :)
Date: Fri, 18 May 2012 21:19:27 -0500

Hi,

On Fri, May 18, 2012 at 7:38 PM, Jay Anderson <address@hidden> wrote:
Slightly better would be to get rid of the bars-per-line define so
it's self-contained:

True, thank you--I've incorporated your suggestion below.

Thinking about this some more, I figure the next logical step is to write an engraver which allows you to specify the number of measures for each line of the score.  I've come up with the solution below.

If you use the (commented-out) override and you have measures left over, these will be crammed into the last line.  Without the 'line-break-permission override, Lily will space the remaining measures as usual.

Hope this proves useful! 

Best,
David

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\version "2.15.38"

#(define (custom-line-breaks-engraver bar-list)
  (let ((total (1+ (car bar-list)))) ;; not sure why increment necessary
    (lambda (context)
      (make-engraver
        (acknowledgers ((paper-column-interface engraver grob source-engraver)
          (let ((current-bar (ly:context-property context 'currentBarNumber)))
            (if (and (pair? bar-list)
                     (= (remainder current-bar total) 0)
                     (eq? #t (ly:grob-property grob 'non-musical)))
                (begin
                  (set! (ly:grob-property grob 'line-break-permission) 'force)
                  (if (not (null? (cdr bar-list)))
                      (begin
                        (set! bar-list (cdr bar-list))
                        (set! total (+ total (car bar-list))))
                      (set! bar-list '())))))))))))

\relative c' {
  \repeat unfold 10 {
    \time 2/4
    c4 c
    \time 4/4
    c c c c
    \time 3/4
    c c c
    \time 1/4
    c
    \time 13/4
    c c c c c c c c c c c c c
    \time 9/4
    c c c c c c c c c
    \time 2/4
    c c
    \time 7/8
    c8 c c c c c c
    \time 2/2
    c2 c
  }
}

\layout {
  \context {
    \Score
    %% The following line necessary if you want to put more
    %% measures to a line than Lily wants to allow.
    %% Remaining measures will be crammed into last line.
    %\override NonMusicalPaperColumn #'line-break-permission = ##f
    \consists #(custom-line-breaks-engraver '(1 2 3 4 5 1 2 3 4 5))
  }



reply via email to

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