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

View File

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

View File

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

View File

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