+Musicians are usually more absorbed with performing than with studying
+the looks of piece of music, so nitpicking about typographical details
+may seem academical. But it is not. In larger pieces with monotonous
+rhythms, spacing corrections lead to subtle variations in the layout
+of every line, giving each one a distinct visual signature. Without
+this signature all lines would look the same, and they become like a
+labyrinth. If the musician looks away once or has a lapse in his
+concentration, he will be lost on the page.
+@c he/she
+
+Similarly, the strong visual look of bold symbols on heavy staff lines
+stands out better when music is far away from reader, for example, if
+it is on a music stand. A careful distribution of white space allows
+music to be set very tightly without cluttering symbols together. The
+result minimizes the number of page turns, which is a great advantage.
+
+This is a common characteristic of typography. Layout should be
+pretty, not only for its own sake, but especially because it helps the
+reader in his task. For performance material like sheet music, this is
+of double importance: musicians have a limited amount of attention. The
+less attention they need for reading, the more they can focus on
+playing itself. In other words, better typography translates to better
+performances.
+
+These examples demonstrate that music typography is an art that is
+subtle and complex, and that producing it requires considerable
+expertise, which musicians usually do not have. LilyPond is our
+effort to bring the graphical excellence of hand-engraved music to the
+computer age, and make it available to normal musicians. We have
+tuned our algorithms, font-designs, and program settings to produce
+prints that match the quality of the old editions we love to see and
+love to play from.
+
+
+
+
+@node Automated engraving
+@section 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 completely. 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:
+
+@itemize @bullet
+@item When LilyPond makes mistakes,
+users need to override formatting decisions. Therefore, the user must
+have access to the formatting engine. Hence, rules and settings cannot
+be fixed by us at compile time but must be accessible for users at
+run-time.
+
+@item Engraving is a matter of visual judgment, and therefore a matter of
+taste. As knowledgeable as we are, users can disagree with our
+personal decisions. Therefore, the definitions of typographical style
+must also be accessible to the user.
+
+@item Finally, we continually refine the formatting algorithms, so we
+need a flexible approach to rules. The C++ language forces a certain
+method of grouping rules that do not match well with how music
+notation works.
+@end itemize
+
+These problems have been addressed by integrating an interpreter for
+the Scheme programming language and rewriting parts of LilyPond in
+Scheme. The current formatting architecture 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).
+
+@lilypond[quote,raggedright,relative=1,fragment]
+\new Score \with {
+ \override SpacingSpanner #'spacing-increment = #3
+ \override TimeSignature #'transparent = ##t
+ } {
+ \stemDown <e g b>4_>-\arpeggio
+ \override Arpeggio #'direction = #RIGHT
+ \stemUp <e g b>4^>-\arpeggio
+}
+@end lilypond
+
+@noindent
+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 not fixed.
+They are variables, and altering them gives a different typographical
+impression.
+
+@lilypond[quote,raggedright]
+fragment = {
+ \clef bass f8 as8
+ c'4-~ c'16 as g f e16 g bes c' des'4
+}
+
+ <<
+ \new Staff \fragment
+ \new Staff \with {
+ \override Beam #'thickness = #0.3
+ \override Stem #'thickness = #0.5
+ \override Bar #'thickness = #3.6
+ \override Tie #'thickness = #2.2
+ \override StaffSymbol #'thickness = #3.0
+ \override Tie #'extra-offset = #'(0 . 0.3)
+ } \fragment
+ >>
+@end lilypond
+
+Formatting rules are also preset variables: each object has variables
+containing procedures. These procedures perform the actual
+formatting, and by substituting different ones, we can change the
+appearance of objects. In the following example, the rule which note
+head objects use to produce their symbol is changed during the music
+fragment.
+
+@lilypond[quote,raggedright]
+#(define (mc-squared grob orig current)
+ (let ((interfaces (ly:grob-property grob 'interfaces))
+ (pos (ly:grob-property grob 'staff-position)))
+ (if (and (memq 'note-head-interface interfaces)
+ (memq pos '(-2 -3 -5)))
+ (begin
+ (ly:grob-set-property! grob 'print-function brew-new-markup-stencil)
+ (ly:grob-set-property! grob 'font-family 'roman)
+ (ly:grob-set-property!
+ grob 'text
+ (make-raise-markup
+ -0.5
+ (case pos
+ ((-5) (make-simple-markup "m"))
+ ((-3) (make-simple-markup "c "))
+ ((-2) (make-smaller-markup (make-bold-markup "2")))
+ (else (make-simple-markup "bla")))))))))
+
+ \context Voice \relative c' {
+ \stemUp
+ \set autoBeaming = ##f
+ \time 2/4
+ <d f g>4
+ \once \override NoteHead #'print-function = #Note_head::brew_ez_stencil
+ <d f g>
+ \once \override NoteHead #'style = #'cross
+ <d f g>
+ \applyoutput #mc-squared
+ <d f g>
+ <<
+ { d8[ es-( fis^^ g] fis2-) }
+ \repeat unfold 5 { \applyoutput #mc-squared s8 }
+ >>
+ }
+@end lilypond
+
+