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