songinfogenerierung optimiert

This commit is contained in:
tux 2023-10-31 18:47:47 +01:00 committed by Christoph Wagner
parent d6774670f3
commit bf596edb2c
2 changed files with 15 additions and 16 deletions

View File

@ -2,8 +2,7 @@
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)))
(let ((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))
@ -12,22 +11,18 @@
(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
(stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props)
(interpret-markup-list layout props
(append
(make-wordwrap-internal-markup-list #t (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-wordwrap-string-internal-markup-list #t (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) "")
))))))))
(if spelling (string-append "\n\nAussprache: " spelling) ""))))))))
(make-null-markup)
)
}

View File

@ -32,7 +32,7 @@
(poetId (chain-assoc-get 'header:poetId props (if songId (songinfo-from songId "poet") #f)))
(composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f)))
(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)))
(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)))
@ -58,6 +58,10 @@
(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))
#:override '(baseline-skip . 3.0)
#:override `(line-width . ,blockwidth)
#:fontsize songInfoFontSize
#:sans
(ly:output-def-lookup layout 'songinfoMarkup)
)))
(make-null-markup)))