lilypond-user
[Top][All Lists]
Advanced

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

Re: accidentals and broken bars


From: David Kastrup
Subject: Re: accidentals and broken bars
Date: Sun, 09 Aug 2020 14:04:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Kevin Barry <barrykp@gmail.com> writes:

> On Sun, 2020-08-09 at 06:48 +0200, Werner LEMBERG wrote:
>> Thanks for the explanation.  What about the other way round, this is,
>> adding some information to the invisible bar line that defines a
>> broken bar, and which accidentals could use to print themselves in
>> such cases?
>
> You could try something like
> maybeBreak =
> #(define-music-function (music) (ly:music?)
>    #{
>      \bar ""
>      \accidentalStyle forget
>      #music
>      \accidentalStyle modern
>    #})
> but that would force accidentals to be reprinted even if the line does
> not get broken.
>
> To get around that you could write some kind of callback for accidentals
> that would remove them when not at the beginning of a line as long as
> they are not new. I tried to do this but got stuck trying to detect if
> an accidental was new at that point in the bar or not. I was trying to
> use the localAlterations property but I was only ever able to see the
> last value of it. If there's a way a grob callback can check a context
> property at the moment of the event that caused the grob I don't know
> it. (I say this just in case anyone else does know how.)

There is no such thing, but an engraver acknowledging a grob can attach
properties to it (or try keeping score of them separately) from the
context it either is working in itself or the context of the engraver
creating the grob.

I think most of the time the handwaving heuristic "let a line break mark
all information not corresponding to the current key signature as
unknown" would work with most accidental rules.

-- 
David Kastrup



reply via email to

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