lilypond-user
[Top][All Lists]
Advanced

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

Re: Repeats with bar-engraver removed


From: Pierre Perol-Schneider
Subject: Re: Repeats with bar-engraver removed
Date: Mon, 4 Jan 2021 20:32:07 +0100

Maybe it's a silly question but why not simply something like:

\version "2.18"
{ c'1 \bar ".|:" c' c' c' \bar ":|." c' c'  }

Cheers,
Pierre

Le lun. 4 janv. 2021 à 20:23, Jean Abou Samra <jean@abou-samra.fr> a écrit :
> 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



reply via email to

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