From 8800341e1844c582a894b310aee6a8834e01c0ec Mon Sep 17 00:00:00 2001 From: tux Date: Wed, 20 Nov 2024 17:14:04 +0100 Subject: [PATCH] Make it possible to override a stanza number --- basic_format_and_style_settings.ly | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/basic_format_and_style_settings.ly b/basic_format_and_style_settings.ly index c6f3b18..ccc6169 100644 --- a/basic_format_and_style_settings.ly +++ b/basic_format_and_style_settings.ly @@ -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))) #}