lilypond-learning: Engravers explained

 
 3.3.3 Engravers explained
 -------------------------
 
 Every mark on the printed output of a score produced by LilyPond is
 produced by an ‘Engraver’.  Thus there is an engraver to print staves,
 one to print note heads, one for stems, one for beams, etc, etc.  In
 total there are over 120 such engravers!  Fortunately, for most scores
 it is not necessary to know about more than a few, and for simple scores
 you do not need to know about any.
 
    Engravers live and operate in Contexts.  Engravers such as the
 ‘Metronome_mark_engraver’, whose action and output apply to the score as
 a whole, operate in the highest level context – the ‘Score’ context.
 
    The ‘Clef_engraver’ and ‘Key_engraver’ are to be found in every
 ‘Staff’ Context, as different staves may require different clefs and
 keys.
 
    The ‘Note_heads_engraver’ and ‘Stem_engraver’ live in every ‘Voice’
 context, the lowest level context of all.
 
    Each engraver processes the particular objects associated with its
 function, and maintains the properties that relate to that function.
 These properties, like the properties associated with contexts, may be
 modified to change the operation of the engraver or the appearance of
 those elements in the printed score.
 
    Engravers all have compound names formed from words which describe
 their function.  Just the first word is capitalized, and the remainder
 are joined to it with underscores.  Thus the ‘Staff_symbol_engraver’ is
 responsible for creating the lines of the staff, the ‘Clef_engraver’
 determines and sets the pitch reference point on the staff by drawing a
 clef symbol.
 
    Here are some of the most common engravers together with their
 function.  You will see it is usually easy to guess the function from
 the name, or vice versa.
 
 Engraver               Function
 --------------------------------------------------------------------------
 Accidental_engraver    Makes accidentals, cautionary and suggested
                        accidentals
 Beam_engraver          Engraves beams
 Clef_engraver          Engraves clefs
 Completion_heads_engraverSplits notes which cross bar lines
 Dynamic_engraver       Creates hairpins and dynamic texts
 Forbid_line_break_engraverPrevents line breaks if a musical element is
                        still active
 Key_engraver           Creates the key signature
 Metronome_mark_engraverEngraves metronome marking
 Note_heads_engraver    Engraves note heads
 Rest_engraver          Engraves rests
 Staff_symbol_engraver  Engraves the five (by default) lines of the
                        staff
 Stem_engraver          Creates stems and single-stem tremolos
 Time_signature_engraverCreates time signatures
 
 
    We shall see later how the output of LilyPond can be changed by
 modifying the action of Engravers.
 
 
 See also
 ........
 
    Internals reference: See(lilypond-internals)Engravers and
 Performers.