Fellow music engravers,
I have a feature request. Perhaps, this has been discussed already.
Sometimes, I would like the spacial formatting in a \markup command to
respond to changes in fontsize, so that all of the \markup spacing will
change proportional to the change in fontsize. I think having \markup
formatting commands - like \fs-raise, \fs-lower, \fs-hspace, \fs-vspace,
etc. - that respond to changes in \fontsize would be helpful. I am
trying to make a basic define-markup-command function for \raise that
would do this for whole number fontsizes, but I do not know how to add
math to markup command definitions. Here is my non-working code sketch,
so far.
<code start>
\version "2.24.1"
%global font-size variable
font-size =
#0
%#1
%fs-raise definition
#(define-markup-command (fs-raise layout props rs text1) (number? markup?)
(interpret-markup layout props
(cond
((equal? font-size 0)
; I want to create variable r = rs * 1, like
this, which does not work, #(define r (* 1 rs))
#{ \markup \fontsize #font-size \raise #r #text1 #}
)
((equal? font-size 1)
; I want to create variable r = rs * 1.25, like
this, which does not work, #(define r (* 1.25 rs))
#{ \markup \fontsize #font-size \raise #r #text1 #}
)
; more font-size conditionals go here.
(else #{ \markup \null #})
)
)
)
%music block
{ c'1^\markup \fs-raise #1 "text" }
<code end>
My basic question is, how do you create a variable and do math on it
inside a conditional statement within a define-markup-command function?
Peace,
David