Well in my case (not a very common one, I'll admit) I wanted to do
something different.
I've found a workaround. Works well if no line-breaks are needed.
Besides, your solution would need manual alignment in some cases and I want
to minimise manual tweaks as much as possible. My scores are HUGE and when
those little things are starting to add up the process gets unwieldy.
hairpinBetweenText =
#(define-music-function (parser location leftText rightText) (markup?
markup?)
#{
\once \override Hairpin.stencil =
#(lambda (grob)
(ly:grob-set-property! grob 'circled-tip #t)
(ly:grob-set-property! grob 'height 0.5)
(ly:grob-set-property! grob 'thickness 1.2)
(ly:stencil-combine-at-edge
(ly:stencil-combine-at-edge
(ly:stencil-aligned-to (ly:hairpin::print grob) Y CENTER)
X RIGHT
(ly:stencil-aligned-to (grob-interpret-markup grob leftText) Y
CENTER)
0)
X RIGHT
(ly:stencil-aligned-to (grob-interpret-markup grob rightText) Y
CENTER)
0.6))
#})
parenthesizedHairpin = \hairpinBetweenText \markup { \with-dimensions
#'(0 . 0) #'(0 . 0) \translate #'(-0.12 . 0.5) \override
#'(baseline-skip . 1.5)
\center-column { \draw-line #'(0.1 . 0.5) \draw-line #'(-0.1 . 0.5)
} } \markup\with-dimensions #'(0 . 0) #'(0 . 0) {
\translate #'(0 . 0) \fontsize #-1 \musicglyph #"scripts.halfopenvertical"
}
% the music
\score {
\relative c' {
\time 3/4
\parenthesizedHairpin
c16\< d e f g a b\! c d e f g
| \break
a \<
c d a\!
}
}
%%%%%%%%%%%%%%%
Dimitris
On Sun, Feb 14, 2021 at 1:31 PM Thomas Morley <[email protected]>
wrote:
> Am Di., 9. Feb. 2021 um 18:26 Uhr schrieb Dimitris Marinakis
> <[email protected]>:
> >
> > I need the ability to place a symbol/text at the right edge of a hairpin.
> > I love using a modified version of the hairpin stencil that allows for
> flared hairpins that have a niente circle at the tip. (the default doesn't).
> > https://sourceforge.net/p/testlilyissues/issues/3357/
> >
> > I've found another snippet that uses a modified version of that code but
> unfortunately it breaks all of the other cool functions of the script.
> > http://lsr.di.unimi.it/LSR/Item?id=947
> >
> > Can someone more experienced with Scheme help me combine them?
> >
> > Dimitris
>
> I don't think the snippets you've found need to be extended.
> Define some custom dynamic-scripts and start using them:
>
> %% include the code from
> https://sourceforge.net/p/testlilyissues/issues/3357/
>
> %% perdendosi
> pd = #(make-dynamic-script #{ \markup \normal-text \italic "pd." #})
> %% dal niente
> dn = #(make-dynamic-script #{ \markup \normal-text \italic "dn." #})
>
>
> {
> \override Hairpin.stencil = #flared-hairpin
> c'4\dn \< c'2 c'4 \!
> c'4 \> c'2 c'4 \pd
> c'4\dn \< c'2 c'4
> \break
> c'2 c'\!
> c'4 \> c'2 c'4
> \break
> c'2 c'\pd
> }
>
> Cheers,
> Harm
>