]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/text.itely
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / Documentation / user / text.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9 @node Text
10 @section Text
11
12 @lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
13 {text-headword.ly}
14
15 This section explains how to include text (with various
16 formatting) in your scores.
17
18 @cindex Text, other languages
19 @warning{To write accented and special text (such as characters
20 from other languages), simply insert the characters directly into
21 the lilypond file.  The file must be saved as UTF-8.  For more
22 information, see @ref{Text encoding}.}
23
24 @menu
25 * Writing text::                
26 * Text markup::                 
27 * Special text concerns::       
28 @end menu
29
30
31 @node Writing text
32 @subsection Writing text
33
34 @menu
35 * Overview of text entry::      
36 * Text scripts::                
37 * Text spanners::               
38 * Text marks::                  
39 @end menu
40
41 @node Overview of text entry
42 @subsubsection Overview of text entry
43
44 There are four ways to add text to scores:
45
46 @itemize
47 @item
48 @ref{Text scripts}: blah blah
49
50 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
51 c4^"text" c c c
52 @end lilypond
53
54 @item
55 @ref{Text spanners}: blah blah
56
57 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
58 c1
59 \override TextSpanner #'bound-details #'left #'text =
60   \markup { \upright "rall" } 
61 c2\startTextSpan b c\stopTextSpan a
62 @end lilypond
63
64 @item
65 @ref{Text marks}: blah blah
66
67 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
68 c4\mark "foo" c c c
69 @end lilypond
70
71 @item
72 @ref{Vocal music}: blah blah, not in this section.
73
74 @lilypond[verbatim,quote,ragged-right]
75 <<
76   \relative c'' { c4 c c c }
77   \addlyrics { one two three four }
78 >>
79 @end lilypond
80
81 @end itemize
82
83 @seealso
84
85 Snippets: @lsrdir{Text,Text}
86
87
88
89 @node Text scripts
90 @subsubsection Text scripts
91
92 @cindex Text scripts
93 @cindex text items, non-empty
94 @cindex non-empty texts
95
96 It is possible to place arbitrary strings of text or @ref{Text
97 markup} with @var{note}@code{-"}@var{text}@code{"}.
98
99 INSERT EXAMPLE
100
101 More complex formatting may also be added to a note by using the
102 @code{\markup} command, as described in @ref{Text markup}.
103
104 @lilypond[fragment,ragged-right,verbatim,quote]
105 c'4^\markup { bla \bold bla }
106 @end lilypond
107
108 @refcommands
109
110 @funindex \textLengthOn
111 @code{\textLengthOn},
112 @funindex \textLengthOff
113 @code{\textLengthOff}.
114
115
116 @commonprop
117 @c TODO: put this in the LSR. -vv
118 By default, these indications do not influence the note spacing.
119 However, by using the command @code{\textLengthOn}, the widths
120 will be taken into account:
121
122 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
123 c4^"this does not affect spacing" \textLengthOn c4_"whereas this does" c4
124 @end lilypond
125
126 @noindent
127 After having used such a command, to go back to the default behavior
128 and prevent text from influencing spacing, use @code{\textLengthOff}.
129
130
131 @c TODO: LSR-ize this as well -vv
132 Checking to make sure that text scripts and lyrics are within the
133 margins is a relatively large computational task.  To speed up
134 processing, lilypond does not perform such calculations by
135 default; to enable it, use
136
137 @example
138 \override Score.PaperColumn #'keep-inside-line = ##t
139 @end example
140
141
142 @seealso
143
144 Notation Reference: @ref{Text markup}.
145
146 Snippets: @lsrdir{Text,Text}
147
148 Internals Reference: @internalsref{TextScript}.
149
150
151 @node Text spanners
152 @subsubsection Text spanners
153
154 @cindex Text spanners
155
156 @c TODO: merge these explanations with the ones below in 
157 @c "Text and Line spanners" -vv
158
159 Some performance indications, e.g., @i{rallentando} or
160 @i{accelerando}, are written as text and are extended over many
161 measures with dotted lines.  Such texts are created using text
162 spanners; attach @code{\startTextSpan} and @code{\stopTextSpan} to
163 the first and last notes of the spanner.
164
165 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
166 c1
167 \override TextSpanner #'bound-details #'left #'text = "faster" 
168 c2\startTextSpan b c\stopTextSpan a
169 @end lilypond
170
171 @noindent
172 The string to be printed, as well as the style, is set through
173 object properties. It can accept @code{\markup} blocks as well:
174
175 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
176 c1
177 \textSpannerDown
178 \override TextSpanner #'bound-details #'left #'text =
179   \markup { \upright "rall" } 
180 c2\startTextSpan b c\stopTextSpan a
181 \break
182 \textSpannerUp
183 \override TextSpanner #'bound-details #'left #'text =
184   \markup { \italic "rit" } 
185 c2\startTextSpan b c\stopTextSpan a
186 @end lilypond
187
188 @refcommands
189
190 @funindex textSpannerUp
191 @code{\textSpannerUp},
192 @funindex textSpannerDown
193 @code{\textSpannerDown},
194 @funindex textSpannerNeutral
195 @code{\textSpannerNeutral}.
196
197
198 @commonprop
199
200 To print a solid line, use
201
202 @example
203 \override TextSpanner #'style = #'line
204 @end example
205
206
207 @seealso
208
209 Snippets: @lsrdir{Text,Text}
210
211 Internals Reference: @internalsref{TextSpanner}.
212
213
214 @node Text marks
215 @subsubsection Text marks
216
217 @cindex coda on bar line
218 @cindex segno on bar line
219 @cindex fermata on bar line
220 @cindex bar lines, symbols on
221 @funindex \mark
222
223 The @code{\mark} command is primarily used for @ref{Rehearsal
224 marks}, but it can also be used to add text elements in a score:
225
226 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
227 c4\mark "text" c c c
228 @end lilypond
229
230 As it can contain a @code{\markup} object, the @code{\mark} command
231 makes possible to put any text, but also signs like coda, segno, or
232 fermata on a bar line.  The appropriate symbol has to be specified in
233 the @code{\markup} block; these symbols are listed in @ref{The Feta font}.
234
235 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
236 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
237 c1
238 @end lilypond
239
240 @noindent
241 @code{\mark} is only typeset above the top staff of the score.  If
242 you specify the @code{\mark} command at a bar line, the resulting
243 mark is placed above the bar line.  If you specify it in the
244 middle of a bar, the resulting mark is positioned between notes.
245 If it is specified before the beginning of a score line, it is
246 placed before the first note of the line.  Finally, if the mark
247 occurs at a line break, the mark will be printed at the beginning
248 of the next line.
249
250 @c  IMO this is a bug; hopefully it'll be fixed soon, so I can
251 @c  delete this sentence.   -gp
252 @noindent
253 If there is no next line, then the mark will not be printed at
254 all.
255
256
257 @commonprop
258
259 @c TODO: to be LSR-ized stuff -vv
260
261 To print the mark at the end of the current line, use
262
263 @example
264 \override Score.RehearsalMark
265   #'break-visibility = #begin-of-line-invisible
266 @end example
267
268 @code{\mark} is often useful for adding text to the end of bar.
269 In such cases, changing the @code{#'self-alignment} is very useful
270
271 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
272 \override Score.RehearsalMark
273   #'break-visibility = #begin-of-line-invisible
274 c1 c c c4 c c c
275 \once \override Score.RehearsalMark #'self-alignment-X = #right
276 \mark "D.S. al Fine "
277 @end lilypond
278
279 Text marks may be aligned with notation objects other than bar
280 lines,
281
282 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
283 \relative {
284   c1
285   \key cis \major
286   \clef alto
287   \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
288   \mark "on key"
289   cis
290   \key ces \major
291   \override Score.RehearsalMark #'break-align-symbols = #'(clef)
292   \clef treble
293   \mark "on clef"
294   ces
295   \override Score.RehearsalMark #'break-align-symbols = #'(time-signature)
296   \key d \minor
297   \clef tenor
298   \time 3/4
299   \mark "on time"
300   c
301 }
302 @end lilypond
303
304 Possible symbols for the @code{break-align-symbols} list are
305 @code{ambitus}, @code{breathing-sign}, @code{clef}, @code{custos},
306 @code{staff-bar}, @code{left-edge}, @code{key-cancellation},
307 @code{key-signature}, and @code{time-signature}.
308
309 The text marks will, by default, be aligned with the middle of the
310 notation object, but this can be changed by overriding the
311 @code{break-align-anchor-alignment} and @code{break-align-anchor}
312 properties for the appropriate grob. For scores with multiple staves,
313 this setting should be done for all the staves. 
314
315 @lilypond[fragment,quote,ragged-right,verbatim]
316 {
317   \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
318   c1
319   \key cis \major
320
321   % the RehearsalMark will be aligned with the left edge of the KeySignature
322   \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT
323   \mark \default
324   cis1
325   \key ces \major
326
327   % the RehearsalMark will be aligned with the right edge of the KeySignature
328   \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT
329   \mark \default
330   ces1
331   \key cis \major
332
333   % the RehearsalMark will be aligned with the left edge of the KeySignature
334   % and then shifted right by 2 units.
335   \once \override Score.KeySignature #'break-align-anchor = #2
336   \mark \default
337   ces1
338 }
339 @end lilypond
340
341 Although text marks are normally only printed above the topmost
342 staff, you may alter this to print them on every staff,
343
344 @lilypond[quote,ragged-right,verbatim,relative=2]
345 {
346   \new Score \with {
347     \remove "Mark_engraver"
348   }
349   <<
350     \new Staff \with {
351       \consists "Mark_engraver"
352     }
353     { c''1 \mark "foo" c'' }
354     \new Staff \with {
355       \consists "Mark_engraver"
356     }
357     { c'1 \mark "foo" c' }
358   >>
359 }
360 @end lilypond
361
362
363 @seealso
364
365 Snippets: @lsrdir{Text,Text}
366
367 Internals Reference: @internalsref{RehearsalMark}.
368
369 @c TODO: add this here? -vv
370 @c @node Text marks
371 @c @subsubsection Text marks
372
373 @node Text markup
374 @subsection Text markup
375
376 @menu
377 * Text markup introduction::    
378 * Nested scores::               
379 * Page wrapping text::          
380 * Font selection::              
381 @end menu
382
383 @node Text markup introduction
384 @subsubsection Text markup introduction
385
386 @cindex markup
387 @cindex text markup
388 @cindex markup text
389 @cindex typeset text
390
391 Use @code{\markup} to typeset text.  Commands are entered with the
392 backslash @code{\}.  To enter @code{\} and @code{#}, use double
393 quotation marks.
394
395 @lilypond[quote,verbatim,fragment,relative=1]
396 c1^\markup { hello }
397 c1_\markup { hi there }
398 c1^\markup { hi \bold there, is \italic {anyone home?} }
399 c1_\markup { "\special {weird} #characters" }
400 @end lilypond
401
402 @noindent
403 See @ref{Overview of text markup commands}, for a list of all
404 commands.
405
406 @code{\markup} is primarily used for @internalsref{TextScript}s,
407 but it can also be used anywhere text is called in lilypond
408
409 @lilypond[quote,verbatim]
410 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
411 \score{
412   \relative c'' {
413     \override Score.RehearsalMark
414       #'break-visibility = #begin-of-line-invisible
415     \override Score.RehearsalMark #'self-alignment-X = #right
416
417     \set Staff.instrumentName = \markup{ \column{ Alto solo } }
418     c2^\markup{ don't be \flat }
419     \override TextSpanner #'bound-details #'left #'text = \markup{\italic rit }
420     b2\startTextSpan
421     a2\mark \markup{ \large \bold Fine }
422     r2\stopTextSpan
423     \bar "||"
424   }
425   \addlyrics { bar, foo \markup{ \italic bar! } }
426 }
427 @end lilypond
428
429 A @code{\markup} command can also be placed on its own, away from
430 any @code{\score} block, see @ref{Multiple scores in a book}.
431
432 @lilypond[quote,ragged-right,verbatim]
433 \markup{ Here is some text. }
434 @end lilypond
435
436 @cindex font switching
437
438 The markup in the example demonstrates font switching commands.
439 The command @code{\bold} and @code{\italic} apply to the first
440 following word only; to apply a command to more than one word,
441 enclose the words with braces,
442
443 @example
444 \markup @{ \bold @{ hi there @} @}
445 @end example
446
447 @noindent
448 For clarity, you can also do this for single arguments, e.g.,
449
450 @example
451 \markup @{ is \italic @{ anyone @} home @}
452 @end example
453
454 In markup mode you can compose expressions, similar to
455 mathematical expressions, XML documents, and music expressions.
456 You can stack expressions grouped vertically with the command
457 @code{\column}.  Similarly, @code{\center-align} aligns texts by
458 their center lines:
459
460 @lilypond[quote,verbatim,fragment,relative=1]
461 c1^\markup { \column { a bbbb \line { c d } } }
462 c1^\markup { \center-align { a bbbb c } }
463 c1^\markup { \line { a b c } }
464 @end lilypond
465
466 Lists with no previous command are not kept distinct.  The
467 expression
468
469 @example
470 \center-align @{ @{ a b @} @{ c d @} @}
471 @end example
472
473 @noindent
474
475 is equivalent to
476
477 @example
478 \center-align @{ a b c d @}
479 @end example
480
481 @noindent
482
483 To keep lists of words distinct, please use quotes @code{"} or
484 the @code{\line} command
485
486 @lilypond[quote,verbatim,fragment,relative=1]
487 \textLengthOn
488 c4^\markup{ \center-align { on three lines } }
489 c4^\markup{ \center-align { "all one line" } }
490 c4^\markup{ \center-align { { on three lines } } }
491 c4^\markup{ \center-align { \line { on one line } } }
492 @end lilypond
493
494 Markups can be stored in variables and these variables may be
495 attached to notes, like
496
497 @example
498 allegro = \markup @{ \bold \large @{ Allegro @} @}
499  @{ a^\allegro b c d @}
500 @end example
501
502 Some objects have alignment procedures of their own, which cancel
503 out any effects of alignments applied to their markup arguments as
504 a whole.  For example, the @internalsref{RehearsalMark} is
505 horizontally centered, so using @code{\mark \markup @{ \left-align
506 .. @}} has no effect.
507
508 In addition, vertical placement is performed after creating the
509 text markup object.  If you wish to move an entire piece of
510 markup, you need to use the #'padding property or create an
511 @q{anchor} point inside the markup (generally with @code{\hspace
512 #0}).
513
514 @lilypond[quote,verbatim,fragment,relative=1]
515 \textLengthOn
516 c'4^\markup{ \raise #5 "not raised" }
517 \once \override TextScript #'padding = #3
518 c'4^\markup{ raised }
519 c'4^\markup{ \hspace #0 \raise #1.5 raised }
520 @end lilypond
521
522 Some situations (such as dynamic marks) have preset font-related
523 properties.  If you are creating text in such situations, it is
524 advisable to cancel those properties with @code{normal-text}.  See
525 @ref{Overview of text markup commands}, for more details.
526
527
528 @seealso
529
530 This manual: @ref{Overview of text markup commands}.
531
532 Snippets: @lsrdir{Text,Text}
533
534 Internals Reference: @internalsref{TextScript}.
535
536 Init files: @file{scm/@/new@/-markup@/.scm}.
537
538
539 @refbugs
540
541 Kerning or generation of ligatures is only done when the @TeX{}
542 backend is used.  In this case, LilyPond does not account for them
543 so texts will be spaced slightly too wide.
544
545 Syntax errors for markup mode are confusing.
546
547
548 @node Nested scores
549 @subsubsection Nested scores
550
551 It is possible to nest music inside markups, by adding a
552 @code{\score} block to a markup expression.  Such a score must
553 contain a @code{\layout} block.
554
555 @lilypond[quote,verbatim,ragged-right]
556 \relative {
557   c4 d^\markup {
558     \score {
559       \relative { c4 d e f }
560       \layout { }
561     }
562   }
563   e f
564 }
565 @end lilypond
566
567 @seealso
568
569 Snippets: @lsrdir{Text,Text}
570
571 @node Page wrapping text
572 @subsubsection Page wrapping text
573
574 Whereas @code{\markup} is used to enter a non-breakable block of
575 text, @code{\markuplines} can be used at top-level to enter lines
576 of text that can spread over multiple pages:
577
578 @verbatim
579 \markuplines {
580   \justified-lines {
581     A very long text of justified lines.
582     ...
583   }
584   \justified-lines {
585     An other very long paragraph.
586     ...
587   }
588   ...
589 }
590 @end verbatim
591
592 @code{\markuplines} accepts a list of markup, that is either the
593 result of a markup list command, or a list of markups or of markup
594 lists.  The built-in markup list commands are described in
595 @ref{Overview of text markup list commands}.
596
597 @seealso
598
599 This manual: @ref{Overview of text markup list commands}, @ref{New
600 markup list command definition}.
601
602 Snippets: @lsrdir{Text,Text}
603
604 @refcommands
605
606 @funindex \markuplines
607 @code{\markuplines}
608
609 @node Font selection
610 @subsubsection Font selection
611
612 @cindex font selection
613 @cindex font magnification
614 @funindex font-interface
615
616 By setting the object properties described below, you can select a
617 font from the preconfigured font families.  LilyPond has default
618 support for the feta music fonts.  Text fonts are selected through
619 Pango/FontConfig.  The serif font defaults to New Century
620 Schoolbook, the sans and typewriter to whatever the Pango
621 installation defaults to.
622
623
624 @itemize
625 @item @code{font-encoding}
626 is a symbol that sets layout of the glyphs.  This should only be
627 set to select different types of non-text fonts, e.g.
628
629 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
630 standard music font, including ancient glyphs, @code{fetaDynamic}
631 for dynamic signs and @code{fetaNumber} for the number font.
632
633 @item @code{font-family}
634 is a symbol indicating the general class of the typeface.
635 Supported are @code{roman} (Computer Modern), @code{sans}, and
636 @code{typewriter}.
637
638 @item @code{font-shape}
639 is a symbol indicating the shape of the font.  There are typically
640 several font shapes available for each font family.  Choices are
641 @code{italic}, @code{caps}, and @code{upright}.
642
643 @item @code{font-series}
644 is a symbol indicating the series of the font.  There are
645 typically several font series for each font family and shape.
646 Choices are @code{medium} and @code{bold}.
647
648 @end itemize
649
650 Fonts selected in the way sketched above come from a predefined
651 style sheet.  If you want to use a font from outside the style
652 sheet, then set the @code{font-name} property,
653
654 @lilypond[fragment,verbatim]
655 {
656   \override Staff.TimeSignature #'font-name = #"Charter"
657   \override Staff.TimeSignature #'font-size = #2
658   \time 3/4
659   c'1_\markup {
660     \override #'(font-name . "Vera Bold")
661       { This text is in Vera Bold }
662   }
663 }
664 @end lilypond
665
666 @noindent
667 Any font can be used, as long as it is available to
668 Pango/FontConfig.  To get a full list of all available fonts, run
669 the command
670
671 @example
672 lilypond -dshow-available-fonts blabla
673 @end example
674
675 (the last argument of the command can be anything, but has to be
676 present).
677
678
679 The size of the font may be set with the @code{font-size}
680 property.  The resulting size is taken relative to the
681 @code{text-font-size} as defined in the @code{\paper} block.
682
683 @cindex font size
684 @cindex font magnification
685
686
687 It is also possible to change the default font family for the
688 entire document.  This is done by calling the
689 @code{make-pango-font-tree} from within the @code{\paper} block.
690 The function takes names for the font families to use for roman,
691 sans serif and monospaced text.  For example,
692
693 @cindex font families, setting
694 @cindex Pango
695
696
697 @lilypond[verbatim]
698 \paper  {
699   myStaffSize = #20
700
701   #(define fonts
702     (make-pango-font-tree "Times New Roman"
703                           "Nimbus Sans"
704                           "Luxi Mono"
705                            (/ myStaffSize 20)))
706 }
707
708 {
709   c'^\markup { roman: foo \sans bla \typewriter bar }
710 }
711 @end lilypond
712
713 @c we don't do Helvetica / Courier, since GS incorrectly loads
714 @c Apple TTF fonts
715
716
717
718 @seealso
719
720 Snippets: @lsrdir{Text,Text}
721
722
723 @node Special text concerns
724 @subsection Special text concerns
725
726 @c FIXME: this section is to be removed
727 @c (see comments below) -vv
728
729 @menu
730 * New dynamic marks::           
731 * Text and line spanners::      
732 @end menu
733
734 @node New dynamic marks
735 @subsubsection New dynamic marks
736
737 @c FIXME: this whole section should be removed and put in
738 @c "Writing text" -vv
739
740 It is possible to print new dynamic marks or text that should be
741 aligned with dynamics.  Use @code{make-dynamic-script} to create
742 these marks.  Note that the dynamic font only contains the
743 characters @code{f,m,p,r,s} and @code{z}.
744
745 Some situations (such as dynamic marks) have preset font-related
746 properties.  If you are creating text in such situations, it is
747 advisable to cancel those properties with @code{normal-text}.  See
748 @ref{Overview of text markup commands}, for more details.
749
750 @cindex make-dynamic-script
751
752 @lilypond[quote,verbatim,ragged-right]
753 sfzp = #(make-dynamic-script "sfzp")
754 \relative c' {
755   c4 c c\sfzp c
756 }
757 @end lilypond
758
759 @cindex Dynamics, editorial
760 @cindex Dynamics, parenthesis
761
762 It is also possible to print dynamics in round parenthesis or
763 square brackets.  These are often used for adding editorial
764 dynamics.
765
766 @lilypond[quote,verbatim,ragged-right]
767 rndf = \markup{ \center-align {\line { \bold{\italic (}
768   \dynamic f \bold{\italic )} }} }
769 boxf = \markup{ \bracket { \dynamic f } }
770 { c'1_\rndf c'1_\boxf }
771 @end lilypond
772
773 @seealso
774
775 Snippets: @lsrdir{Text,Text}
776
777
778 @node Text and line spanners
779 @subsubsection Text and line spanners
780
781 @c FIXME: this whole section has to be removed.
782 @c glissando stuff should go into Expressive marks;
783 @c Text spanners should go into... Text spanners.
784 @c (I'm on it) --vv
785
786 Some performance indications, e.g., @i{rallentando} and
787 @i{accelerando} and @i{trills} are written as text and are
788 extended over many measures with lines, sometimes dotted or wavy.
789
790 These all use the same routines as the glissando for drawing the
791 texts and the lines, and tuning their behavior is therefore also
792 done in the same way.  It is done with a spanner, and the routine
793 responsible for drawing the spanners is
794 @code{ly:line-interface::print}.  This routine determines the
795 exact location of the two @i{span points} and draws a line in
796 between, in the style requested.
797
798 Here is an example of the different line styles available, and how
799 to tune them.
800
801 @lilypond[relative=2,ragged-right,verbatim,fragment]
802 d2 \glissando d'2
803 \once \override Glissando #'style = #'dashed-line
804 d,2 \glissando d'2
805 \override Glissando #'style = #'dotted-line
806 d,2 \glissando d'2
807 \override Glissando #'style = #'zigzag
808 d,2 \glissando d'2
809 \override Glissando #'style = #'trill
810 d,2 \glissando d'2
811 @end lilypond
812
813 The information that determines the end-points is computed
814 on-the-fly for every graphic object, but it is possible to
815 override these. 
816
817 @lilypond[relative=2,ragged-right,verbatim,fragment]
818 e2 \glissando f
819 \once \override Glissando #'bound-details #'right #'Y = #-2
820 e2 \glissando f
821 @end lilypond
822
823 The @code{Glissando} object, like any other using the
824 @code{ly:line-interface::print} routine, carries a nested
825 association list.  In the above statement, the value for @code{Y}
826 is set to @code{-2} for the association list corresponding to the
827 right end point.  Of course, it is also possible to adjust the
828 left side with @code{left} instead of @code{right}.
829
830 If @code{Y} is not set, the value is computed from the vertical
831 position of right attachment point of the spanner. 
832
833 In case of a line break, the values for the span-points are
834 extended with contents of the @code{left-broken} and
835 @code{right-broken} sublists, for example
836
837 @lilypond[relative=2,ragged-right,verbatim,fragment]
838 \override Glissando #'breakable = ##T 
839 \override Glissando #'bound-details #'right-broken #'Y = #-3
840 c1 \glissando \break
841 f1
842 @end lilypond
843
844 The following properties can be used for the
845
846 @table @code
847 @item Y
848 This sets the Y-coordinate of the end point, in staff space.  By
849 default, it is the center of the bound object, so for a glissando
850 it points to the vertical center of the note head.
851
852 For horizontal spanners, such as text spanner and trill spanners,
853 it is hardcoded to 0.
854
855 @item attach-dir
856 This determines where the line starts and ends in X-direction,
857 relative to the bound object.  So, a value of @code{-1} (or
858 @code{LEFT}) makes the line start/end at the left side of the note
859 head it is attached to.
860
861 @item X
862 This is the absolute coordinate of the end point.  It is usually
863 computed on the fly, and there is little use in overriding it. 
864
865 @item stencil
866 Line spanners may have symbols at the beginning or end, which is
867 contained in this sub-property.  This is for internal use, it is
868 recommended to use @code{text}.
869
870 @item text
871 This is a markup that is evaluated to yield stencil.  It is used
872 to put @i{cresc.} and @i{tr} on horizontal spanners.
873
874 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
875 \override TextSpanner #'bound-details #'left #'text
876    = \markup { \small \bold Slower }
877 c2\startTextSpan b c a\stopTextSpan
878 @end lilypond
879
880 @item stencil-align-dir-y
881 @item stencil-offset
882 Without setting this, the stencil is simply put there at the
883 end-point, as defined by the @code{X} and @code{Y} sub properties.
884 Setting either @code{stencil-align-dir-y} or @code{stencil-offset}
885 will move the symbol at the edge relative to the end point of the
886 line
887
888 @lilypond[relative=1,fragment,verbatim]
889 \override TextSpanner #'bound-details
890   #'left #'stencil-align-dir-y = #DOWN
891 \override TextSpanner #'bound-details
892   #'right #'stencil-align-dir-y = #UP
893
894 \override TextSpanner #'bound-details
895   #'left #'text = #"gggg"
896 \override TextSpanner #'bound-details
897   #'right #'text = #"hhhh"
898 c4^\startTextSpan c c c \stopTextSpan
899 @end lilypond
900
901 @item arrow
902 Setting this sub property to @code{#t} produce an arrowhead at the
903 end of the line.
904
905 @item padding
906 This sub property controls the space between the specified
907 end-point of the line and the actual end.  Without padding, a
908 glissando would start and end in the center of each note head.
909
910 @end table
911
912 TODO: add this somewhere
913
914 @verbatim
915 \new Staff {
916   \override TextSpanner #'bound-details #'left-broken #'text = ##f
917    \override TextSpanner #'bound-details #'left #'text = \markup {
918 "start" }
919    c'1 \startTextSpan \break
920    c'1
921    c'1 \stopTextSpan
922 }
923 @end verbatim
924
925
926 The music function \endSpanners terminates spanners and hairpins
927 after exactly one note.
928
929 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
930 \endSpanners
931 c2 \startTextSpan c2
932 c2 \< c2
933 @end lilypond
934
935 When using \endSpanners it is not necessary to close
936 \startTextSpan with \stopTextSpan, nor is it necessary to close
937 hairpins with \!.
938
939
940
941 @seealso
942
943 Snippets: @lsrdir{Text,Text}
944
945 Internals Reference: @internalsref{TextSpanner},
946 @internalsref{Glissando}, @internalsref{VoiceFollower},
947 @internalsref{TrillSpanner},
948 @internalsref{line-spanner-interface}.
949
950
951
952
953