Songinfogenerierung verbessert

This commit is contained in:
tux 2023-10-31 13:31:50 +01:00
parent 260664462d
commit d6774670f3
6 changed files with 60 additions and 28 deletions

View File

@ -1,6 +1,7 @@
\language "deutsch" \language "deutsch"
\include "default_author_style.ly" \include "default_author_style.ly"
\include "default_songinfo_style.ly"
\include "styles.ly" \include "styles.ly"
\include #(ly:format "styles/~a.ly" songStyle) \include #(ly:format "styles/~a.ly" songStyle)

33
default_songinfo_style.ly Normal file
View File

@ -0,0 +1,33 @@
\paper {
songinfoMarkup =
#(make-on-the-fly-markup
(lambda (layout props m)
(let ((blockwidth (* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width)))
(between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
(poet-maybe-with-composer (chain-assoc-get 'songinfo:poet-maybe-with-composer props #f))
(composer (chain-assoc-get 'songinfo:composer props #f))
(copyright (chain-assoc-get 'songinfo:copyright props #f))
(infotext (chain-assoc-get 'songinfo:infotext props #f))
(translation (chain-assoc-get 'songinfo:translation props #f))
(spelling (chain-assoc-get 'songinfo:spelling props #f))
(year_text (chain-assoc-get 'songinfo:year_text props #f))
(year_melody (chain-assoc-get 'songinfo:year_melody props #f)))
(interpret-markup layout props
(markup
#:override '(baseline-skip . 3.0)
#:override `(line-width . ,blockwidth)
#:fontsize songInfoFontSize
#:sans
(make-justify-markup (list
(if poet-maybe-with-composer (markup
(if year_text (make-concat-markup (list poet-maybe-with-composer ", " year_text)) poet-maybe-with-composer) between-poet-and-composer-markup) "")
(if composer (if year_melody (make-concat-markup (list composer ", " year_melody)) composer) "")
(make-justify-string-markup (string-append
(if copyright (string-append "© " copyright) "")
(if infotext (string-append "\n\n" infotext) "")
(if translation (string-append "\n\nÜbersetzung: " translation) "")
(if spelling (string-append "\n\nAussprache: " spelling) "")
))))))))
(make-null-markup)
)
}

View File

@ -33,32 +33,33 @@
(composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f))) (composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f)))
(poet-and-composer-same (equal? poetId composerId))) (poet-and-composer-same (equal? poetId composerId)))
(let ( (let (
(blockwidth (* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width))) (infotext (chain-assoc-get 'header:infotext props (chain-assoc-get 'header:songinfo props #f)))
(infotext (chain-assoc-get 'header:songinfo props #f)) (poet-maybe-with-composer (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f)))
(poet (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f)))
(composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) #f))) (composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) #f)))
(poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked)) (copyright (chain-assoc-get 'header:copyright props #f))
(between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3))) (translation (chain-assoc-get 'header:translation props #f))
(copyright (chain-assoc-get 'header:copyright props #f))) (spelling (chain-assoc-get 'header:spelling props #f))
(markup #:override '(baseline-skip . 3.0) ( (year_text (chain-assoc-get 'header:year_text props #f))
make-fontsize-markup songInfoFontSize (year_melody (chain-assoc-get 'header:year_melody props #f)))
(make-sans-markup (markup
;%\override #'(line-width . 92) \wordwrap-field #symbol #:override (cons 'songinfo:poet-maybe-with-composer
(make-column-markup (list (if (and poet-maybe-with-composer (not (and (string? poet-maybe-with-composer) (string-null? poet-maybe-with-composer)))) poet-maybe-with-composer #f))
(make-line-markup #:override (cons 'songinfo:composer
(list (if (and composer (not (and (string? composer) (string-null? composer)))) composer #f))
(if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "") #:override (cons 'songinfo:copyright
(if (and composer (not poet-and-composer-stacked)) composer "")) (if (and copyright (not (and (string? copyright) (string-null? copyright)))) copyright #f))
) #:override (cons 'songinfo:infotext
(if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "") (if (and infotext (not (and (string? infotext) (string-null? infotext)))) infotext #f))
(make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append #:override (cons 'songinfo:translation
(if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "") (if (and translation (not (and (string? translation) (string-null? translation)))) translation #f))
(if infotext infotext "") #:override (cons 'songinfo:spelling
))) (if (and spelling (not (and (string? spelling) (string-null? spelling)))) spelling #f))
))) #:override (cons 'songinfo:year_text
) (if (and year_text (not (and (string? year_text) (string-null? year_text)))) year_text #f))
) #:override (cons 'songinfo:year_melody
)) (if (and year_melody (not (and (string? year_melody) (string-null? year_melody)))) year_melody #f))
(ly:output-def-lookup layout 'songinfoMarkup)
)))
(make-null-markup))) (make-null-markup)))
) )

View File

@ -9,7 +9,6 @@ songTextChordAlignment = #'left
songScoreChordFontSize = 3 songScoreChordFontSize = 3
songTextChordFontSize = 2 songTextChordFontSize = 2
songTextLineHeigth = 5.5 songTextLineHeigth = 5.5
songInfoPoetAndComposerStacked = ##f
songTocColumns = 3 songTocColumns = 3
globalSize = 15 globalSize = 15
lyricSize = 1.6 lyricSize = 1.6

View File

@ -9,7 +9,6 @@ songTextChordAlignment = #'center
songScoreChordFontSize = 0 songScoreChordFontSize = 0
songTextChordFontSize = \songScoreChordFontSize songTextChordFontSize = \songScoreChordFontSize
songTextLineHeigth = 5 songTextLineHeigth = 5
songInfoPoetAndComposerStacked = ##f
songTocColumns = 3 songTocColumns = 3
globalSize = 15 globalSize = 15
lyricSize = 1.6 lyricSize = 1.6

View File

@ -9,7 +9,6 @@ songTextChordAlignment = #'left
songScoreChordFontSize = 2 songScoreChordFontSize = 2
songTextChordFontSize = 2 songTextChordFontSize = 2
songTextLineHeigth = 5.3 songTextLineHeigth = 5.3
songInfoPoetAndComposerStacked = ##t
songTocColumns = 2 songTocColumns = 2
globalSize = 14 globalSize = 14
lyricSize = 1.6 lyricSize = 1.6