[icon]

GNU LilyPond

Welcome to the home of the GNU Music Typesetter

What is LilyPond
General information
Simple examples
Complex examples
Download
GNU/Linux binaries
Windows
Source code
Documentation
Tutorial
Manual
Glossary
other ...

Support
Mailing lists
Search
WikiWiki
FAQs

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

Node:Defining new contexts, Previous:Changing context definitions, Up:Interpretation context



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 cooperation module that should be in the top level context, and only the top level context.
Grace_engraver_group This is a special
cooperation module (resembling Score_engraver ) that is used to create an embedded `miniscore'.

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 lilypond@packages.debian.org

Copyright (c) 1997--2001 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.4.12 (stable-branch) by

Anthony Fok <lilypond@packages.debian.org>, Tue Mar 12 01:35:39 2002 HKT.