On Fri, Mar 13, 2015 at 3:34 PM, Stephen MacNeil <classicalja...@gmail.com>
wrote:

> \version "2.18.2"
>
>
> rotateBracket =
>
> #(define-music-function (parser location input) (pair?)
>
> #{
>
> \once \override HorizontalBracket.bracket-flare = $input
>
> #})
>

Actually I wanted to build the bracket flare from a single value, but I had
stripped away most of the code for the purposes of the question. I do a lot
of analytic music examples and for that I often angle the
HorizontalBrackets, but each time I rotate one it requires using
trigonometry (seriously) to calculate the right bracket-flare values, so I
just wanted to do that automatically. I eventually got something that
works. Here it is in case anyone is interested:

\version "2.18.2"

startAngledGroup =
#(define-event-function (parser location num)
   (integer?)
   (let* ((rot-angle (degrees->radians num))
          (left-flare (- (tan rot-angle)))
          (right-flare (tan rot-angle))
          (y-offset (- (/ num 10))))
     (define flare-callback
       (lambda (grob)
         (ly:grob-set-property! grob 'rotation (list num 0 0))
         (if (= UP (ly:grob-property grob 'direction))
              (ly:grob-set-property! grob 'bracket-flare (cons right-flare
left-flare))
              (ly:grob-set-property! grob 'bracket-flare (cons left-flare
right-flare)))))
     #{
       \single \override HorizontalBracket.before-line-breaking =
#flare-callback
       \startGroup
     #}))

\relative {
  b\startAngledGroup #10 e\stopGroup
}

\layout {
  \context {
    \Voice
    \consists "Horizontal_bracket_engraver"
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to