lilypond-user
[Top][All Lists]
Advanced

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

my barline "split arrows" function needs improvement


From: Kieren MacMillan
Subject: my barline "split arrows" function needs improvement
Date: Sat, 3 Jun 2017 15:09:57 -0400

Hello all,

In the snippet included below, I show how I use angled arrows to indicate a 
staff will split into multiple staves after the system break.
(Note: It doesn't actually happen here, since I wanted my WE to be reasonably 
M!)

The problem is, the function attaches the arrows to the carline, which fails in 
the case of cautionary signatures (see second system). I tried attaching the 
arrows to the StaffSymbol — that seems the most elegant solution — but my 
attempt didn't work.

Would love help on fixing this snippet so that it always Does The Right Thing™.

Thanks!
Kieren.

%%%%  SNIPPET BEGINS
\version "2.19.60"

#(define-markup-command (arrow-at-angle layout props angle-deg length fill)
   (number? number? boolean?)
   (let* (
           (PI-OVER-180 (/ (atan 1 1) 34))
           (degrees->radians (lambda (degrees) (* degrees PI-OVER-180)))
           (angle-rad (degrees->radians angle-deg))
           (target-x (* length (cos angle-rad)))
           (target-y (* length (sin angle-rad))))
     (interpret-markup layout props
       (markup
        #:translate (cons (/ target-x 2) (/ target-y 2))
        #:rotate angle-deg
        #:translate (cons (/ length -2) 0)
        #:concat (#:draw-line (cons length 0)
                   #:hspace -0.125
                   #:arrow-head X RIGHT fill)))))

splitStaffBarLineMarkup =
\markup
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \override #'(thickness . 1.5) {
    \concat
    {
      \hspace #0.375
      \combine
        \raise #0.4 \arrow-at-angle #30 #(sqrt 4) ##t
        \lower #0.4 \arrow-at-angle #-30 #(sqrt 4) ##t
    }
  }

splitStaffBarLine = {
  \override Staff.BarLine.stencil =
    #(lambda (grob)
       (ly:stencil-combine-at-edge
        (ly:bar-line::print grob)
        X RIGHT
        (grob-interpret-markup grob splitStaffBarLineMarkup)
        0))
  \break
}

{
  \splitStaffBarLine
  c''1 \break
  c''1 \break
  \time 3/4 c''2.
}
%%%%  SNIPPET ENDS
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: address@hidden




reply via email to

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