lilypond-user
[Top][All Lists]
Advanced

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

ly:stencil-extent gives not the exact value?


From: harm6
Subject: ly:stencil-extent gives not the exact value?
Date: Sat, 22 Oct 2011 09:35:12 -0700 (PDT)

Hi,

the following function should rebuild a beam. 

\version "2.14.2"

#(set-global-staff-size 20)

#(define (test-stencil grob)
 (let* ((beam (ly:beam::print grob))
        (beam-extent-x (ly:stencil-extent beam X))
        (beam-length-x (interval-length beam-extent-x))         
        (single-beam-thickness (ly:grob-property grob 'beam-thickness))
        (beam-positions (ly:grob-property grob 'positions))
        (mrkp (markup #:beam    (* beam-length-x 0.97)  ;; why??
                        0               ;; level Beams only!
                        single-beam-thickness))
        (new-Beam (ly:stencil-in-color
                    (ly:stencil-translate-axis 
                      (ly:stencil-translate-axis 
                        (grob-interpret-markup grob mrkp)
                        -0.025 X)               ;; why??
                      (car beam-positions)
                      Y)
                      1 0 0)))

   new-Beam))

\relative c' {
  \override Beam #'layer = #-4
  \once \override Beam #'stencil = #test-stencil
  e'8 [e] 
  \override Beam #'color = #green
  f8 [f]
}

But I noticed two problems:
First I have to adjust the beam-length. (This needs to be done in addiction
to the global-staff-size.) Seems that ly:stencil-extent gives not the exact
value!?
What am I missing?

And second there's need to use ly:stencil-translate-axis to move the new
beam a little in X-axis-direction. But why?

Any hint is appreciated!

Cheers,
  Harm
-- 
View this message in context: 
http://old.nabble.com/ly%3Astencil-extent-gives-not-the-exact-value--tp32702114p32702114.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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