On Dec 2, 2012, at 6:49 PM, Thomas Morley <thomasmorle...@googlemail.com> wrote:

> You can distinguish KeySignature and KeyCancellation by 'name:
> 
> \version "2.16.1"
> 
> #(define Custom_key_engraver
>  (make-engraver
>    (acknowledgers
>      ((key-signature-interface engraver grob source-engraver)
>        (let ((grob-name (lambda (x) (assq-ref (ly:grob-property x
> 'meta) 'name))))
> 
>        ;; For testing:
>        ;; (newline)(write (grob-name grob))
>        ;; (if (eq? 'KeySignature (grob-name grob))
>        ;;   (ly:grob-set-property! grob 'color red)
>        ;;   (ly:grob-set-property! grob 'color green))
> 
>        (if (eq? 'KeySignature (grob-name grob))
>          (ly:grob-set-property! grob 'stencil (make-circle-stencil .7 .3 #f))
>          (ly:grob-set-property! grob 'stencil #f)))))))
> 
> music = \relative c' {
>  \time 1/4
>  \key a \major
>  d4
>  \key f \major
>  d
>  \key a \major
>  d
>  \key f \major
>  d
>  \key a \major
>  d
>  \break
>  \key c \major
>  d
>  \key a \major
>  d
>  \key c \major
>  d
> }
> 
> \score
> {
>  <<
>  \new Staff { \music }
>  \new Staff \with { \consists \Custom_key_engraver }
>  { \music }
>  >>
>  \layout { }
> }
> 
> HTH,
>  Harm

Thanks Harm!  Now it seems kind of obvious that the 'name of the grob 
differentiates them. (Although I would not have known exactly how to access the 
'name without help, even if I'd known that was what was needed).

Thanks again,
-Paul 



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

Reply via email to