]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/changing-defaults.itely
* flower/include/std-string.hh:
[lilypond.git] / Documentation / user / changing-defaults.itely
index c6f94f01ec65083b10671411606690d21c09cd86..be62081aa053fdc42f420dc4d35c8f4482572cbf 100644 (file)
@@ -25,7 +25,7 @@ Program reference
 manual.  That manual
 lists all different variables, functions and options available in
 LilyPond.  It is written as a HTML document, which is available
-@uref{http://@/lilypond@/.org/@/doc/@/v2.5/@/Documentation/@/user/@/out@/-www/@/lilypond@/-internals/,on@/-line},
+@uref{http://@/lilypond@/.org/@/doc/@/v2.7/@/Documentation/@/user/@/lilypond@/-internals/,on@/-line},
 but is also included with the LilyPond documentation package.
 
 There are three areas where the default settings may be changed:
@@ -153,7 +153,7 @@ A practical application of @code{\new} is a score with many
 staves.  Each part that should be on its own staff, is preceded with 
 @code{\new Staff}.
 
-@lilypond[quote,verbatim,relative=2,raggedright,fragment]
+@lilypond[quote,verbatim,relative=2,ragged-right,fragment]
 << \new Staff { c4 c }
    \new Staff { d4 d }
 >>
@@ -203,7 +203,7 @@ They are combined by sending both to the same @context{Voice} context,
    \context Voice = "A" \arts
 >>
 @end example
-@lilypond[quote,raggedright]
+@lilypond[quote,ragged-right]
 music = { c4 c4 }
 arts = { s4-. s4-> }
 \relative c'' <<
@@ -229,20 +229,20 @@ This is similar to @code{\context} with @code{= @var{id}}, but matches
 any context of type @var{type}, regardless of its given name.
 
 This variant is used with music expressions that can be interpreted at
-several levels.  For example, the @code{\applyoutput} command (see
+several levels.  For example, the @code{\applyOutput} command (see
 @ref{Running a function on all layout objects}).  Without an explicit
 @code{\context}, it is usually applied to @context{Voice}
 
 @example
-\applyoutput #@var{function}   % apply to Voice
+\applyOutput #@var{function}   % apply to Voice
 @end example
 
 To have it interpreted at the @context{Score} or @context{Staff} level use
 these forms
 
 @example
-\context Score \applyoutput #@var{function}
-\context Staff \applyoutput #@var{function}
+\context Score \applyOutput #@var{function}
+\context Staff \applyOutput #@var{function}
 @end example
 
 
@@ -400,6 +400,8 @@ It can be useful to shuffle around these plug-ins.  This is done by
 starting a new context, with @code{\new} or @code{\context}, and
 modifying it like this, 
 
+@cindex @code{\with}
+
 @example
 \new @var{context} \with @{
   \consists @dots{}
@@ -445,7 +447,7 @@ time signature.
 @cindex polymetric scores
 @cindex Time signatures, multiple
 
-@lilypond[quote,relative=1,raggedright,verbatim,fragment]
+@lilypond[quote,relative=1,ragged-right,verbatim,fragment]
 \new Score \with {
   \remove "Timing_translator"
   \remove "Default_bar_line_engraver"
@@ -658,7 +660,7 @@ The next example shows how to build a different type of
 @code{Voice}, but prints centered slash noteheads only.  It can be used
 to indicate improvisation in Jazz pieces,
 
-@lilypond[quote,raggedright]
+@lilypond[quote,ragged-right]
 \layout { \context {
   \name ImproVoice
   \type "Engraver_group"
@@ -826,6 +828,7 @@ for many situations.  The next section will discuss the general use of
 * Navigating the program reference::  
 * Layout interfaces::           
 * Determining the grob property::  
+* Objects connected to the input::  
 * Difficult tweaks::            
 @end menu
 
@@ -1140,18 +1143,25 @@ does not amount to much.  The initialization file
 
 @example
 (Fingering
-  . ((print-function . ,Text_interface::print)
-     (padding . 0.6)
-     (staff-padding . 0.6)
+  . ((padding . 0.5)
+     (avoid-slur . around)
+     (slur-padding . 0.2)
+     (staff-padding . 0.5)
      (self-alignment-X . 0)
      (self-alignment-Y . 0)
      (script-priority . 100)
-     (font-size . -5)
-     (meta . ((interfaces . (finger-interface font-interface
-                             text-script-interface text-interface
-                             side-position-interface
-                             self-alignment-interface
-                             item-interface))))))
+     (stencil . ,ly:text-interface::print)
+     (direction . ,ly:script-interface::calc-direction)
+     (font-encoding . fetaNumber)
+     (font-size . -5)          ; don't overlap when next to heads.
+     (meta . ((class . Item)
+     (interfaces . (finger-interface
+                    font-interface
+                    text-script-interface
+                    text-interface
+                    side-position-interface
+                    self-alignment-interface
+                    item-interface))))))
 @end example
 
 @noindent
@@ -1223,46 +1233,61 @@ the @internalsref{Fingering_engraver} plug-in says
 Fingering_engraver is part of contexts: @dots{} @b{@internalsref{Voice}}
 @end quotation
 
-@node Difficult tweaks
-@subsection Difficult tweaks
+@node Objects connected to the input
+@subsection Objects connected to the input
+
+In some cases, it is possible to take a short-cut for tuning graphical
+objects. For objects that result directly from a piece of the input,
+you can use the @code{\tweak} function, for example
 
-There are two classes of difficult adjustments.  First, when there are
-several of the same objects at one point, and you want to adjust only
-one.  For example, if you want to change only one note head in a chord.
-
-In this case, the @code{\applyoutput} function must be used.  The
-next example defines a Scheme function @code{set-position-font-size}
-that sets the @code{font-size} property, but only  
-on objects that have @internalsref{note-head-interface} and are at the
-right Y-position.
-
-@lilypond[quote,verbatim]
-#(define ((set-position-font-size pos size) grob origin current)
-  (let*
-      ((meta (ly:grob-property grob 'meta))
-       (interfaces (cdr (assoc 'interfaces meta)))
-       (position (ly:grob-property grob 'staff-position)))
-   (if (and
-        ; is this a note head?
-        (memq 'note-head-interface interfaces)
-
-        ; is the Y coordinate right?
-        (= pos position))
-
-      ; then do it.
-      (set! (ly:grob-property grob 'font-size) size))))
-
-\relative {
+@lilypond[relative=2,fragment,verbatim,ragged-right]
+<
   c
-  \applyoutput #(set-position-font-size -2 4)
-  <c e g>
-}
+  \tweak #'color #red d
+  g
+  \tweak #'duration-log #1  a
+>4-\tweak #'padding #10 -. 
 @end lilypond
 
-@noindent
-A similar technique can be used for accidentals.  In that case, the
-function should check for @code{accidental-interface}.
+As you can see, properties are set directly in the objects directly,
+without mentioning the grob name or context where this should be
+applied.
+
+This technique only works for objects that are directly connected to
+an @internalsref{event} from the input, for example
+
+@itemize @bullet
+@item note heads, caused by chord-pitch.
+@item articulation signs, caused by articulation instructions
+@end itemize
+
+It notably does not work for stems and accidentals (these are caused
+by note heads, not by music events), clefs (these are not caused by
+music inputs, but rather by the change of a property value).
+In a similar vein, objects may be parenthesized by prefixing
+@code{\parenthesize} to the music event, 
+
+@lilypond[relative=2,fragment,verbatim,ragged-right]
+<
+  c
+  \parenthesize  d
+  g
+>4-\parenthesize -. 
+@end lilypond
 
+
+
+
+@node Difficult tweaks
+@subsection Difficult tweaks
+
+There are a few classes of difficult adjustments.  
+
+@itemize @bullet
+
+
+@item
 Another difficult adjustment is the appearance of spanner objects,
 such as slur and tie.  Initially, only one of these objects is created,
 and they can be adjusted with the normal mechanism.  However, in some
@@ -1271,11 +1296,12 @@ are cloned.  A separate object is created for every system that it is
 in.  These are clones of the original object and inherit all
 properties, including @code{\override}s.
 
+
 In other words, an @code{\override} always affects all pieces of a
 broken spanner.  To change only one part of a spanner at a line break,
 it is necessary to hook into the formatting process.  The
-@code{after-line-breaking-callback} property contains the Scheme procedure
-that is called after the line breaks have been determined, and layout
+@code{after-line-breaking} callback contains the Scheme procedure that
+is called after the line breaks have been determined, and layout
 objects have been split over different systems.
 
 In the following example, we define a procedure
@@ -1295,8 +1321,7 @@ if yes, it sets @code{extra-offset}.
 This procedure is installed into @internalsref{Tie}, so the last part
 of the broken tie is translated up.
 
-
-@lilypond[quote,verbatim,raggedright]
+@lilypond[quote,verbatim,ragged-right]
 #(define (my-callback grob)
   (let* (
          ; have we been split? 
@@ -1311,15 +1336,30 @@ of the broken tie is translated up.
      (ly:grob-set-property! grob 'extra-offset '(-2 . 5)))))
 
 \relative c'' { 
-  \override Tie #'after-line-breaking-callback =
+  \override Tie #'after-line-breaking =
   #my-callback
   c1 ~ \break c2 ~ c
 }
 @end lilypond
 
 @noindent
-When applying this trick, the new @code{after-line-breaking-callback}
-should also call the old @code{after-line-breaking-callback}, if there
-is one.  For example, if using this with @code{Slur},
-@code{Slur::after_line_breaking} should also be called.
+When applying this trick, the new @code{after-line-breaking} callback
+should also call the old one @code{after-line-breaking}, if there is
+one.  For example, if using this with @code{Hairpin},
+@code{ly:hairpin::after-line-breaking} should also be called.
+
+
+@item Some objects cannot be changed with @code{\override} for
+technical reasons. Examples of those are @code{NonMusicalPaperColumn}
+and @code{PaperColumn}.  They can be changed with the
+@code{\outputProperty} function, which works similar to @code{\once
+\override}, but uses a different syntax,
+
+@example 
+\outputProperty
+#"Score.NonMusicalPaperColumn"  % Grob name
+#'line-break-system-details     % Property name  
+#'((next-padding . 20))         % Value
+@end example
 
+@end itemize