[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Center graphical markup on staff
From: |
Aaron Hill |
Subject: |
Re: Center graphical markup on staff |
Date: |
Mon, 21 Jun 2021 18:35:26 -0700 |
User-agent: |
Roundcube Webmail/1.4.9 |
On 2021-06-21 5:31 pm, Nuno Trocado wrote:
Hi everyone!
How can I have the wiggly line in the example below centered inside the
staff?
Thanks,
Nuno
\score {
\relative c' {
c4 d
s-\markup \override #'(height . 2) \draw-squiggle-line #1 #'(8 . 0)
##f
}
}
While you could play around with negative padding to get the TextScript
to overlap the staff, I would recommend hijacking something already on
the staff, such as a rest:
%%%%
markupStencil =
#(define-music-function
(markup music)
(markup? ly:music?)
(define (proc grob)
(let* ((sten (grob-interpret-markup grob markup))
(xex (ly:stencil-extent sten X)))
(ly:grob-set-property! grob 'minimum-X-extent xex)
(ly:grob-set-property! grob 'stencil sten)))
#{ \tweak before-line-breaking #proc #music #})
squiggle = \markup
\override #'(height . 2)
\draw-squiggle-line #1 #'(8 . 0) ##f
\score {
\relative c' { c4 d \markupStencil \squiggle r }
}
%%%%
-- Aaron Hill