lilypond-common-includes/arrows_in_scores.ly

63 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

%%%%%%%%%%%%%%%%% Pfeilezeugs
% http://lilypond.org/doc/v2.19/Documentation/snippets/vocal-music
#(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)
#:arrow-head X RIGHT fill)))))
splitStaffBarLineMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) {
\combine
\arrow-at-angle #45 #(sqrt 8) ##t
\arrow-at-angle #-45 #(sqrt 8) ##t
}
splitStaffBarLine = {
\once \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
}
convDownStaffBarLine = {
\once \override Staff.BarLine.stencil =
#(lambda (grob)
(ly:stencil-combine-at-edge
(ly:bar-line::print grob)
X RIGHT
(grob-interpret-markup grob #{
\markup\with-dimensions #'(0 . 0) #'(0 . 0) {
\translate #'(0 . -.13)\arrow-at-angle #-45 #(sqrt 8) ##t
}#})
0))
\break
}
convUpStaffBarLine = {
\once \override Staff.BarLine.stencil =
#(lambda (grob)
(ly:stencil-combine-at-edge
(ly:bar-line::print grob)
X RIGHT
(grob-interpret-markup grob #{
\markup\with-dimensions #'(0 . 0) #'(0 . 0) {
\translate #'(0 . .14)\arrow-at-angle #45 #(sqrt 8) ##t
}#})
0))
\break
}