Hi,
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)))
(txt-stencil (interpret-markup layout props txt))
(txt-x-ext (ly:stencil-extent txt-stencil X))
(txt-width (- (cdr txt-x-ext)(car txt-x-ext)))
)
(interpret-markup layout props
(markup #:hspace 0 #:translate (cons txt-width 0)
#:concat (mark txt)))
))
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
#})
\score {
\relative c'' {
\clef "G"
\key c \major
\time 4/4
% Rehearsal mark
\set Score.rehearsalMark = #10
\set Score.markFormatter = #format-mark-box-numbers
\mark \default
c1 \bar "||"
% Add text to the next rehearsal mark
\BoxMarkText #"Theme from 007"
e( f)
% Revert to default mark
\mark \default
g( e) \break
}
}
\layout{
indent = 0
ragged-right = ##t
}
%%% end of example
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user