Salut Pierre,
thanks for your reply.
Unfortunately, changing the layer value from -10 to -2 doesn't help. The
problem is that the function places the staff lines and the colored
rectangle into the *same* layer, whereas I need to leave the staff lines
in layer 0 and put the rectangle into layer -2 (or even less).
This would allow me to put other clusters *between* them like in the
first example.
I have already found another interesting snippet:
http://lsr.di.unimi.it/LSR/Item?id=953
But in that case, I would have to find the dimensions for the rectangle
by trial-and-error, whereas overriding the StaffSymbol seems to be a
very easy way...
Cordialement,
Klaus Blum
Am 29.11.2014 um 10:05 schrieb Pierre Perol-Schneider:
Hi,
2014-11-29 1:15 GMT+01:00 Big Noise <benbigno...@gmx.de
<mailto:benbigno...@gmx.de>>:
Here is my problem:
Now the staff lines and the yellow rectangle are located in the
same layer, so it's not possible to place the blue cluster between
them.
Is there a way to make the scheme function put the staff lines
("StaffSymbol") and the yellow rectangle into different layers?
How about changing the layer value from -10 to -2 ?
bgColor =
#(define-music-function (parser location y-lower y-upper color)
(number? number? string?)
#{
\stopStaff
\override Staff.StaffSymbol.stencil =
$(lambda (grob)
(let* ((staff (ly:staff-symbol::print grob))
(X-ext (ly:stencil-extent staff X))
(Y-ext (ly:stencil-extent staff Y)))
(set! Y-ext (cons
(- (car Y-ext) y-lower)
(+ (cdr Y-ext) y-upper)))
;; change layer's value to -2
(ly:grob-set-property! grob 'layer -2)
(ly:stencil-add
(ly:make-stencil (list 'color (eval-string color)
(ly:stencil-expr (ly:round-filled-box
X-ext Y-ext 0))
X-ext Y-ext))
staff)))
\startStaff
#})
HTH
Pierre
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user