Hi Harm,

On Sun, Feb 4, 2018 at 6:23 PM, Thomas Morley <thomasmorle...@gmail.com> wrote:
> Hi David,
>
> I was going to post something similiar.
> You're code is much more elegant with respect to linebreaks, great stuff.
> Though, it will not work as desired if the beam/hairpin is distributed
> over _three_ lines.
> I've no clue how to make it work, admittedly it's a real rare case.

Yeah, that thought occurred to me after I sent it, though I figured no
one would notice :)

Thanks so much for the improvements!  I'm sure I will find another
opportunity to use ly:angle.

Here is a possibility for multiple line spanners incorporating your changes:

\version "2.19.65"

#(define test
   (lambda (grob)
     (let* ((lb (ly:spanner-bound grob LEFT))
            (rb (ly:spanner-bound grob RIGHT))
            (stil (ly:hairpin::print grob))
            (bound
             (find (lambda (b)
                     (grob::has-interface b 'note-column-interface))
               (list lb rb)))
            (beam
             (if bound
                 (ly:grob-object (ly:grob-object bound 'stem) 'beam)
                 (let* ((col (ly:item-get-column lb))
                        (elts (ly:grob-array->list
                               (ly:grob-object col 'bounded-by-me))))
                   (find (lambda (e) (grob::has-interface e 'beam-interface))
                     elts)))))
       (if (ly:grob? beam)
           (let* ((X-pos (ly:grob-property beam 'X-positions))
                  (Y-pos (ly:grob-property beam 'positions))
                  (ang (ly:angle (- (cdr X-pos) (car X-pos))
                         (- (cdr Y-pos) (car Y-pos)))))
             (ly:stencil-rotate
              stil ang CENTER CENTER))
           stil))))

{
  \time 1/4 \override Hairpin.stencil = #test
  c'16\< e' g' b'\!
  b'16\< g' e' c'\!
  \once \offset positions #'(0 . 3) Beam
  c'16^\< e' g' b'\!

  \override Beam.breakable = ##t
  c'16[\< e' g' b'
  \break c' e' g' b'
  \break b' g' e' c'
  \break b' g' e' c']\!
}

-David

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

Reply via email to