Compare commits

...

2 Commits

Author SHA1 Message Date
tux
e9b904c32c more robust scm file include 2024-11-02 19:54:15 +01:00
tux
fd14138d0b no chord repeating by default in chordlyrics after linebreak 2024-11-02 19:51:10 +01:00
3 changed files with 43 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f)) #(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f))
#(if (defined? 'LAYOUT) #f (load "json_parser.scm")) #(if (defined? 'LAYOUT) #f (load (string-append (dirname (current-filename)) file-name-separator-string "json_parser.scm")))
#(use-modules (json parser)) #(use-modules (json parser))
\include "basic_format_and_style_settings.ly" \include "basic_format_and_style_settings.ly"
\include "eps_file_from_song_dir.ly" \include "eps_file_from_song_dir.ly"

View File

@ -138,3 +138,44 @@ generalLayout = \layout {
} }
} }
#})) #}))
% If you add this engraver to ChordNames Context chords get only printed on chordchanges and not at newline.
% See https://lists.gnu.org/archive/html/lilypond-user/2020-07/msg00187.html
Ignoring_newline_chord_changes_engraver =
#(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)))))

View File

@ -277,6 +277,7 @@
\ChordNames \ChordNames
\override VerticalAxisGroup.staff-affinity = ##f \override VerticalAxisGroup.staff-affinity = ##f
\override ChordName.extra-spacing-width = #'(-0.1 . 0.1) \override ChordName.extra-spacing-width = #'(-0.1 . 0.1)
\consists \Ignoring_newline_chord_changes_engraver
} }
\context { \context {
\Score \Score