\once für \override an Markups

Begonnen von Arnold, Freitag, 14. April 2023, 09:50

« vorheriges - nächstes »

Arnold

Hallo,

gibt es ein \once auch für die \override-Anweisungen an Markups?
Also eine Begrenzung, daß eine Property-Änderung nur auf das nächste Markup der Kette und nicht auf den ganzen Markup-Baum wirkt.
Ja, ich weiß, der fundamentale Unterschied ist, daß mit \once für die Music-Events die Überschreibung im nächsten Zeitschritt zurückgesetzt wird - im Markup-Baum gibt es aber keinen Zeitschritt, sondern nur eine Strukturtiefe.

Ein Beispiel zu meinem Anliegen:
\version "2.24.1" % Guile 2.2

#(define-markup-command (scaleEx layout props factor-pair arg)
  (number-pair? markup?)
  #:category graphic
  #:properties ((angularity 0.0))
  "
scaleEx is like scale, but a property @var{angularity} may be
defined to rotate the axes where the two scaling factors apply.
"
  (let* ((stil (interpret-markup layout props arg))
        (sx (car factor-pair))
        (sy (cdr factor-pair))
        (rstil (ly:stencil-rotate-absolute
                (ly:stencil-scale
                  (ly:stencil-rotate-absolute
                  stil
                  (- angularity) 0.0 0.0)
                  sx sy)
                angularity 0.0 0.0))
        (rstil-expr (ly:stencil-expr rstil))
        (rstil-x-ext (stencil-true-extent rstil X))
        (rstil-y-ext (stencil-true-extent rstil Y)))
    (ly:make-stencil rstil-expr rstil-x-ext rstil-y-ext)))

\markup { "basic scaling:"
          \scaleEx #'(0.7 . 2.2)
          "Test"
        }
\markup { "rotated scaling:"
          \override #'(angularity . 45.0) \scaleEx #'(0.7 . 2.2)
          "Test"
        }
\markup { "chaining rotated and basic scaling:"
          \override #'(angularity . 45.0) \scaleEx #'(0.7 . 2.2)
          \override #'(angularity . 0.0) \scaleEx #'(0.7 . 2.2)
          "Test"
        }
\markup { \column {
            \line { "is there a" \box \line { \bold "\\once" \italic "for overrides to markups" } "available?" }
            \line { "I would like to make this result look like the line above," }
            \line { "but without adding a second" \italic "\\override" "command." }
          }
          \override #'(angularity . 45.0) \scaleEx #'(0.7 . 2.2)
          \scaleEx #'(0.7 . 2.2)
          "Test"
        }

Arnold.

Nachtrag
Vielleicht so etwas wie:
#(define-markup-command (pop-override layout props arg)
  (markup?)
  "pop the last override in the markup chain"
  (let ((popped-props (if (> (length props) 1) (cdr props) props)))
   (interpret-markup layout popped-props arg)))

Arnold.