Hi Vivian,
> I posted a message to this list a few days ago about automatically
> center-aligning some text under a Hairpin object (for example "molto" or
> "poco" ) but haven't received any responses. Whilst I've found how to
> combine markups using combine-at-edge I can't find how to center-align
> one to the other (if indeed this is possible, which I would hope it is.)
> Could someone give me some pointers about where to begin? It would save
> me a lot of time if I could get this working.
Below is a a piece of code that hopefully solves your problem. My scheme
knowledge is still quite limited and I have almost no experience in
using lilypond's scheme functions, so any gurus may want to make this
ad-hoc hack considerably shorter or more elegant. But at least I hope it
works.
Cheers,
Max
%%% begin code %%%
hairpinMolto = {
\override Voice.Hairpin #'stencil = #(lambda (grob)
(let ((ext (ly:stencil-extent (ly:hairpin::print grob) 0)))
(ly:stencil-combine-at-edge
(ly:stencil-aligned-to (ly:hairpin::print grob) 0 -1)
1
-1
(ly:stencil-translate-axis
(ly:stencil-aligned-to (ly:text-interface::print grob) 0 0)
(/ (- (cdr ext) (car ext)) 2)
0))))
\override Voice.Hairpin #'text =
\markup { \smaller \italic "molto" }
}
\new Staff {
\hairpinMolto c'2\< c'2\f
}
%%% end code %%%