Hi Janek,

On Sat, May 19, 2012 at 4:27 AM, Janek Warchoł <[email protected]>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
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to