lilypond-user
[Top][All Lists]
Advanced

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

Re: Draw a line on the X reference point of a grob


From: Aaron Hill
Subject: Re: Draw a line on the X reference point of a grob
Date: Sun, 19 Jan 2020 13:32:51 -0800
User-agent: Roundcube Webmail/1.3.8

On 2020-01-19 1:20 pm, Paolo Prete wrote:
On Sun, Jan 19, 2020 at 9:52 PM Aaron Hill <address@hidden> wrote:


%%%%
\version "2.18.2"
{
   \once \override DynamicText.after-line-breaking = #(lambda (grob)
     (let* ((x-parent (ly:grob-parent grob X))
            (orig-sten (ly:grob-property x-parent 'stencil)))
       (ly:grob-set-property! x-parent 'stencil
         (grob-interpret-markup x-parent #{
            \markup \combine \stencil #orig-sten
              \with-dimensions #'(0 . 0) #'(0 . 0) \vcenter
              \with-color #red \draw-line #'(0 . 6) #}))))
   c'\mf
}
%%%%


Thanks as always for your patience and your help.
How can I make it compile on 2.19 ?
It compiles on 2.18 but it gives me this error on 2.19:

var/task/ly/usr/share/lilypond/current/ly/init.ly:56:2: error: wrong type
for argument 1.  Expecting stencil, found (quote ())

Oh, crumbs. I *knew* I was asking for trouble without validating things.

In 2.18, the NoteHead is considered the X parent of the DynamicText. However, in 2.19, the NoteColumn is the parent. NoteColumn does not have an existing stencil to overlay, so the \stencil markup command fails. Here's a version that supplies a dummy stencil:

%%%%
\version "2.18.2"
{
   \once \override DynamicText.after-line-breaking = #(lambda (grob)
     (let* ((x-parent (ly:grob-parent grob X))
            (orig-sten (ly:grob-property x-parent 'stencil
                         (ly:make-stencil '()))))
       (ly:grob-set-property! x-parent 'stencil
         (grob-interpret-markup x-parent #{
            \markup \combine \stencil #orig-sten
              \with-dimensions #'(0 . 0) #'(0 . 0) \vcenter
              \with-color #red \draw-line #'(0 . 6) #}))))
   c'\mf
}
%%%%


-- Aaron Hill



reply via email to

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