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: Sat, 19 May 2012 06:40:47 -0500

Hi Janek,

On Sat, May 19, 2012 at 4:27 AM, Janek Warchoł <address@hidden> wrote:
David,

a couple of thoughts:
- what about looping the break pattern?  I.e. \consists
#(custom-line-breaks-engraver '(2 3 4)) = \consists
#(custom-line-breaks-engraver '(2 3 4 2 3 4 2 3 4 ... 2 3 4))?

Great idea--this means that you can fix the number of bars per line by using a single number as your argument.  I'll see what I can do!

- i'm not sure if this is desired or not, but changing current
barNumber confuses your function:

Yup, I suspected that it would!  Substituting 'internalBarNumber for 'currentBarNumber seems to do the trick:

 \version "2.15.38"

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


-David

reply via email to

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