lilypond-user
[Top][All Lists]
Advanced

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

Re: Center graphical markup on staff


From: Nuno Trocado
Subject: Re: Center graphical markup on staff
Date: Tue, 22 Jun 2021 09:20:03 +0000

Works perfectly, thanks!

From: Aaron Hill <lilypond@hillvisions.com>
Sent: Tuesday, June 22, 2021 1:35 AM
To: Nuno Trocado <uiop99@hotmail.com>
Cc: lilypond-user@gnu.org <lilypond-user@gnu.org>
Subject: Re: Center graphical markup on staff
 
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

reply via email to

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