]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/programming-interface.itely
Remainder of info from NEWS.
[lilypond.git] / Documentation / user / programming-interface.itely
index e282f754f11a12da849dd431e1560f311f5e5571..4bc023aab23bb231226d5eb482593dc093aec572 100644 (file)
@@ -12,6 +12,7 @@ not familiar with Scheme, you may wish to read our
 * Building complicated functions::  
 * Markup programmer interface::  
 * Contexts for programmers::    
+* Scheme procedures as properties::
 @end menu
 
 
@@ -23,7 +24,7 @@ This section discusses how to create music functions within LilyPond.
 @menu
 * Overview of music functions::  
 * Simple substitution functions::  
-* Paired substition functions::  
+* Paired substitution functions::  
 * Mathematics in functions::    
 * Void functions::              
 @end menu
@@ -31,7 +32,7 @@ This section discusses how to create music functions within LilyPond.
 @node Overview of music functions
 @subsection Overview of music functions
 
-Making a funcion which substitutes a variable into LilyPond
+Making a function which substitutes a variable into LilyPond
 code is easy.  The general form of these functions is
 
 @example
@@ -133,8 +134,8 @@ g c
 @end lilypond
 
 
-@node Paired substition functions
-@subsection Paired substition functions
+@node Paired substitution functions
+@subsection Paired substitution functions
 
 Some @code{\override} commands require a pair of numbers
 (called a @code{cons cell} in Scheme).  To pass these numbers
@@ -315,7 +316,7 @@ written as
 @end example
 
 Scheme code is evaluated as soon as the parser encounters it.  To
-define some scheme code in a macro (to be called later), use
+define some Scheme code in a macro (to be called later), use
 @ref{Void functions} or
 
 @example
@@ -356,7 +357,7 @@ available is in the Program reference manual, under
 interfaces, for example, a note is an @code{event}, but it is also a
 @code{note-event}, a @code{rhythmic-event}, and a
 @code{melodic-event}.  All classes of music are listed in the
-Profram reference, under
+Program reference, under
 @internalsref{Music classes}.
 
 @item
@@ -400,8 +401,8 @@ to create complicated music functions.
 @subsection Displaying music expressions
 
 @cindex internal storage
-@findex \displayMusic
-@findex \displayLilyMusic
+@funindex \displayMusic
+@funindex \displayLilyMusic
 
 When writing a music function it is often instructive to inspect how
 a music expression is stored internally.  This can be done with the
@@ -487,7 +488,7 @@ someNote = c'
 @end example
 
 The @code{display-scheme-music} function is the function used by
-@code{\displayMusic} to display the scheme representation of a music
+@code{\displayMusic} to display the Scheme representation of a music
 expression.
 
 @example
@@ -501,7 +502,7 @@ expression.
   (ly:make-pitch 0 0 0))
 @end example
 
-Then the note pitch is accessed thourgh the @code{'pitch} property
+Then the note pitch is accessed through the @code{'pitch} property
 of the @code{NoteEvent} object,
 
 @example
@@ -717,7 +718,7 @@ function).  Recall that our purpose is to add a marcato to an
 used elsewhere.
 
 Now we have a @code{result-event-chord}, which is a
-@code{oteEventChord} expression and is a copy of @code{event-chord}.  We
+@code{NoteEventChord} expression and is a copy of @code{event-chord}.  We
 add the marcato to its elements list property.
 
 @example
@@ -826,7 +827,7 @@ LilyPond markup syntax and Scheme markup syntax.
 @end multitable
 @end quotation
 
-The whole scheme language is accessible inside the
+The whole Scheme language is accessible inside the
 @code{markup} macro.  For example, You may use function calls inside
 @code{markup} in order to manipulate character strings.  This is
 useful when defining new markup commands (see
@@ -892,7 +893,7 @@ of this section, and in @file{scm/@/define@/-markup@/-commands@/.scm}.
 @subsection New markup command definition
 
 New markup commands can be defined
-with the @code{define-markup-command} scheme macro.
+with the @code{define-markup-command} Scheme macro.
 
 @lisp
 (define-markup-command (@var{command-name} @var{layout} @var{props} @var{arg1} @var{arg2} ...)
@@ -1066,7 +1067,7 @@ be used to set text in small caps.  See
 @subsection Context evaluation
 
 @cindex calling code during interpreting
-@findex \applyContext
+@funindex \applyContext
 
 Contexts can be modified during interpretation with Scheme code.  The
 syntax for this is
@@ -1092,7 +1093,7 @@ current bar number on the standard output during the compile:
 
 
 @cindex calling code on layout objects
-@findex \applyOutput
+@funindex \applyOutput
 
 
 The most versatile way of tuning an object is @code{\applyOutput}.  Its
@@ -1131,3 +1132,39 @@ note-heads on the center-line:
      (set! (ly:grob-property grob 'transparent) #t)))
 @end example
 
+
+@node Scheme procedures as properties
+@section Scheme procedures as properties
+
+Properties (like thickness, direction, etc.) can be set at fixed values
+with \override, e.g.
+
+@example
+\override Stem #'thickness = #2.0
+@end example
+
+Properties can also be set to a Scheme procedure,
+
+@lilypond[fragment,verbatim,quote,relative=2]
+\override Stem #'thickness = #(lambda (grob)
+    (if (= UP (ly:grob-property grob 'direction))
+        2.0
+        7.0))
+c b a g b a g b
+@end lilypond
+
+Procedures may also be combined like that with
+"grob closure".  Here is a setting from
+@code{AccidentalSuggestion},
+
+@example
+(X-offset .
+  ,(ly:make-simple-closure
+    `(,+
+        ,(ly:make-simple-closure
+           (list ly:self-alignment-interface::centered-on-x-parent))
+      ,(ly:make-simple-closure
+           (list ly:self-alignment-interface::x-aligned-on-self)))))
+@end example
+
+