Hi,

I'm trying to read out the current height of a StaffGroup, i.e. from
the bottom-line of the bottom-staff up to the top-line of the
top-staff.

As a test I created a new BreathingSign-stencil drawing a line from
top-line to bottom-line. The value for draw-line is figured out
manually for now. Of course I want to automate this.

\version "2.15.38"

#(define ((staff-group-height number) grob)
     (let* ((stil (ly:text-interface::print grob))
            (par1 (ly:grob-parent grob Y))      ;; #<Grob VerticalAxisGroup >
            (par2 (ly:grob-parent par1 Y))      ;; #<Grob VerticalAlignment >
            (par3 (ly:grob-parent par2 Y))      ;; #<Grob System >
            )

     ;(newline)(display "par1 ")(display par1)

     (ly:grob-set-property! grob 'stencil
       (grob-interpret-markup grob
           (make-line-markup
             (list
                 (make-with-dimensions-markup '(0 . 0) '(0 . 0)
                   (make-with-color-markup blue
                     (make-draw-line-markup (cons 0 number))))))))))

%--------- Test

one = {
        \relative c' {
                a2 b
                \override Score.BreathingSign #'after-line-breaking =
                        #(staff-group-height -13)
                c\breathe d \break
                a,, b''
                \override Score.BreathingSign #'after-line-breaking =
                        #(staff-group-height -22.5)
                c\breathe d
        }
}

two = {
        \relative c {
                \clef bass
                a2 b c d a'' b,, c d
        }
}

\score {
        \new StaffGroup <<
           \new Staff \one
           \new Staff \two
           >>
}

I don't know which grob/item/stencil I should adress to catch the
needed value and how.

Any hint would be appreciated.

Thanks,
  Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to