2 Commits

Author SHA1 Message Date
tux
99530b8fce new engraver for spacing in chordlyrics 2025-12-15 00:50:29 +01:00
c196d10b40 make verselayout really work 2025-12-15 00:50:07 +01:00
10 changed files with 195 additions and 248 deletions

View File

@@ -56,5 +56,3 @@ TEXT_PAGES = #f
verseChords = {} verseChords = {}
firstVoice = {} firstVoice = {}
global = {} global = {}
\resetTagGroups

View File

@@ -29,11 +29,6 @@
(if (null? stanzanumbers) (if (null? stanzanumbers)
refString refString
(ly:format refStringWithNumbers (string-join (map (lambda (stanzanumber) (ly:format "~a" stanzanumber)) stanzanumbers) ", "))))) (ly:format refStringWithNumbers (string-join (map (lambda (stanzanumber) (ly:format "~a" stanzanumber)) stanzanumbers) ", ")))))
bridgeMarkupFormatter = #(lambda (layout props stanzanumbers)
(interpret-markup layout props
(if (null? stanzanumbers)
bridgeString
(ly:format bridgeStringWithNumbers (string-join (map (lambda (stanzanumber) (ly:format "~a" stanzanumber)) stanzanumbers) ", ")))))
} }
generalLayout = \layout { generalLayout = \layout {
@@ -84,11 +79,6 @@ generalLayout = \layout {
} }
} }
#(define (customized-layout base-layout)
(let
((custom-size (ly:output-def-lookup base-layout 'size #f)))
(if custom-size (layout-set-staff-size custom-size))))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% kleine Helferlein: %%% kleine Helferlein:
@@ -144,24 +134,18 @@ override-stanza =
#} #}
) )
#(define (handle-stanza-numbers context numbers number-formater)
(let* ((stanzanumbers (ly:assoc-get 'custom-stanzanumber-override (ly:assoc-get 'details (ly:context-grob-definition context 'StanzaNumber) '()) numbers))
(stanza-style (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
(roman-format (lambda (stanzanumber) (format #f "~@r" stanzanumber))))
(ly:context-set-property! context 'stanza
(make-pad-left-markup 1
(number-formater
(if (eq? stanza-style 'roman)
(map roman-format stanzanumbers)
stanzanumbers))))))
#(define (stanza . stanzanumbers) #(define (stanza . stanzanumbers)
#{ #{
\once \override StanzaNumber.details.custom-realstanza = ##t % set this to signal that there is a real stanza and no repeat signs \once \override StanzaNumber.details.custom-realstanza = ##t % set this to signal that there is a real stanza and no repeat signs
\applyContext \applyContext
#(lambda (context) #(lambda (context)
(handle-stanza-numbers context stanzanumbers (let* ((stanzanumbers-override (ly:assoc-get 'custom-stanzanumber-override (ly:assoc-get 'details (ly:context-grob-definition context 'StanzaNumber) '()) #f))
(lambda (numbers) (string-join (map (lambda (n) (format #f stanzaFormat n)) numbers) ", ")))) (stanza-style (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
(stanza-format (lambda (stanzanumber) (format #f (if (eq? stanza-style 'roman) romanStanzaFormat stanzaFormat) stanzanumber))))
(ly:context-set-property! context 'stanza
(string-join (map stanza-format
(if stanzanumbers-override stanzanumbers-override stanzanumbers))
", "))))
#} #}
) )
@@ -169,31 +153,7 @@ ref =
#(define-music-function (stanzanumbers lyrics) ((number-list? (list)) ly:music?) #(define-music-function (stanzanumbers lyrics) ((number-list? (list)) ly:music?)
#{ \lyricmode { #{ \lyricmode {
\once \override StanzaNumber.details.custom-realstanza = ##t % set this to signal that there is a real stanza and no repeat signs \once \override StanzaNumber.details.custom-realstanza = ##t % set this to signal that there is a real stanza and no repeat signs
\applyContext \set stanza = #(make-on-the-fly-markup (lambda (layout props m) ((ly:output-def-lookup layout 'refMarkupFormatter) layout props stanzanumbers)) (make-null-markup))
#(lambda (context)
(handle-stanza-numbers context stanzanumbers
(lambda (numbers)
(make-on-the-fly-markup
(lambda (layout props m)
((ly:output-def-lookup layout 'refMarkupFormatter) layout props numbers))
(make-null-markup)))))
#lyrics
}
#}
)
bridge =
#(define-music-function (stanzanumbers lyrics) ((number-list? (list)) ly:music?)
#{ \lyricmode {
\once \override StanzaNumber.details.custom-realstanza = ##t % set this to signal that there is a real stanza and no repeat signs
\applyContext
#(lambda (context)
(handle-stanza-numbers context stanzanumbers
(lambda (numbers)
(make-on-the-fly-markup
(lambda (layout props m)
((ly:output-def-lookup layout 'bridgeMarkupFormatter) layout props numbers))
(make-null-markup)))))
#lyrics #lyrics
} }
#} #}
@@ -222,7 +182,7 @@ repStopWithTag = \lyricmode {
\tag #'repeats { \tag #'repeats {
\once \override StanzaNumber.font-series = #'normal \once \override StanzaNumber.font-series = #'normal
\once \override StanzaNumber.direction = 1 \once \override StanzaNumber.direction = 1
\set stanza = \markup { \pad-x-right #1 \repStop } \set stanza = \markup { \repStop }
} }
} }
@@ -305,18 +265,4 @@ rufWithMarkup =
#}) #})
ruf = ruf =
#(define-music-function (text) (string?) #(define-music-function (text) (string?)
(rufWithMarkup (make-ruf-style-markup text))) (rufWithMarkup (make-ruf-style-markup text)))
underlineOn =
#(define-music-function () ()
#{
\override LyricText.stencil =
#(lambda (grob)
(grob-interpret-markup grob (make-underline-markup (ly:grob-property grob 'text))))
#})
underlineOff =
#(define-music-function () ()
#{
\revert LyricText.stencil
#})

View File

@@ -80,8 +80,41 @@ capoTranspose =
(ly:make-pitch 0 0) (ly:make-pitch 0 0)
chords)) chords))
% kleine Mollakkorde und Alteration ausgeschrieben
#(define (note-name->german-markup-nosym pitch lowercase?)
(define (pitch-alteration-semitones pitch) (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
(define (accidental->markup alteration name)
(if (= alteration 0)
(make-line-markup (list empty-markup))
(if (= alteration FLAT)
(if (equal? name "B")
""
; (make-line-markup (list (make-hspace-markup 0.2)
; (make-tiny-markup (make-raise-markup 1.2
; (make-musicglyph-markup (assoc-get alteration standard-alteration-glyph-name-alist ""))))
; ))
(if (or (equal? name "E") (equal? name "A")) "s" "es"))
"is")
))
(define (conditional-string-downcase str condition)
(if condition (string-downcase str) str))
(let* ((name (ly:pitch-notename pitch))
(alt-semitones (pitch-alteration-semitones pitch))
(n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2)))
(cons 7 (+ 0 alt-semitones))
(cons name alt-semitones))))
(make-line-markup
(list
(make-simple-markup
(conditional-string-downcase
(vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
lowercase?))
(accidental->markup (/ (cdr n-a) 2) (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a)) ))))
)
% additional bass notes should get uppercased % additional bass notes should get uppercased
#(define (bassnote-name->german-markup-nosym pitch lowercase?)((chord-name:name-markup 'deutsch) pitch #f)) #(define (bassnote-name->german-markup-nosym pitch lowercase?)(note-name->german-markup-nosym pitch #f))
defaultChordPrintings = { defaultChordPrintings = {
<c g>-\markup { \super "5" } <c g>-\markup { \super "5" }
@@ -124,15 +157,15 @@ generalLayout = \layout {
\generalLayout \generalLayout
\context { \context {
\ChordNames \ChordNames
\semiGermanChords
\override ChordName.font-size = \songScoreChordFontSize \override ChordName.font-size = \songScoreChordFontSize
\override ChordName.font-series = \songChordFontSeries \override ChordName.font-series = \songChordFontSeries
\override ChordName.font-family = #'serif \override ChordName.font-family = #'serif
chordNameLowercaseMinor = ##t chordNameLowercaseMinor = ##t
chordChanges = ##t chordChanges = ##t
chordRootNamer = #(chord-name:name-markup 'deutsch) % eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben)
chordRootNamer = #note-name->german-markup-nosym
chordNoteNamer = #bassnote-name->german-markup-nosym chordNoteNamer = #bassnote-name->german-markup-nosym
additionalPitchPrefix = ""
majorSevenSymbol = "maj7" majorSevenSymbol = "maj7"
chordNameExceptions = \chordNameExceptions chordNameExceptions = \chordNameExceptions
} }
@@ -181,4 +214,4 @@ Ignoring_newline_chord_changes_engraver =
((chord-name-interface this-engraver grob source-engraver) ((chord-name-interface this-engraver grob source-engraver)
(when (and (ly:context-property ctx 'chordChanges #f) (ly:grob-property grob 'begin-of-line-visible #f)) (when (and (ly:context-property ctx 'chordChanges #f) (ly:grob-property grob 'begin-of-line-visible #f))
(ly:grob-suicide! grob) (ly:grob-suicide! grob)
))))) )))))

View File

@@ -2,8 +2,8 @@
poetPrefix = "Worte:" poetPrefix = "Worte:"
composerPrefix = "Weise:" composerPrefix = "Weise:"
compositionPrefix = "Satz:" compositionPrefix = "Satz:"
adaptionTextPrefix = "Bearbeitung:" adaptionTextPrefix = "Bearbeitung Text:"
adaptionMusicPrefix = "Bearbeitung:" adaptionMusicPrefix = "Bearbeitung Musik:"
poetAndComposerEqualPrefix = "Worte und Weise:" poetAndComposerEqualPrefix = "Worte und Weise:"
voicePrefix = "Stimme:" voicePrefix = "Stimme:"
versePrefix = "Strophe:" versePrefix = "Strophe:"
@@ -12,7 +12,6 @@
pronunciationPrefix = "Aussprache:" pronunciationPrefix = "Aussprache:"
interludePrefix = "Zwischenspiel:" interludePrefix = "Zwischenspiel:"
bridgePrefix = "Bridge:" bridgePrefix = "Bridge:"
author-joiner = #(lambda (author-list) (string-join author-list ", "))
authorFormat = authorFormat =
#(lambda (noDetails name trail_name birth_year death_year organization) #(lambda (noDetails name trail_name birth_year death_year organization)
@@ -32,105 +31,6 @@
"" ""
))) )))
authorContributionFormat =
#(lambda* (render-contribution-group render-partial-contribution-group #:key
(poetIds '())
(translatorIds '())
(versePoetData '())
(composerIds '())
(verseComposerData '())
(voiceComposerData '())
(compositionIds '())
(adaptionTextIds '())
(adaptionMusicIds '())
(bridgeIds '())
(interludeIds '())
(year_text #f)
(year_translation #f)
(year_melody #f)
(year_composition #f)
(year_adaption_text #f)
(year_adaption_music #f)
(poetAndComposerEqualPrefix "")
(poetPrefix "")
(composerPrefix "")
(translationAuthorPrefix "")
(pronunciationPrefix "")
(compositionPrefix "")
(adaptionTextPrefix "")
(adaptionMusicPrefix "")
(bridgePrefix "")
(interludePrefix ""))
(if (and
(equal? poetIds composerIds)
(null? translatorIds)
(null? versePoetData)
(null? verseComposerData)
(null? voiceComposerData)
(null? compositionIds)
(null? adaptionTextIds)
(null? adaptionMusicIds)
(null? bridgeIds)
(null? interludeIds))
(list
(join-present (list
(render-contribution-group poetAndComposerEqualPrefix poetIds)
(if (equal? year_text year_melody) year_text (join-present (list year_text year_melody) "/"))
) ", ")
#f)
(list
(if (and (null? poetIds) (null? versePoetData) (null? translatorIds)) #f
(string-append
poetPrefix
" "
(join-present (list
(join-present (list
(render-contribution-group "" poetIds)
year_text
) ", ")
(render-partial-contribution-group 'versePrefix versePoetData)
(join-present (list
(render-contribution-group adaptionTextPrefix adaptionTextIds)
year_adaption_text
) ", ")
(join-present (list
(render-contribution-group translationAuthorPrefix translatorIds)
year_translation
) ", ")
) "; ")
))
(if (and
(null? composerIds)
(null? compositionIds)
(null? adaptionMusicIds)
(null? verseComposerData)
(null? voiceComposerData)
(null? bridgeIds)
(null? interludeIds)) #f
(string-append
composerPrefix
" "
(join-present (list
(join-present (list
(render-contribution-group "" composerIds)
year_melody
) ", ")
(render-partial-contribution-group 'versePrefix verseComposerData)
(render-partial-contribution-group 'voicePrefix voiceComposerData)
(join-present (list
(render-contribution-group compositionPrefix compositionIds)
year_composition
) ", ")
(join-present (list
(render-contribution-group adaptionMusicPrefix adaptionMusicIds)
year_adaption_music
) ", ")
(render-contribution-group bridgePrefix bridgeIds)
(render-contribution-group interludePrefix interludeIds)
) "; ")
)))))
songinfoMarkup = songinfoMarkup =
#(make-on-the-fly-markup #(make-on-the-fly-markup
(lambda (layout props m) (lambda (layout props m)
@@ -145,15 +45,13 @@
(year_melody (chain-assoc-get 'songinfo:year_melody props #f)) (year_melody (chain-assoc-get 'songinfo:year_melody props #f))
(poet-with-year (if (and poet-maybe-with-composer year_text) (string-append poet-maybe-with-composer ", " year_text) poet-maybe-with-composer)) (poet-with-year (if (and poet-maybe-with-composer year_text) (string-append poet-maybe-with-composer ", " year_text) poet-maybe-with-composer))
(composer-with-year (if (and composer year_melody) (string-append composer ", " year_melody) composer)) (composer-with-year (if (and composer year_melody) (string-append composer ", " year_melody) composer))
(concat-markupped-strings (lambda (text)
(ly:regex-replace (ly:make-regex "(\\S+)(\\\\\\w+(?:\\s+\\[^\\{\\s]*|\\s*\\{[^\\}]*\\}))(\\S*)") text "\\concat {" 1 "\\line {" 2 "}" 3 "}")))
(string-with-paragraphs->markuplist (lambda (prefix text) (string-with-paragraphs->markuplist (lambda (prefix text)
(if text (if text
(apply append (apply append
(map (map
(lambda (paragraph) (lambda (paragraph)
(make-wordwrap-internal-markup-list #t (make-wordwrap-internal-markup-list #t
#{ \markuplist { $(ly:parser-include-string (concat-markupped-strings paragraph)) } #})) #{ \markuplist { $(ly:parser-include-string paragraph) } #}))
(ly:regex-split (ly:make-regex "\r?\n[ \t\r\n]*\n[ \t\r\n]*") (string-append prefix text)))) (ly:regex-split (ly:make-regex "\r?\n[ \t\r\n]*\n[ \t\r\n]*") (string-append prefix text))))
'()))) '())))
(poet-and-composer-markup-list (poet-and-composer-markup-list
@@ -177,4 +75,4 @@
))))) )))))
(make-null-markup) (make-null-markup)
) )
} }

View File

@@ -16,10 +16,9 @@ songTocColumns = 3
globalSize = 15 globalSize = 15
lyricSize = 1.6 lyricSize = 1.6
stanzaFormat = "~a." stanzaFormat = "~a."
romanStanzaFormat = "~@r."
refString = "Ref.:" refString = "Ref.:"
refStringWithNumbers = "Ref. ~a:" refStringWithNumbers = "Ref. ~a:"
bridgeString = "Bridge:"
bridgeStringWithNumbers = "Bridge ~a:"
% hübsche Wiederholungszeichen für den Liedtext % hübsche Wiederholungszeichen für den Liedtext
repStart = "𝄆" repStart = "𝄆"
repStop = "𝄇" repStop = "𝄇"

View File

@@ -30,9 +30,6 @@
(lambda (a b) (< (cadr a) (cadr b)))) (lambda (a b) (< (cadr a) (cadr b))))
(list))) (list)))
#(define (join-present items joiner)
(string-join (filter (lambda (item) (and (string? item) (not (string-null? (string-trim-both item))))) items) joiner))
#(define-markup-command (print-songinfo layout props) () #(define-markup-command (print-songinfo layout props) ()
(define (songinfo-from songId key) (define (songinfo-from songId key)
(let ((song (if (defined? 'SONG_DATA) (assoc-ref SONG_DATA songId) #f))) (let ((song (if (defined? 'SONG_DATA) (assoc-ref SONG_DATA songId) #f)))
@@ -77,7 +74,11 @@
(define (render-contribution-group contributionPrefix authorIds) (define (render-contribution-group contributionPrefix authorIds)
(if (null? authorIds) (if (null? authorIds)
"" ""
(string-append contributionPrefix " " ((ly:output-def-lookup layout 'author-joiner) (format-authors authorIds)))) (string-append contributionPrefix " " (string-join (format-authors authorIds) ", ")))
)
(define (join-present items joiner)
(string-join (filter (lambda (item) (and (string? item) (not (string-null? (string-trim-both item))))) items) joiner)
) )
(define (render-partial-contribution-group prefixLookup authorData) (define (render-partial-contribution-group prefixLookup authorData)
@@ -93,37 +94,93 @@
(define (poet-and-composer-from-authors authors) (define (poet-and-composer-from-authors authors)
(if authors (if authors
((ly:output-def-lookup layout 'authorContributionFormat) (let (
render-contribution-group (poetIds (find-author-ids-by 'text authors))
render-partial-contribution-group (translatorIds (find-author-ids-by 'translation authors))
#:poetIds (find-author-ids-by 'text authors) (versePoetData (find-author-id-with-part-numbers 'verse authors))
#:translatorIds (find-author-ids-by 'translation authors) (composerIds (find-author-ids-by 'melody authors))
#:versePoetData (find-author-id-with-part-numbers 'verse authors) (verseComposerData (find-author-id-with-part-numbers 'meloverse authors))
#:composerIds (find-author-ids-by 'melody authors) (voiceComposerData (find-author-id-with-part-numbers 'voice authors))
#:verseComposerData (find-author-id-with-part-numbers 'meloverse authors) (compositionIds (find-author-ids-by 'composition authors))
#:voiceComposerData (find-author-id-with-part-numbers 'voice authors) (adaptionTextIds (find-author-ids-by 'adaption_text authors))
#:compositionIds (find-author-ids-by 'composition authors) (adaptionMusicIds (find-author-ids-by 'adaption_music authors))
#:adaptionTextIds (find-author-ids-by 'adaption_text authors) (bridgeIds (find-author-ids-by 'bridge authors))
#:adaptionMusicIds (find-author-ids-by 'adaption_music authors) (interludeIds (find-author-ids-by 'interlude authors))
#:bridgeIds (find-author-ids-by 'bridge authors) (year_text (chain-assoc-get 'header:year_text props #f))
#:interludeIds (find-author-ids-by 'interlude authors) (year_translation (chain-assoc-get 'header:year_translation props #f))
#:year_text (chain-assoc-get 'header:year_text props #f) (year_melody (chain-assoc-get 'header:year_melody props #f))
#:year_translation (chain-assoc-get 'header:year_translation props #f) (year_composition (chain-assoc-get 'header:year_composition props #f))
#:year_melody (chain-assoc-get 'header:year_melody props #f) (year_adaption_text (chain-assoc-get 'header:year_adaption_text props #f))
#:year_composition (chain-assoc-get 'header:year_composition props #f) (year_adaption_music (chain-assoc-get 'header:year_adaption_music props #f))
#:year_adaption_text (chain-assoc-get 'header:year_adaption_text props #f) )
#:year_adaption_music (chain-assoc-get 'header:year_adaption_music props #f) (if (and
#:poetAndComposerEqualPrefix (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) (equal? poetIds composerIds)
#:poetPrefix (ly:output-def-lookup layout 'poetPrefix) (null? translatorIds)
#:composerPrefix (ly:output-def-lookup layout 'composerPrefix) (null? versePoetData)
#:translationAuthorPrefix (ly:output-def-lookup layout 'translationAuthorPrefix) (null? verseComposerData)
#:pronunciationPrefix (ly:output-def-lookup layout 'pronunciationPrefix) (null? voiceComposerData)
#:compositionPrefix (ly:output-def-lookup layout 'compositionPrefix) (null? compositionIds)
#:adaptionTextPrefix (ly:output-def-lookup layout 'adaptionTextPrefix) (null? adaptionTextIds)
#:adaptionMusicPrefix (ly:output-def-lookup layout 'adaptionMusicPrefix) (null? adaptionMusicIds)
#:bridgePrefix (ly:output-def-lookup layout 'bridgePrefix) (null? bridgeIds)
#:interludePrefix (ly:output-def-lookup layout 'interludePrefix) (null? interludeIds))
) (list
(join-present (list
(render-contribution-group (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) poetIds)
(if (equal? year_text year_melody) year_text (join-present (list year_text year_melody) "/"))
) ", ")
#f)
(list
(if (and (null? poetIds) (null? versePoetData) (null? translatorIds)) #f
(string-append
(ly:output-def-lookup layout 'poetPrefix)
" "
(join-present (list
(join-present (list
(render-contribution-group "" poetIds)
year_text
) ", ")
(render-partial-contribution-group 'versePrefix versePoetData)
(join-present (list
(render-contribution-group (ly:output-def-lookup layout 'translationAuthorPrefix) translatorIds)
year_translation
) ", ")
(join-present (list
(render-contribution-group (ly:output-def-lookup layout 'adaptionTextPrefix) adaptionTextIds)
year_adaption_text
) ", ")
) "; ")
))
(if (and
(null? composerIds)
(null? compositionIds)
(null? adaptionMusicIds)
(null? verseComposerData)
(null? voiceComposerData)
(null? bridgeIds)
(null? interludeIds)) #f
(string-append
(ly:output-def-lookup layout 'composerPrefix)
" "
(join-present (list
(join-present (list
(render-contribution-group "" composerIds)
year_melody
) ", ")
(render-partial-contribution-group 'versePrefix verseComposerData)
(render-partial-contribution-group 'voicePrefix voiceComposerData)
(join-present (list
(render-contribution-group (ly:output-def-lookup layout 'compositionPrefix) compositionIds)
year_composition
) ", ")
(join-present (list
(render-contribution-group (ly:output-def-lookup layout 'adaptionMusicPrefix) adaptionMusicIds)
year_adaption_music
) ", ")
(render-contribution-group (ly:output-def-lookup layout 'bridgePrefix) bridgeIds)
(render-contribution-group (ly:output-def-lookup layout 'interludePrefix) interludeIds)
) "; ")
)))))
(list #f #f) (list #f #f)
) )
) )
@@ -213,4 +270,4 @@
\line { \page-number-to-pdf-label \null } \line { \page-number-to-pdf-label \null }
} }
} }
} }

View File

@@ -1,5 +1,6 @@
#(define-markup-command (bookTitleMarkupCustom layout props)() #(define-markup-command (bookTitleMarkupCustom layout props)()
(interpret-markup layout props (interpret-markup layout
(prepend-alist-chain 'songfilename (chain-assoc-get 'header:songfilename props "") props)
(make-column-markup (make-column-markup
(list (list
(make-vspace-markup (chain-assoc-get 'header:titletopspace props 0)) (make-vspace-markup (chain-assoc-get 'header:titletopspace props 0))
@@ -37,24 +38,23 @@
;'(0 . 0) '(0 . 0) ;'(0 . 0) '(0 . 0)
))) )))
#(define-markup-command (build-full-title layout props right)(boolean?) #(define-markup-command (title-with-category-images layout props right)(boolean?)
(interpret-markup layout (prepend-alist-chain 'songfilename (chain-assoc-get 'header:songfilename props "") props) (interpret-markup layout props
(let* ((title (chain-assoc-get 'header:title props "")) (let* ((title (chain-assoc-get 'header:title props ""))
(starttext (chain-assoc-get 'header:starttext props #f)) (starttext (chain-assoc-get 'header:starttext props #f))
(pdfbookmark (if starttext (string-append starttext " | " title) title)) (pdfbookmark (if starttext (string-append starttext " | " title) title)))
(title-markup (ly:output-def-lookup layout (if right 'oddTitleLineMarkup 'evenTitleLineMarkup))))
(if title (if title
(markup #:title-to-pdf-toc pdfbookmark title-markup) (if right
make-null-markup) #{\markup { \title-to-pdf-toc #pdfbookmark \fill-line \general-align #Y #UP { \null \bookTitleMarkupCustom \category-images } } #}
#{\markup { \title-to-pdf-toc #pdfbookmark \fill-line \general-align #Y #UP { \category-images \bookTitleMarkupCustom \null } } #})
#{ \markup { " " } #})
))) )))
\paper { \paper {
bookTitleMarkup = \markup \null bookTitleMarkup = \markup \null
scoreTitleMarkup = \markup \null scoreTitleMarkup = \markup \null
oddHeaderMarkup = \markup { \if \on-first-page-of-part \build-full-title ##t } oddHeaderMarkup = \markup { \if \on-first-page-of-part \title-with-category-images ##t }
evenHeaderMarkup = \markup { \if \on-first-page-of-part \build-full-title ##f } evenHeaderMarkup = \markup { \if \on-first-page-of-part \title-with-category-images ##f }
oddTitleLineMarkup = \markup { \fill-line \general-align #Y #UP { \null \bookTitleMarkupCustom \category-images } }
evenTitleLineMarkup = \markup { \fill-line \general-align #Y #UP { \category-images \bookTitleMarkupCustom \null } }
defaultTitleMarkup = \markup { defaultTitleMarkup = \markup {
\override #'(baseline-skip . 3.5) \override #'(baseline-skip . 3.5)
\center-column { \center-column {
@@ -63,4 +63,4 @@
\smaller \bold \fromproperty #'header:subsubtitle \smaller \bold \fromproperty #'header:subsubtitle
} }
} }
} }

View File

@@ -60,15 +60,14 @@
% Text über Text mittig darstellen % Text über Text mittig darstellen
#(define-markup-command (textup layout props text uptext) (markup? markup?) #(define-markup-command (textup layout props text uptext) (markup? markup?)
#:properties ((verselayout generalLayout) #:properties ((verselayout generalLayout))
(verse-text-chord-distance songTextChordDistance))
"Markup über Text mittig darstellen." "Markup über Text mittig darstellen."
(interpret-markup layout props (interpret-markup layout props
#{\markup { #{\markup {
\size-box-to-box-style-dependent ##t ##f \size-box-to-box-style-dependent ##t ##f
\general-align #X #LEFT \override #`(direction . ,UP) \override #'(baseline-skip . 1) \dir-column \chord-alignment-style-dependent { \general-align #X #LEFT \override #`(direction . ,UP) \override #'(baseline-skip . 1.0) \dir-column \chord-alignment-style-dependent {
\pad-to-box #'(0 . 0) #`(0 . ,(- verse-text-chord-distance 0.8)) { #text } \pad-to-box #'(0 . 0) #'(0 . 2.0) { #text }
\size-box-to-box ##f ##t #uptext \score { \chords { g4:m a } \layout { $verselayout #(customized-layout verselayout) } } \size-box-to-box ##f ##t #uptext \score { \chords { g4:m a } \layout { $verselayout } }
} }
#text #text
} }
@@ -89,7 +88,7 @@
(if (and (string? arg) (string-null? arg)) (if (and (string? arg) (string-null? arg))
" " " "
#{\markup #{\markup
\score { \new Lyrics { \lyricmode { #(if (ly:music? arg) arg #{ \set stanza = #arg #}) "" } } \layout { $verselayout #(customized-layout verselayout) } } \score { \new Lyrics { \lyricmode { #(if (ly:music? arg) arg #{ \set stanza = #arg #}) "" } } \layout { $verselayout } }
#} #}
))) )))
@@ -141,7 +140,7 @@
(make-wrap-newline-markup (make-wrap-newline-markup
(ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)") (ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)")
(ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") (handle-custom-newlines custom-verse-breaks verse) " \\concat { " 1 " } ") (ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") (handle-custom-newlines custom-verse-breaks verse) " \\concat { " 1 " } ")
"\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { " transp " \\chords { s4 " 4 " } \\layout { $verselayout #(customized-layout verselayout) } }") "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { " transp " \\chords { s4 " 4 " } \\layout { $verselayout } }")
) )
)))) ))))
@@ -203,9 +202,23 @@
#(define-markup-command (pad-left layout props amount arg) #(define-markup-command (pad-left layout props amount arg)
(number? markup?) (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:stencil-translate
(interpret-markup layout props (make-pad-x-left-markup amount arg)) (ly:make-stencil (ly:stencil-expr m)
`(,amount . 0))) (cons (- (car x) amount) (cdr x))
y)
`(,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-with-indents layout props lines) #(define-markup-command (score-equal-height-with-indents layout props lines)
(markup-list?) (markup-list?)
@@ -236,7 +249,7 @@
(let ((text (ly:grob-property grob 'text))) (let ((text (ly:grob-property grob 'text)))
(grob-interpret-markup grob (if (string? text) (grob-interpret-markup grob (if (string? text)
(make-pad-x-right-markup -0.1 (make-tied-lyric-markup text)) (make-pad-right-markup -0.1 (make-tied-lyric-markup text))
text)))) text))))
Chord_lyrics_spacing_engraver = Chord_lyrics_spacing_engraver =
@@ -288,10 +301,9 @@ Chord_lyrics_spacing_engraver =
(ly:grob-set-property! grob 'extra-spacing-width (ly:grob-set-property! grob 'extra-spacing-width
(cons (- chord-width-since-last-lyric) (cdr (ly:grob-property grob 'extra-spacing-width '(0 . 0))))) (cons (- chord-width-since-last-lyric) (cdr (ly:grob-property grob 'extra-spacing-width '(0 . 0)))))
(if last-printed-chord (if last-printed-chord
(let ((gap-for-starting-rest 2.0)) (begin
(if stanza (ly:grob-set-property! stanza 'padding (+ 1 gap-for-starting-rest))) (if stanza (ly:grob-set-property! stanza 'padding chord-width-since-last-lyric))
(ly:grob-set-parent! grob X last-printed-chord) (place-at-right-edge grob last-printed-chord 0)
(ly:grob-set-property! grob 'X-offset gap-for-starting-rest)
))) )))
) )
(set! last-lyric-syllable grob) (set! last-lyric-syllable grob)
@@ -353,7 +365,9 @@ Chord_lyrics_spacing_engraver =
>> >>
\layout { \layout {
$verselayout $verselayout
#(customized-layout verselayout) #(let
((custom-size (ly:output-def-lookup verselayout 'size #f)))
(if custom-size (layout-set-staff-size custom-size)))
ragged-right = ##t ragged-right = ##t
\context { \context {
\Lyrics \Lyrics

View File

@@ -441,6 +441,6 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s
; we use a delayed stencil to have all the page references available ; we use a delayed stencil to have all the page references available
(ly:make-stencil (ly:make-stencil
`(delay-stencil-evaluation `(delay-stencil-evaluation
,(delay (let* ((table (ly:output-def-lookup layout 'label-absolute-page-table))) ,(delay (let* ((table (ly:output-def-lookup layout 'label-page-table)))
(generate-toc-csv (if (list? table) table '())) (generate-toc-csv (if (list? table) table '()))
empty-stencil))))) empty-stencil)))))

View File

@@ -1,10 +1,5 @@
MUSIC = { \transposable #TRANSPOSITION \MUSIC } MUSIC = { \transposable #TRANSPOSITION \MUSIC }
LAYOUT = \layout {
\LAYOUT
#(customized-layout LAYOUT)
}
verselayout = \layout { verselayout = \layout {
\LAYOUT \LAYOUT
\context { \context {
@@ -13,6 +8,13 @@ verselayout = \layout {
} }
} }
LAYOUT = \layout {
\LAYOUT
#(let
((custom-size (ly:output-def-lookup LAYOUT 'size #f)))
(if custom-size (layout-set-staff-size custom-size)))
}
TEXT = \markuplist { TEXT = \markuplist {
\override #`(transposition . ,TRANSPOSITION) \override #`(transposition . ,TRANSPOSITION)
\override #`(verselayout . ,verselayout) \override #`(verselayout . ,verselayout)