|
From: | Jean Abou Samra |
Subject: | Re: \uppercase function |
Date: | Fri, 16 Jun 2023 16:14:57 +0200 |
User-agent: | Evolution 3.48.3 (3.48.3-1.fc38) |
Le vendredi 16 juin 2023 à 09:41 -0400, Kieren MacMillan a écrit :
Hi all!
Anyone have a good \uppercase function they could share?
I tried to make one, and it doesn’t throw an error, but also doesn’t work:
\version "2.25.2" #(define-markup-command (uppercase layout props arg) (markup?) (interpret-markup layout props (string-upcase (markup->string arg)))) \header { title = "My Awesome Piece" } \paper { scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title } { c1 }
It's expected that this doesn't work, since you feed "\fromproperty #'header:title" to markup->string, but you don't give the properties to markup->string, so it doesn't know what value the "header:title" property. Replacing (markup->string arg)
with (markup->string arg #:layout layout #:props props)
should work. Better yet, use string transformers (since 2.23.12), which solve exactly this problem:
\version "2.24.1"
\markup uppercase =
\markup \with-string-transformer
#(lambda (layout props str) (string-upcase str))
\etc
\header {
title = "My Awesome Piece"
}
\paper {
scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title
}
{ c1 }
Jean
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |