lilypond-user
[Top][All Lists]
Advanced

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

Re: printKeyCancellation, a way to never show key cancellations?


From: Paul Morris
Subject: Re: printKeyCancellation, a way to never show key cancellations?
Date: Mon, 3 Dec 2012 00:47:21 -0500

On Dec 2, 2012, at 6:49 PM, Thomas Morley <address@hidden> 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 





reply via email to

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