fix spacing in new chordlyrics system

This commit is contained in:
Christoph Wagner 2024-03-30 18:12:51 +01:00
parent 7f7cac99f4
commit 8c7386807b
2 changed files with 41 additions and 7 deletions

View File

@ -100,6 +100,15 @@ generalLayout = \layout {
} }
} }
#(define-public (custom-lyric-text::print grob)
"Allow interpretation of tildes as lyric tieing marks."
;; See also similar code in Lyric_performer.
(let ((text (ly:grob-property grob 'text)))
(grob-interpret-markup grob (if (string? text)
(make-pad-right-markup -0.1 (make-tied-lyric-markup text))
text))))
lyricsWithChordsLayout = \layout { lyricsWithChordsLayout = \layout {
\generalLayout \generalLayout
\context { \context {
@ -108,14 +117,16 @@ lyricsWithChordsLayout = \layout {
} }
\context { \context {
\Lyrics \Lyrics
\override VerticalAxisGroup.nonstaff-relatedstaff-spacing.basic-distance = 0 \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.basic-distance = #(- (- songTextLineHeigth songTextChordFontSize) 1)
\override LyricText.parent-alignment-X = #LEFT \override LyricText.parent-alignment-X = #LEFT
\override LyricText.self-alignment-X = #LEFT \override LyricText.self-alignment-X = #LEFT
\override LyricText.word-space = 0.8 \override LyricText.word-space = 0.8
\override LyricSpace.minimum-distance = 0.8 \override LyricSpace.minimum-distance = 0.8
\override LyricText.stencil = #custom-lyric-text::print
} }
\context { \context {
\Score \Score
\override PaperColumn.keep-inside-line = ##f
\override SpacingSpanner.uniform-stretching = ##t \override SpacingSpanner.uniform-stretching = ##t
\override SpacingSpanner.spacing-increment = 0 \override SpacingSpanner.spacing-increment = 0
\remove Bar_number_engraver \remove Bar_number_engraver

View File

@ -203,22 +203,42 @@
y) y)
`(,amount . 0)))) `(,amount . 0))))
#(define-markup-command (pad-right 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:make-stencil (ly:stencil-expr m)
(cons (car x) (+ (cdr x) amount))
y)))
#(define-markup-command (score-equal-height layout props reference-height lines)
(number? markup-list?)
#:category music
#:properties ((baseline-skip))
(stack-stencils Y DOWN baseline-skip
(map
(lambda (line) (ly:make-stencil (ly:stencil-expr line) (ly:stencil-extent line X) `(0 . ,reference-height)))
(interpret-markup-list layout props lines))))
#(define-markup-command (chordlyrics layout props lyrics) (ly:music?) #(define-markup-command (chordlyrics layout props lyrics) (ly:music?)
#:properties ((verse-chords #f) #:properties ((verse-chords #f)
(verse-reference-voice #f) (verse-reference-voice #f)
(verse-break-voice #f)) (verse-break-voice #f)
(verse-line-height songTextLineHeigth)
(intraverse-vspace 0))
"Vers mit Akkorden" "Vers mit Akkorden"
(interpret-markup layout props (interpret-markup layout props
#{ #{
\markup { \markup {
\override #'(baseline-skip . 0.3) \override #`(baseline-skip . ,intraverse-vspace)
\pad-left #-10 \pad-left #-10
\score { \score-equal-height #verse-line-height \score-lines {
\transposable \transposable
<< <<
\new Devnull { #(if (ly:music? verse-break-voice) verse-break-voice) } \new Devnull { #(if (ly:music? verse-break-voice) verse-break-voice) }
#(if (ly:music? verse-chords) verse-chords songChords) #(if (ly:music? verse-chords) verse-chords #{ \chords { \verseChords } #})
\new NullVoice { #(if (ly:music? verse-reference-voice) verse-reference-voice firstVoice) } \new NullVoice { #(if (ly:music? verse-reference-voice) verse-reference-voice #{ \global \firstVoice #}) }
\addlyrics { #lyrics } \addlyrics { #lyrics }
>> >>
\layout { \layout {
@ -237,5 +257,8 @@
#(define-markup-command (nochordlyrics layout props lyrics) (ly:music?) #(define-markup-command (nochordlyrics layout props lyrics) (ly:music?)
"Vers ohne Akkorde" "Vers ohne Akkorde"
(interpret-markup layout props (interpret-markup layout props
(markup #:override `(verse-chords . ,#{#}) #:chordlyrics lyrics)) (markup
#:override `(verse-chords . ,#{#})
#:override `(verse-line-height . ,(- songTextLineHeigth 2))
#:chordlyrics lyrics))
) )