lilypond-user
[Top][All Lists]
Advanced

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

Repeats with bar-engraver removed


From: Jean Abou Samra
Subject: Repeats with bar-engraver removed
Date: Mon, 4 Jan 2021 20:19:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

I need to be able to engrave repeats, but I fear that the bar-engraver, which I turned off for chant music, is responsible for engraving the repeats: when I turn it back on, then the repeats appear, but since the music is chant, it runs off the page.

How to do this?

The work is attached.

Thank you.

Hello,

Your diagnosis is right. The Bar_engraver is responsible for engraving
all kinds of bars and preventing breaks when there aren't any.

Here is one solution (though not the only one and most probably not the
most concise one): rewrite it to engrave just repeat bar lines while
ignoring requests for regular bar lines and not preventing lines breaks
anywhere.


\version "2.21.80"

%  Original file is at
% https://gitlab.com/lilypond/lilypond/-/blob/master/lily/bar-engraver.cc

#(define (Tweaked_bar_engraver context)
   (let ((bar #f)
         (spanners '())
         (considered-bar #f))
     (make-engraver
       ((process-acknowledged translator)
          (if (not considered-bar)
              (begin
                (set! considered-bar #t)
                (let ((gl (ly:context-property context 'whichBar))
                      (default-bar-type (ly:context-property context 'defaultBarType)))
                  (if (and (string? gl)
                           (not (equal? gl default-bar-type)))
                      (begin
                        (set! bar (ly:engraver-make-grob translator 'BarLine '()))
                        (ly:grob-set-property! bar 'glyph gl))))))
          (if bar
              (for-each
                (lambda (sp) (ly:spanner-set-bound! sp RIGHT bar))
                spanners))
          (set! spanners '()))
       (end-acknowledgers
         ((spanner-interface engraver grob source-engraver)
            (if (and
                  (or bar (not considered-bar))
                  (ly:grob-property grob 'to-barline))
                (set! spanners (cons grob spanners)))))
       ((stop-translation-timestep translator)
          (set! bar #f)
          (set! considered-bar #f)))))

\layout {
  \context {
    \Staff
    \remove "Bar_engraver"
    \consists #Tweaked_bar_engraver
    \remove "Time_signature_engraver"
  }
}

See complete example attached.

Best,
Jean


Attachment: velikoye-slavosloviye-fixed.ly
Description: Text Data

Attachment: velikoye-slavosloviye-fixed.pdf
Description: Adobe PDF document


reply via email to

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