lilypond-user
[Top][All Lists]
Advanced

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

visualize-staff-padding (was \offset Y-offset)


From: Paolo Prete
Subject: visualize-staff-padding (was \offset Y-offset)
Date: Wed, 5 Feb 2020 21:54:43 +0100

Hello Aaron,

as you can see in the following code, your (great and useful) function, which visualizes the staff-padding of a grob, fails if I set an outside-staff-priority for a TupletBracket.

Is there a fix for this?

Thank you very much
Best,
Paolo


%%%%%%%%%%%%%%
#(define line-thickness 0.2)
#(define whiteout-thickness 1.5)

visualize-staff-padding = #(define-music-function
  (grob-path color) (symbol-list? color?)
  (define (proc grob)
    (let* ((orig (ly:grob-property grob 'stencil))
           (xex (ly:stencil-extent orig X))
           (dir (ly:grob-property grob 'direction))
           (y (ly:grob-property grob 'staff-padding)))
      (ly:grob-set-property! grob 'layer 1000)
      (ly:grob-set-property! grob 'stencil
        (grob-interpret-markup grob #{
          \markup \overlay {
            \stencil #orig
            \with-dimensions-from \null
            \translate #(cons (interval-index xex 0) 0)
            \overlay {
              \with-color #color
              \override #'(style . outline)
              \override #`(thickness . ,whiteout-thickness)
              \whiteout
              \scale #(cons 1 (- dir))
              \path #0.2 #`(
                (moveto 0 -2) (lineto 0 0)
                (moveto -0.5 -1) (lineto 0 0) (lineto 0.5 -1)
                (moveto -1 0) (lineto 1 0))

              \with-color #color
              \override #'(style . outline)
              \override #`(thickness . ,whiteout-thickness)
              \whiteout
              \scale #(cons 1 dir)
              \translate #(cons 0 (- y))
              \path #line-thickness #`(
                (moveto 0 -2) (lineto 0 0)
                (moveto -0.5 -1) (lineto 0 0) (lineto 0.5 -1)
                (moveto -1 0) (lineto 1 0))
            }
          } #}))))
  #{ \override $grob-path .after-line-breaking = #proc #})

{
  \once \override TupletBracket.outside-staff-priority = 1200
  \once \override TupletBracket.direction = #UP
  \visualize-staff-padding TupletBracket #red
  \tuplet 3/2 { c'''4 c'' c''}
}
%%%%%%%%%%%%%%

reply via email to

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