From b2f1a7dc86ef2617a15b355c288c46cb419cab2c Mon Sep 17 00:00:00 2001 From: Christoph Wagner Date: Fri, 31 Oct 2025 15:15:21 +0100 Subject: [PATCH] override-stanza with multiple numbers --- .../base/basic_format_and_style_settings.ily | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/private_includes/base/basic_format_and_style_settings.ily b/private_includes/base/basic_format_and_style_settings.ily index b4154e0..394d416 100644 --- a/private_includes/base/basic_format_and_style_settings.ily +++ b/private_includes/base/basic_format_and_style_settings.ily @@ -127,23 +127,23 @@ romanStanza = #{ \override StanzaNumber.style = #'roman #}) override-stanza = -#(define-music-function (parser location stanzanumber) (number?) +#(define-music-function (parser location stanzanumbers) (number-list?) #{ - \once \override StanzaNumber.forced-spacing = #stanzanumber % misuse property "forced-spacing" to override the stanzanumber + \once \override StanzaNumber.details.custom-stanzanumber-override = #stanzanumbers #} ) #(define (stanza . stanzanumbers) #{ - \once \override StanzaNumber.layer = 23 % 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 #(lambda (context) - (let* ((stanzanumber-override (ly:assoc-get 'forced-spacing (ly:context-grob-definition context 'StanzaNumber) #f)) + (let* ((stanzanumbers-override (ly:assoc-get 'custom-stanzanumber-override (ly:assoc-get 'details (ly:context-grob-definition context 'StanzaNumber) '()) #f)) (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 stanzanumber-override (list stanzanumber-override) stanzanumbers)) + (if stanzanumbers-override stanzanumbers-override stanzanumbers)) ", ")))) #} ) @@ -151,7 +151,7 @@ override-stanza = ref = #(define-music-function (stanzanumbers lyrics) ((number-list? (list)) ly:music?) #{ \lyricmode { - \once \override StanzaNumber.layer = 23 % 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 \set stanza = #(make-on-the-fly-markup (lambda (layout props m) ((ly:output-def-lookup layout 'refMarkupFormatter) layout props stanzanumbers)) (make-null-markup)) #lyrics } @@ -159,13 +159,13 @@ ref = ) % prints a repStart Sign as stanza if the tag 'repeats is kept. -% if there was a stanza already set by the stanza function with StanzaNumber.layer = 23 we set that also as stanza. +% if there was a stanza already set by the stanza function with StanzaNumber.details.custom-realstanza = ##t we set that also as stanza. repStartWithTag = \lyricmode { \tag #'repeats { \applyContext #(lambda (context) (let ((lastStanza (ly:context-property context 'stanza)) - (printLastStanza (= (ly:assoc-get 'layer (ly:context-grob-definition context 'StanzaNumber) 0) 23)) + (printLastStanza (ly:assoc-get 'custom-realstanza (ly:assoc-get 'details (ly:context-grob-definition context 'StanzaNumber) '()) #f)) (stanzaFontSeries (ly:assoc-get 'font-series (ly:context-grob-definition context 'StanzaNumber) 'normal))) (ly:context-set-property! context 'stanza (make-concat-markup