From bdf7fe85c86308765858ac9bbb96f916b6ae02bb Mon Sep 17 00:00:00 2001 From: tux Date: Sun, 24 Mar 2024 03:42:24 +0100 Subject: [PATCH] add chordlyrics and nochordlyrics --- chord_settings.ly | 41 +++++++++++++++++++++++++++++++++++ verses_with_chords.ly | 50 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/chord_settings.ly b/chord_settings.ly index f6fedcc..9c98d6c 100644 --- a/chord_settings.ly +++ b/chord_settings.ly @@ -100,6 +100,47 @@ generalLayout = \layout { } } +lyricsWithChordsLayout = \layout { + \generalLayout + \context { + \ChordNames + \override ChordName.font-size = \songTextChordFontSize + } + \context { + \Lyrics + \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.basic-distance = 0 + \override LyricText.parent-alignment-X = #LEFT + \override LyricText.self-alignment-X = #LEFT + \override LyricText.word-space = 0.8 + \override LyricSpace.minimum-distance = 0.8 + } + \context { + \Score + \override SpacingSpanner.uniform-stretching = ##t + \override SpacingSpanner.spacing-increment = 0 + \remove Bar_number_engraver + \remove Mark_engraver + \remove Volta_engraver + } + \context { + \Staff + \remove Staff_symbol_engraver + \remove Clef_engraver + \remove Time_signature_engraver + \omit KeySignature + } + \context { + \Voice + \remove Stem_engraver + \remove Rest_engraver + \remove Phrasing_slur_engraver + \remove Slur_engraver + \remove Tie_engraver + \remove Dynamic_engraver + \remove Note_heads_engraver + } +} + % Akkord mit Bunddiagramm anzeigen #(define-markup-command (fret-chord layout props fret chord) (string? string?) (interpret-markup layout props diff --git a/verses_with_chords.ly b/verses_with_chords.ly index 6937469..7f1f82c 100644 --- a/verses_with_chords.ly +++ b/verses_with_chords.ly @@ -190,4 +190,52 @@ (map (lambda (column-markups) (make-column-markup (add-markup-between-elements #t (make-vspace-markup verse-vspace) column-markups))) - column-data))))))))) \ No newline at end of file + column-data))))))))) + +#(define-markup-command (pad-left layout props amount arg) + (number? markup?) + (let* ((m (interpret-markup layout props arg)) + (x (ly:stencil-extent m X)) + (y (ly:stencil-extent m Y))) + (ly:stencil-translate + (ly:make-stencil (ly:stencil-expr m) + (cons (- (car x) amount) (cdr x)) + y) + `(,amount . 0)))) + +#(define-markup-command (chordlyrics layout props lyrics) (ly:music?) + #:properties ((verse-chords #f) + (verse-reference-voice #f) + (verse-break-voice #f)) + "Vers mit Akkorden" + (interpret-markup layout props + #{ + \markup { + \override #'(baseline-skip . 0.3) + \pad-left #-10 + \score { + \transposable + << + \new Devnull { #(if (ly:music? verse-break-voice) verse-break-voice) } + #(if (ly:music? verse-chords) verse-chords songChords) + \new NullVoice { #(if (ly:music? verse-reference-voice) verse-reference-voice firstVoice) } + \addlyrics { #lyrics } + >> + \layout { + \lyricsWithChordsLayout + \context { + \Staff + \override LeftEdge.space-alist.first-note = #'(fixed-space . 10.0) + } + } + } + } + #} + ) +) + +#(define-markup-command (nochordlyrics layout props lyrics) (ly:music?) + "Vers ohne Akkorde" + (interpret-markup layout props + (markup #:override `(verse-chords . ,#{#}) #:chordlyrics lyrics)) +)