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: Sun, 2 Dec 2012 14:45:07 -0500

On Dec 2, 2012, at 1:16 PM, Thomas Morley <address@hidden> wrote:

> 2012/12/2 Paul Morris <address@hidden>:
>> Hi everyone,  I am using
>>  \set Staff.printKeyCancellation = ##f
>> to not show the key cancellation when you change keys[1].  But I found that 
>> this does not hide the key cancellation when you change back to C major or A 
>> minor[2] (presumably since that would leave no indication of a key change at 
>> all).
>> 
>> But I am using non-standard key signatures that make all key cancellations 
>> unnecessary, so I want to never show them, even when changing to C major / A 
>> minor.
>> 
>> 
>> JUST A THOUGHT
>> For greater flexibility, would it make sense for PrintKeyCancellation to 
>> have 3 options instead of 2?
>> 
>>  1. show key cancellations
>>  2. hide key cancellations, except C major / A minor
>>  3. hide all key cancellations
>> 
>> 
>> OR A DOCUMENTATION SUGGESTION
>> In any case it would be helpful to mention this C major / A minor exception 
>> on the page documenting this option.[1]  Something like:
>> 
>> "(Note that setting the Staff context property printKeyCancellation to #f 
>> does _not_ remove cautionary accidentals when changing to a key with no 
>> sharps or flats (C major / A minor), since that would leave no indication of 
>> a key change.)"
>> 
>> Also, the example on that page concludes with: "With these overrides only 
>> the accidentals before the notes remain to indicate the change of key."  
>> ...which is not completely true, unless you add something like "(unless you 
>> have just changed to C major / A minor)".
>> 
>> 
>> A WORKAROUND FROM THE ARCHIVES (ALMOST)
>> So I searched the lilypond-user archives and found a few instances where 
>> this has come up, and a suggested workaround[3]:
>> 
>>  \once \override Staff.KeyCancellation #'stencil = ##f
>> 
>> This works!  ...except it does not seem to work when using a custom key 
>> signature engraver.  Here is a tiny example that just shows a circle as a 
>> custom key signature (of course, this is not what I actually use).
>> 
>> \version "2.16.1"
>> 
>> #(define Custom_key_engraver
>>  (make-engraver
>>    (acknowledgers
>>      ((key-signature-interface engraver grob source-engraver)
>>        (ly:grob-set-property! grob 'stencil (make-circle-stencil .7 .3 
>> #f))))))
>> 
>> music = \relative c' {
>>  \time 1/4
>>  \key a \major
>>  d4
>>  \key f \major
>>  d
>> 
>>  \set Staff.printKeyCancellation = ##f
>>  \key a \major
>>  d
>>  \key f \major
>>  d
>>  \key a \major
>>  d
>>  \key c \major
>>  d
>> 
>>  \override Staff.KeyCancellation #'stencil = ##f
>>  \override CustomStaff.KeyCancellation #'stencil = ##f
>>  \key a \major
>>  d
>>  \key c \major
>>  d
>> }
>> 
>> \score
>> {
>>  <<
>>  \new Staff { \music }
>>  \new Staff \with { \consists \Custom_key_engraver } { \music }
>>>> 
>>  \layout { }
>> }
>> 
>> The problem can be seen in the last measure where two circles are printed, 
>> one for the key cancellation and one for the key of C, whereas no key 
>> cancellation is printed on the standard staff.
>> 
>> I realize I am off in the land of non-standard customizations, but does 
>> anyone have any suggestions?  Is there a way to get such a custom key 
>> signature engraver to recognize and follow this override?
>> 
>> Cheers,
>> -Paul
>> 
>> [1] See "Visibility of cautionary accidentals" section:
>> http://www.lilypond.org/doc/v2.16/Documentation/notation/visibility-of-objects#special-considerations
>> 
>> [2]
>> \version "2.16.1"
>> \relative c' {
>>  \time 1/4
>>  \key a \major
>>  d4
>>  \key f \major
>>  d
>>  \set Staff.printKeyCancellation = ##f
>>  \key a \major
>>  d
>>  \key f \major
>>  d
>>  \key a \major
>>  d
>>  \key c \major
>>  d
>> }
>> 
>> [3] http://lists.gnu.org/archive/html/lilypond-user/2012-05/msg00749.html
>> _______________________________________________
>> lilypond-user mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
> 
> How about adding
> \override Staff.KeyCancellation #'break-visibility = #'#(#f #f #f)
> to your score?
> Seems to work.

Thanks Harm!  That looks like it does the trick!  And thanks David for the tip.

Hmmm... maybe it would make sense to add "KeyCancellation" to the list of 
layout objects that are affected by break-visibility in the documentation here:

http://www.lilypond.org/doc/v2.16/Documentation/notation/visibility-of-objects#using-break_002dvisibility

Cheers,
-Paul


reply via email to

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