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))?
- i'm not sure if this is desired or not, but changing current
barNumber confuses your function:
\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' {
\set Score.currentBarNumber = #4
c4 c c c c c c c c c c c c2 c
c4 c c c c c c c c c c c c2 c
c4 c c c c c c c c c c c c2 c
}
\layout {
\context {
\Score
\consists #(custom-line-breaks-engraver '(4 4 4)) % the break
occurs after measure with number 4, not after 4 measures
}
}
cheers,
Janek
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user