Hi, Harm --

On Sun, Oct 16, 2011 at 10:27 AM, harm6 <thomasmorle...@googlemail.com>wrote:
>
>
> In the little test-function below I have to put in the beam-count manually.
> And the value of the between-beam-space is a guess.
>
> Any hint to improve?
>

You can get the space between the beams from the 'gap property.  (It's
measured in half staff-spaces, so this value needs to be halved.)  Also, you
can get the number of beams through the 'beaming property.  Here I've gotten
the beam-count from the first stem.

I hope this helps!

\version "2.14.2"

#(define ((stencil-plus-bracket beam-count) grob)
 (let* ((beam (ly:beam::print grob))
        (beam-count (length (cdr (ly:grob-property (ly:grob-parent grob X)
'beaming))))
        (beam-positions (ly:grob-property grob 'positions))
        (gap (* 0.5 (ly:grob-property grob 'gap)))
        (single-beam-thickness (ly:grob-property grob 'beam-thickness))
        (whole-beam-thickness
          (+ (* beam-count single-beam-thickness)(* (- beam-count 1) gap)))
        (bracket (ly:bracket Y (cons (* -0.5 whole-beam-thickness) (* 0.5
whole-beam-thickness)) 0.05 0.4)))

 (ly:stencil-add
   beam
   (ly:stencil-in-color
     (ly:stencil-translate
       bracket
       (cons -1 (- (car beam-positions) (* 0.38 whole-beam-thickness))))
   1 0 0))
     ))

\relative c' {
       \stemUp
       \once\override Beam #'stencil = #stencil-plus-bracket
       f'32 [f f f]
       \once\override Beam #'stencil = #stencil-plus-bracket
       f16 [f f f]
       \once\override Beam #'stencil = #stencil-plus-bracket
       f64 [f f f]
}

Best,

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

Reply via email to