[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Defining new contexts

If you want to build a context from scratch, you must also supply the following extra information:

  • A name, specified by \name contextname.
  • A cooperation module. This is specified by \type typename.

This is an example:

     \translator 
       \type "Engraver_group_engraver"
       \name "SimpleStaff"
       \alias "Staff"
       \consists "Staff_symbol_engraver"
       \consists "Note_head_engraver"
       \consistsend "Axis_group_engraver"
      

The argument of \type is the name for a special engraver that handles cooperation between simple engravers such as Note_head_engraver and Staff_symbol_engraver. Alternatives for this engraver are the following:


Engraver_group_engraver
The standard cooperation engraver.
Score_engraver
This is a cooperation module that should be in the top level context.

Other modifiers are

  • \alias alternate-name: This specifies a different name. In the above example, \property Staff.X = Y will also work on SimpleStaffs
  • \consistsend engravername: Analogous to \consists, but makes sure that engravername is always added to the end of the list of engravers.

    Some engraver types need to be at the end of the list; this insures they stay there even if a user adds or removes engravers. End-users generally don't need this command.

  • \accepts contextname: Add contextname to the list of contexts this context can contain in the context hierarchy. The first listed context is the context to create by default.
  • \denies: The opposite of \accepts. Added for completeness, but is never used in practice.
  • \name contextname: This sets the type name of the context, e.g. Staff , Voice . If the name is not specified, the translator won't do anything.

In the \paper block, it is also possible to define translator identifiers. Like other block identifiers, the identifier can only be used as the very first item of a translator. In order to define such an identifier outside of \score, you must do

     \paper {
       foo = \translator { ... }
     }
     \score {
       \notes {
         ...
       }
       \paper {
         \translator { \foo ... }
       }
     }
     
Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.