Compare commits

...

7 Commits

5 changed files with 84 additions and 3 deletions

View File

@ -1,7 +1,8 @@
#(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f))
#(if (defined? 'LAYOUT) #f (load "json_parser.scm"))
#(if (defined? 'LAYOUT) #f (load (string-append (dirname (current-filename)) file-name-separator-string "json_parser.scm")))
#(use-modules (json parser))
\include "resolve_inherits.ly"
\include "basic_format_and_style_settings.ly"
\include "eps_file_from_song_dir.ly"
\include "title_with_category_images.ly"

View File

@ -105,13 +105,21 @@ romanStanza =
#(define-music-function (parser location) ()
#{ \override StanzaNumber.style = #'roman #})
override-stanza =
#(define-music-function (parser location stanzanumber) (number?)
#{
\once \override StanzaNumber.forced-spacing = #stanzanumber % misuse property "forced-spacing" to override the stanzanumber
#}
)
stanza =
#(define-music-function (parser location stanzanumber) (number?)
#{
\once \override StanzaNumber.layer = 23 % set this to signal that there is a real stanza and no repeat signs
\applyContext
#(lambda (context)
(let* ((stanzastyle (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
(let* ((stanzanumber (ly:assoc-get 'forced-spacing (ly:context-grob-definition context 'StanzaNumber) stanzanumber))
(stanzastyle (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
(formattedStanzaNumber (format #f (if (eq? stanzastyle 'roman) romanStanzaFormat stanzaFormat) stanzanumber)))
(ly:context-set-property! context 'stanza formattedStanzaNumber)))
#}
@ -148,3 +156,22 @@ repStopWithTag = \lyricmode {
\set stanza = \markup { \repStop }
}
}
rightHyphen = \lyricmode {
\once \override StanzaNumber.font-series = #'normal
\once \override StanzaNumber.direction = 1
\set stanza = "-"
}
leftHyphen = \lyricmode {
\once \override StanzaNumber.font-series = #'normal
\set stanza = "-"
}
multiVerseSkips =
#(define-music-function (parser location skips) (number?)
#{ \tag #'multiVerse { \repeat unfold #skips { \skip4 } } #})
alt =
#(define-music-function (parser location a b) (ly:music? ly:music?)
#{ \tag #'firstVerse { #a } \tag #'multiVerse { #b } #})

View File

@ -138,3 +138,33 @@ generalLayout = \layout {
}
}
#}))
% If you add this engraver to ChordNames Context chords get only printed on chordchanges and if its the first chord after line break.
Ensure_first_chord_after_line_break_printed_engraver =
#(lambda (ctx)
(define last-system-column-rank 0)
(make-engraver
(acknowledgers
((chord-name-interface this-engraver grob source-engraver)
(ly:grob-set-property! grob 'after-line-breaking
(lambda (grob)
(let ((current-system-column-rank (car (ly:grob-spanned-column-rank-interval (ly:grob-system grob)))))
(if (and
(ly:context-property ctx 'chordChanges #f)
(ly:grob-property grob 'begin-of-line-visible #f)
(not (= last-system-column-rank current-system-column-rank)))
; the current chord handling implementation in lilypond uses 'begin-of-line-visible to mark repeated chords
(ly:grob-set-property! grob 'begin-of-line-visible #f))
(set! last-system-column-rank current-system-column-rank)
(ly:chord-name::after-line-breaking grob)
)))))))
% If you add this engraver to ChordNames Context chords get only printed on chordchanges and not at newline.
Ignoring_newline_chord_changes_engraver =
#(lambda (ctx)
(make-engraver
(acknowledgers
((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))
(ly:grob-suicide! grob)
)))))

22
resolve_inherits.ly Normal file
View File

@ -0,0 +1,22 @@
#(define (resolve-inherit-entry-in-list alist entry)
(let* ((key (car entry))
(attributes (cdr entry))
(inherits (assoc-ref attributes "inherits")))
(if inherits
(let* ((alist-without-entry (alist-delete key alist))
(inherit-entry (assoc inherits alist-without-entry))
(inherits-attributes (if inherit-entry (alist-copy (cdr (resolve-inherit-entry-in-list alist-without-entry inherit-entry)))))
(override-attributes (alist-delete "inherits" attributes)))
(if inherit-entry
(begin
(for-each (lambda (attribute) (assoc-set! inherits-attributes (car attribute) (cdr attribute))) override-attributes)
(cons key inherits-attributes)
)
(ly:error "~a can not inherit from ~a" key inherits))
)
entry
)))
#(define (resolve-inherits alist)
(map (lambda (entry) (resolve-inherit-entry-in-list alist entry)) alist)
)

View File

@ -277,6 +277,7 @@
\ChordNames
\override VerticalAxisGroup.staff-affinity = ##f
\override ChordName.extra-spacing-width = #'(-0.1 . 0.1)
\consists \Ensure_first_chord_after_line_break_printed_engraver
}
\context {
\Score