|
From: | Pablo Cordal |
Subject: | Re: Modified slur stencil with added markup |
Date: | Thu, 8 Nov 2018 16:42:22 +0100 |
Hi again!Can I propose a small modification in this funcion?annotatedSlur =#(define-music-function (parser location padding text) (number? markup?)#{\once \override Slur.after-line-breaking =#(lambda (grob)(let*((stencil (ly:slur::print grob))(dir (ly:grob-property grob 'direction))(markup-stencil (grob-interpret-markup grob text))(shift (- (interval-center (ly:stencil-extent stencil X))(interval-center (ly:stencil-extent markup-stencil X))))(new-stencil(ly:stencil-combine-at-edgestencilY dir(ly:stencil-translate-axis markup-stencil shift X)padding)))(ly:grob-set-property! grob 'stencil new-stencil)))#})Sometimes the text collides with another element, so it would be even better if the function would have another parameter for horizontal alignment.Any master coder can help me with this please?Thank you. Best regardsEl dom., 4 nov. 2018 a las 17:26, Pablo Cordal (<address@hidden>) escribió:Thank you very very very much Harm. Now it works perfectly, it is just what I needed!.Best regardsEl dom., 4 nov. 2018 a las 17:20, Thomas Morley (<address@hidden>) escribió:Am So., 4. Nov. 2018 um 16:38 Uhr schrieb pablocordal <address@hidden>:
>
> Hi Urs and Torsten,
>
> This snippet is exactly what I need. I'm trying to test it, but when I copy
> your code in Frescobaldi (which uses Lilypond underneath) and try to compile
> it I receive this error:
>
> error: syntax error, unexpected LYRIC_ELEMENT
> \markup "hin."
>
> I don't know much about Lilypond code, so please can you please help me just
> to make it work?
>
> Thank you. Best regards
You likely use 2.18.2
With this version the possibility to use optional arguments is limited
and does not work for the current coding.
Please consider to upgrade to 2.19.82.
If you want to stay with 2.18 some adjustments in the function are
needed, also, the function must be called with _two_ arguments: the
padding-value and the markup-text.
\version "2.18.2"
annotatedSlur =
#(define-music-function (parser location padding text) (number? markup?)
#{
\once \override Slur.after-line-breaking =
#(lambda (grob)
(let*
((stencil (ly:slur::print grob))
(dir (ly:grob-property grob 'direction))
(markup-stencil (grob-interpret-markup grob text))
(shift (- (interval-center (ly:stencil-extent stencil X))
(interval-center (ly:stencil-extent markup-stencil X))))
(new-stencil
(ly:stencil-combine-at-edge
stencil
Y dir
(ly:stencil-translate-axis markup-stencil shift X)
padding)))
(ly:grob-set-property! grob 'stencil new-stencil)))
#})
{
\annotatedSlur
%\markup \score { c''' }
#1
\markup "hin."
c''4( g' g' c'' )
}
HTH,
Harm
[Prev in Thread] | Current Thread | [Next in Thread] |