lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modified slur stencil with added markup


From: Pablo Cordal
Subject: Re: Modified slur stencil with added markup
Date: Sun, 4 Nov 2018 17:26:04 +0100

Thank you very very very much Harm. Now it works perfectly, it is just what I needed!.

Best regards

El 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]