I'am working on a music function that creates a rehearsal mark with extra text added. It would be nice if the end result would be something that would work as: \mark \default "text". These are my first steps into the world of scheme, so I suppose that some of my questions are rather basic.
The code below more or less works and shows what I am trying to achieve but is not perfect at all! So, I need some help to solve the drawbacks.
Here are the issues that need attention: 1 - I would like to use the current format for the rehearsal mark. Is it possible to call/use the current Score.markFormatter and store the mark in a markup-variable?
2 - Now I redefine the Score.markFormater with "/once /set" but "/once" generates warnings. What is wrong? 3 - Is it possible to avoid the /set Score.markFormatter and use the /mark /markup /center-at-mark directly?
I could use [1] to retrieve the current mark and should increment the counter: Score.rehearsalMark = Score.rehearsalMark + 1 4 - Allignment is ok but the extend is not correct, see the allignment of the first rehearsal mark that moves up because of the second mark.
Any advise?
Greetings, Ed
%%% Example
\version "2.13.39"
#(define-markup-command (center-at-mark layout props mark text) (markup? string?) "x-align on the center of the rehaersal mark"
(let* ( (txt (markup #:normal-text #:bold #:normalsize #:concat (" " text)))
BoxMarkText = #(define-music-function (parser location AddText) (string?) "Create a Rehearsal mark and add the string AddText" #{ % Redefine the Rehearsal mark % \once does work but generates multiple warning.
\once \set Score.markFormatter = #(lambda (mark context) (markup #:center-at-mark (format-mark-box-numbers mark context)$AddText)) \mark \default #})