Next: , Previous: Engraving, Up: Introduction



1.2 Automated engraving

How do we go about implementing typography? If craftsmen need over ten years to become true masters, how could we simple hackers ever write a program to take over their jobs?

The answer is: we cannot. Typography relies on human judgment of appearance, so people cannot be replaced ultimately. However, much of the dull work can be automated. If LilyPond solves most of the common situations correctly, this will be a huge improvement over existing software. The remaining cases can be tuned by hand. Over the course of years, the software can be refined to do more and more automatically, so manual overrides are less and less necessary.

When we started we wrote the LilyPond program entirely in the C++ programming language, the program's functionality was set in stone by the developers. That proved to be unsatisfactory for a number of reasons:

These problems have been addressed by integrating the GUILE interpreter for the Scheme programming language and rewriting parts of LilyPond in Scheme. The new, flexible formatting is built around the notion of graphical objects, described by Scheme variables and functions. This architecture encompasses formatting rules, typographical style and individual formatting decisions. The user has direct access to most of these controls.

Scheme variables control layout decisions. For example, many graphical objects have a direction variable that encodes the choice between up and down (or left and right). Here you see two chords, with accents and arpeggio. In the first chord, the graphical objects have all directions down (or left). The second chord has all directions up (right).

[image of music]

The process of formatting a score consists of reading and writing the variables of graphical objects.

Some variables have a preset value. For example, the thickness of many lines—a characteristic of typographical style—are preset variables. Changing them gives a different typographical impression

[image of music]

Formatting rules are also preset variables: each object has variables containing procedures. These procedure perform the actual formatting, and by substituting different ones, we can change behavior. In the following example, the rule that note head objects use to produce their symbol is changed during the music fragment

[image of music]

Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.