Am Mo., 13. Juli 2020 um 19:40 Uhr schrieb Carl Sorensen <carl.d.soren...@gmail.com>: > > Hi Ernie, > > On Mon, Jul 13, 2020 at 7:03 AM Ernie Braganza <ernie.braga...@gmail.com> > wrote: >> >> Hello, >> >> How can I stop the repeated chord name after the line break? >> I thought the break-visibility settings for ChordName would work, for >> example setting the beginning-of-line-invisible value to false: >> \override Score.ChordName.break-visibility = ##(#t #t #f) >> but that does not have any effect at all. > > > The reason this does not have any effect is that the code executed when > chordChanges is set to ##t changes the break-visiblity of the specific chord > name (sets it to beginning-of-line-visible). And that code is in C++, not > Scheme, so I don't know how to override it. > > I guess one could write a Scheme engraver for ChordName to replace the > built-in one. > > You should also raise an issue on the issues list asking for an enhancement. > The enhancement would need to add some additional property (or change the > existing property from a simple boolean), because we'd need to separately > control hiding of repeated chord names only when not at the beginning of the > line, and always hiding repeated chord names. > > I actually think the best way to do it would be to change the chordChanges > property from a boolean to a break-visibility. I can see that being quite > easy to do. > > In the meantime, as a workaround, you might just wish to fill up your > chordmode with a bunch of s chords, and only put the chords in where you want > them displayed: > > \version "2.20.0" > harmonies = \chordmode { > d2 c > \break > % I don't want the repeated c chord name to display after the line break > s d > } > \new ChordNames { > \harmonies > } > > HTH, > > Carl >
Here an engraver which transforms the default stencil to an empty stencil under certain conditions (it's not a rewrite of Chord_name_engraver) \new ChordNames \with { chordChanges = ##t \consists #(lambda (ctx) (let* ((chord #f) (last-chord #f)) (define (at-line-beginning? grob) (let* ((col (ly:item-get-column grob)) (ln (ly:grob-object col 'left-neighbor)) (col-to-check (if (ly:grob? ln) ln col))) (and (eq? #t (ly:grob-property col-to-check 'non-musical)) (= 1 (ly:item-break-dir col-to-check))))) (make-engraver (acknowledgers ((chord-name-interface this-engraver grob source-engraver) (if chord (begin (set! last-chord chord) (set! chord #f))) (set! chord (ly:grob-property grob 'text)) ;; If two subsequent chords are equal and chordChanges is enabled, ;; set 'after-line-breaking to a procedure which sets the stencil ;; to an empty-stencil if the new chord is at line-start. (if (and (equal? chord last-chord) (ly:context-property ctx 'chordChanges #f)) (ly:grob-set-property! grob 'after-line-breaking (lambda (grob) (if (at-line-beginning? grob) (ly:grob-set-property! grob 'stencil empty-stencil)) ;; keep default (ly:chord-name::after-line-breaking grob)))))) ((finalize this-engraver) ;; house keeping (set! chord #f) (set! last-chord #f))))) } \chordmode { d2 c~ \break c d } HTH, Harm