Hi Mike,
2011/11/7 [email protected] <[email protected]>
> (...)
>
> The function will be consistent if you hijack a different property. To
> wit, quantized-positions. By the time you call ly:beam::print, the stencil
> values for the stem may have already been cached, in which case they will
> not be recalculated for length.
>
> Cheers,
> MS
>
> \version "2.15.16"
>
> #(set-global-staff-size 20)
>
> #(define ((stem-change y) grob)
> (let ((pos (ly:beam::set-stem-lengths grob)))
> (begin
> (ly:grob-set-property! grob 'color red)
> (map
> (lambda (n)
> (ly:grob-set-property! n 'length y))
> (ly:grob-array->list (ly:grob-object grob 'stems))))
> pos))
>
> %---- Test
>
> top = \change Staff = "1"
> bottom = \change Staff = "2"
>
> music = \relative c {
>
> \override Beam #'auto-knee-gap = #0
>
> \override Beam #'quantized-positions = #(stem-change 20)
>
> \bottom c32[ g' \top eis'']
> c[ b \bottom g,]
> \top e''[ \bottom c,, \top g'']
> \bottom c,,64[ \top g'' e' \bottom c,, \top c'']
> f,,32 [f''' f,,, f''']
> }
>
> \score {
> \new PianoStaff <<
> \new Staff = "1" {
> s4 s8 s16
> }
> \new Staff = "2" {
> \clef bass
> \music
> }
> >>
> }
>
> many thanks. Now it works fine.
But using the 'quantized-positions-property, I've no success with
integrating a new stencil. Trying the following, I retrieve always the new
stem-length, though, the "dummy-stencil" isn't printed every time.
How to do?
\version "2.15.13"
#(define (dummy-stencil grob)
(grob-interpret-markup grob (markup #:with-color red #:rotate 10
"test-dummy")))
#(define ((stem-change y) grob)
(let ((pos (ly:beam::set-stem-lengths grob)))
(begin
(map
(lambda (n)
(ly:grob-set-property! n 'length y))
(ly:grob-array->list (ly:grob-object grob 'stems)))
(ly:grob-set-property! grob 'stencil dummy-stencil)
)
pos))
%---- Test
\relative c' {
\override Beam #'quantized-positions = #(stem-change 20)
c32[ d e f g a b c] s128
c,32[ d e f g a b c] s128
}
top = \change Staff = "1"
bottom = \change Staff = "2"
music = \relative c {
\override Beam #'auto-knee-gap = #0
\override Beam #'quantized-positions = #(stem-change 20)
\bottom c32[ g' \top eis'']
c[ b \bottom g,]
\top e''[ \bottom c,, \top g'']
\bottom c,,64[ \top g'' e' \bottom c,, \top c'']
f,,32 [f''' f,,, f'''] c,,32[ d e f g a b c]
}
\score {
\new PianoStaff <<
\new Staff = "1" {
s4 s8 s16 s4
}
\new Staff = "2" {
\clef bass
\music
}
>>
}
Best,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user