LilyPond Internals Reference: 2.2.70 Key_engraver

### 2.2.70 `Key_engraver`

Engrave a key signature.

Music types accepted: `key-change-event`

Properties (read)

`createKeyOnClefChange` (boolean)

  Print a key signature whenever the clef is changed.

`explicitKeySignatureVisibility` (vector)

  ‘`break-visibility`’ function for explicit key changes. ‘`\override`’ of the `break-visibility` property will set the visibility for normal (i.e., at the start of the line) key signatures.

`extraNatural` (boolean)

  Whether to typeset an extra natural sign before accidentals that reduce the effect of a previous alteration.

`forbidBreak` (boolean)

  If set to `#t`, prevent a line break at this point, except if explicitly requested by the user.

`forceBreak` (boolean)

  Set to `#t` when an event forcing a line break was heard.

`keyAlterationOrder` (list)

  A list of pairs that defines in what order alterations should be printed. The format of an entry is `(step . alter)`, where step is a number from 0 to 6 and alter from -1 (double flat) to 1 (double sharp), with exact rationals for alterations in between, e.g., 1/2 for sharp.

`keyAlterations` (list)

  The current key signature. This is an alist containing `(step . alter)` or `((octave . step) . alter)`, where step is a number in the range 0 to 6 and alter a fraction, denoting alteration. For alterations, use symbols, e.g., `keyAlterations = #`((6 . ,FLAT))`.

`lastKeyAlterations` (list)

  Last key signature before a key signature change.

`middleCClefPosition` (number)

  The position of the middle C, as determined only by the clef. This can be calculated by looking at `clefPosition` and `clefGlyph`.

`printKeyCancellation` (boolean)

  Print restoration alterations before a key signature change.

Properties (write)

`keyAlterations` (list)

  The current key signature. This is an alist containing `(step . alter)` or `((octave . step) . alter)`, where step is a number in the range 0 to 6 and alter a fraction, denoting alteration. For alterations, use symbols, e.g., `keyAlterations = #`((6 . ,FLAT))`.

`lastKeyAlterations` (list)

  Last key signature before a key signature change.

`tonic` (pitch)

  The tonic of the current scale.

This engraver creates the following layout object(s): `KeyCancellation` and `KeySignature`.

`Key_engraver` is part of the following context(s) in `\layout`: `GregorianTranscriptionStaff`, `InternalGregorianStaff`, `KievanStaff`, `MensuralStaff`, `PetrucciStaff`, `Staff` and `VaticanaStaff`.

#### LilyPond – Internals Reference v2.24.4 (stable-branch).