]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/text.itely
Doc-es: Texidoc LSR Snippets in Expressive.
[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 @c \version "2.11.57"
10
11 @node Text
12 @section Text
13
14 @lilypondfile[quote]{text-headword.ly}
15
16 This section explains how to include text (with various
17 formatting) in music scores.
18
19 @noindent
20 Some text elements that are not dealt with here are discussed in other
21 specific sections: @ref{Vocal music}, @ref{Titles and headers}.
22
23
24 @cindex Text, other languages
25 @warning{To write accented and special text (such as characters
26 from other languages), simply insert the characters directly into
27 the LilyPond file.  The file must be saved as UTF-8.  For more
28 information, see @ref{Text encoding}.}
29
30 @menu
31 * Writing text::                
32 * Formatting text::             
33 * Fonts::                       
34 @end menu
35
36
37 @node Writing text
38 @subsection Writing text
39
40 This section introduces different ways of adding text to a score.
41
42 @menu
43 * Text scripts::                
44 * Text spanners::               
45 * Text marks::                  
46 * Separate text::               
47 @end menu
48
49
50 @node Text scripts
51 @subsubsection Text scripts
52
53 @cindex Text scripts
54 @cindex text items, non-empty
55 @cindex non-empty texts
56 @cindex quoted text
57
58 Simple @q{quoted text} indications may be added
59 to a score, as demonstrated in the following example.
60 Such indications can be manually placed
61 above or below the staff, using the
62 syntax described in @ref{Direction and
63 placement}.
64
65 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
66 d8^"pizz." e f g a4-"scherz." f
67 @end lilypond
68
69 This syntax is actually a shorthand; more complex text
70 formatting may be added to a note by explicitly using a
71 @code{\markup} block, as described in @ref{Formatting text}.
72
73 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
74 d8^\markup { \italic pizz. } e f g 
75 a4_\markup { \tiny scherz. \bold molto } f
76 @end lilypond
77
78 By default, text indications do not influence the note spacing.
79 However, their widths can be taken into account:
80 in the following example, the first text string does not affect 
81 spacing, whereas the second one does.
82
83 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
84 d8^"pizz." e f g
85 \textLengthOn
86 a4_"scherzando" f
87 @end lilypond
88
89 @predefined
90
91 @funindex \textLengthOn
92 @code{\textLengthOn},
93 @funindex \textLengthOff
94 @code{\textLengthOff}
95
96
97 @seealso
98
99 Notation Reference: @ref{Formatting text},
100 @ref{Direction and placement}.
101
102 Snippets:
103 @rlsr{Text}.
104
105 Internals Reference: @rinternals{TextScript}.
106
107 @knownissues
108
109 Checking to make sure that text scripts and lyrics are within the
110 margins is a relatively large computational task.  To speed up
111 processing, LilyPond does not perform such calculations by
112 default; to enable it, use
113
114 @example
115 \override Score.PaperColumn #'keep-inside-line = ##t
116 @end example
117
118
119 @node Text spanners
120 @subsubsection Text spanners
121
122 @cindex Text spanners
123
124 Some performance indications, e.g., @notation{rallentando} or
125 @notation{accelerando}, are written as text and are extended over
126 multiple notes with dotted lines.
127 Such objects, called @q{spanners}, may be created
128 from one note to another using the following syntax:
129
130 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
131 \override TextSpanner #'bound-details #'left #'text = "rit." 
132 b1\startTextSpan 
133 e,\stopTextSpan
134 @end lilypond
135
136 @noindent
137 The string to be printed is set through
138 object properties.  By default it is printed in italic characters,
139 but different formatting can be obtained using
140 @code{\markup} blocks, as described in @ref{Formatting text}.
141
142 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
143 \override TextSpanner #'bound-details #'left #'text =
144   \markup { \upright "rit." } 
145 b1\startTextSpan c
146 e,\stopTextSpan
147 @end lilypond
148
149 The line style, as well as the text string, can be defined as an
150 object property.  This syntax is described in @ref{Line styles}.
151
152 @predefined
153
154 @funindex textSpannerUp
155 @code{\textSpannerUp},
156 @funindex textSpannerDown
157 @code{\textSpannerDown},
158 @funindex textSpannerNeutral
159 @code{\textSpannerNeutral}
160
161 @seealso
162
163 Notation Reference: @ref{Line styles}.
164
165 Snippets:
166 @rlsr{Text}.
167
168 Internals Reference: @rinternals{TextSpanner}.
169
170
171 @node Text marks
172 @subsubsection Text marks
173
174 @cindex coda on bar line
175 @cindex segno on bar line
176 @cindex fermata on bar line
177 @cindex bar lines, symbols on
178 @funindex \mark
179
180 Various text elements may be added to a score using
181 the syntax described in @ref{Rehearsal marks}:
182
183 @c \mark needs to be placed on a separate line (it's not
184 @c attached to an object like \markup is). -vv
185
186 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
187 c4
188 \mark "Allegro"
189 c c c
190 @end lilypond
191
192 This syntax makes it possible to put any text on a bar line;
193 more complex text formatting may be added using a @code{\markup}
194 block, as described in @ref{Formatting text}.  This can be used to print
195 signs like coda, segno or fermata, by specifying the appropriate
196 symbol name:
197
198 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
199 c1
200 \mark \markup { \musicglyph #"scripts.ufermata" }
201 c1
202 @end lilypond
203
204 @noindent
205 Such objects are only typeset above the top staff of the score; depending on
206 whether they are specified at the end or the middle of a bar, they 
207 can be placed above the bar line or between notes.  When specified at the
208 beginning of a score or at a line break, marks will be printed at
209 the beginning of the line (the next line, in case of a line break).
210
211 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
212 \mark "Allegro"
213 c1 c
214 \mark "assai" \break
215 c  c
216 @end lilypond
217
218
219 @snippets
220
221 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
222 {printing-marks-at-the-end-of-a-line-or-a-score.ly}
223
224 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
225 {aligning-marks-with-various-notation-objects.ly}
226
227 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
228 {printing-marks-on-every-staff.ly}
229
230 @seealso
231
232 Notation Reference: @ref{Rehearsal marks},
233 @ref{Formatting text}, @ref{The Feta font}.
234
235 Snippets:
236 @rlsr{Text}.
237
238 Internals Reference: @rinternals{RehearsalMark}.
239
240 @knownissues
241 @c  To be removed when Issue 69 in the tracker gets fixed. -vv
242
243 If a mark is entered at the end of the last bar of the score (where
244 there is no next line), then the mark will not be printed at
245 all.
246
247 @node Separate text
248 @subsubsection Separate text
249
250 @cindex separate text
251 @cindex standalone text
252 @cindex top-level text
253 @cindex text, standalone
254 @funindex \markup
255
256 A @code{\markup} block can exist by itself, outside of any
257 any @code{\score} block, as a @qq{top-level
258 expression}.  This syntax is described in @ref{File structure}.
259
260 @lilypond[verbatim,quote]
261 \markup {
262   Tomorrow, and tomorrow, and tomorrow...
263 }
264 @end lilypond
265
266 @noindent
267 This allows printing text separately
268 from the music, which is particularly 
269 useful when the input file contains
270 several music pieces, as described in
271 @ref{Multiple scores in a book}.
272
273 @lilypond[quote,ragged-right,verbatim]
274 \score {
275   c'1
276 }
277 \markup {
278   Tomorrow, and tomorrow, and tomorrow...
279 }
280 \score {
281   c'1
282 }
283 @end lilypond
284
285 Using a specific syntax, text blocks can be spread
286 over multiple pages, making possible to print
287 text documents or books (and therefore to
288 use LilyPond as a word processor).  This syntax is described in
289 @ref{Multi-page markup}.
290
291 @predefined
292
293 @code{\markup},
294 @funindex \markuplines
295 @code{\markuplines}
296
297 @ignore
298 @snippets
299
300 TODO: add convenient snippets in input/new -vv
301 @end ignore
302
303 @seealso
304
305 Notation Reference: @ref{Formatting text},
306 @ref{File structure}, 
307 @ref{Multiple scores in a book},
308 @ref{Multi-page markup}.
309
310 Snippets:
311 @rlsr{Text}.
312
313 Internals Reference: @rinternals{TextScript}.
314
315
316 @node Formatting text
317 @subsection Formatting text
318
319 This section presents basic and advanced text formatting,
320 using the @code{\markup} mode specific syntax.
321
322 @menu
323 * Text markup introduction::    
324 * Selecting font and font size::      
325 * Text alignment::              
326 * Graphic notation inside markup::  
327 * Music notation inside markup::  
328 * Multi-page markup::          
329 @end menu
330
331 @node Text markup introduction
332 @subsubsection Text markup introduction
333
334 @cindex markup
335 @cindex text markup
336 @cindex markup text
337 @cindex typeset text
338 @funindex \markup
339
340 A @code{\markup} block is used to typeset text with an extensible
341 specific syntax called @qq{markup mode}.
342
343 @cindex markup expressions
344 @cindex markup syntax
345
346 The markup syntax is similar to LilyPond's usual syntax: a
347 @code{\markup} expression is enclosed in curly braces @code{@{
348 @dots{} @}}.  A single word is regarded as a minimal expression,
349 and therefore does not need to be enclosed with braces.
350
351 Unlike simple @q{quoted text} indications, @code{\markup} blocks
352 may contain nested expressions or specific commands,
353 entered using the backslash @code{\} character.
354 Such commands only affect the first following expression.
355
356 @lilypond[quote,verbatim,fragment,relative=1]
357 e1-\markup intenso
358 a2^\markup { poco \italic più forte  }
359 c e1
360 d2_\markup { \italic "string. assai" }
361
362 b1^\markup { \bold { molto \italic  agitato } }
363 c
364 @end lilypond
365
366 @cindex special characters in markup mode
367 @cindex markup mode, special characters
368 @cindex reserved characters, printing
369 @cindex printing special characters
370 @cindex quoted text in markup mode
371
372 A @code{\markup} block may also contain quoted text strings.
373 Such strings are treated as minimal text expressions, and
374 therefore any markup command or special character (such as
375 @code{\} and @code{#}) will be printed verbatim without affecting
376 the formatting of the text.  This syntax even allows to print
377 double quotation marks, by preceding them with backslashes
378
379 @lilypond[quote,verbatim,fragment,relative=1]
380 d1^"\italic markup..."
381 d_\markup \italic "... prints \"italic\" letters!"
382 d d
383 @end lilypond
384
385 The way markup expressions are defined affects 
386 how these expressions will be stacked, centered and aligned
387 when using the commands explained in @ref{Text alignment}.
388
389 @lilypond[quote,verbatim,fragment,relative=1]
390 c1^\markup { \column { a bbbb \line { c d } } }
391 c1^\markup { \center-column { a bbbb c } }
392 c1^\markup { \line { a b c } }
393 @end lilypond
394
395 Lists of words that are not enclosed with double quotes
396 or preceded by a command are not treated as a distinct
397 expression.  In the following example, the first two
398 @code{\markup} expressions are equivalent:
399
400 @lilypond[quote,verbatim,fragment,relative=1]
401 c1^\markup { \center-column { a bbb c } }
402 c1^\markup { \center-column { a { bbb c } } }
403 c1^\markup { \center-column { a \line { bbb c } } }
404 @end lilypond
405
406
407 Markups can be stored in variables.  Such variables may be
408 directly attached to notes:
409
410 @lilypond[quote,verbatim]
411 allegro = \markup { \bold \large Allegro }
412
413 {
414   d''8.^\allegro
415   d'16 d'4 r2
416 }
417 @end lilypond
418
419
420 @noindent
421 An exhaustive list of @code{\markup}-specific commands can be found in
422 @ref{Text markup commands}.
423
424
425 @seealso
426
427 Notation Reference:
428 @ref{Text markup commands}.
429
430 Snippets:
431 @rlsr{Text}.
432
433 Internals Reference:
434 @rinternals{TextScript}.
435
436 Installed files:
437 @file{scm/@/markup@/.scm}.
438
439
440 @knownissues
441
442 Syntax errors for markup mode can be confusing.
443
444
445 @node Selecting font and font size
446 @subsubsection Selecting font and font size
447
448 @cindex font switching
449 @funindex \italic
450 @funindex \bold
451 @funindex \underline
452
453 Basic font switching is supported in markup mode:
454
455 @lilypond[quote,verbatim,relative=2]
456 {
457   d1^\markup { 
458     \bold { Più mosso } 
459     \italic { non troppo \underline Vivo } 
460   }
461   r2 r4 r8
462   d,_\markup { \italic quasi \smallCaps Tromba }
463   f1 d2 r
464 }
465 @end lilypond
466
467 @cindex font size
468 @cindex text size
469 @funindex \fontsize
470 @funindex \smaller
471 @funindex \larger
472 @funindex \bigger
473 @funindex \magnify
474
475 The size of the characters can also be altered in different ways:
476 @itemize
477 @item
478 the font size can be defined to an absolute value,
479
480 @item
481 predefined commands allow to easily select standard sizes,
482
483 @item
484 the font size can also be changed relatively to its previous value.
485 @end itemize
486
487 @noindent
488 The following example demonstrates these three methods:
489
490 @lilypond[quote,verbatim,relative=2]
491 {
492   f1^\markup { \fontsize #5 Sinfonia } 
493   a,_\markup { 
494     \tiny espressivo
495     \large e
496     \normalsize intenso 
497   }
498   bes^\markup { (con 
499     \larger grande 
500     \smaller emozione 
501     \magnify #0.6 { e sentimento } )
502   }
503   d c2 r8 c bes a g1
504 }
505 @end lilypond
506
507 @cindex subscript
508 @cindex superscript
509 @funindex \super
510 @funindex \sub
511
512 Text may be printed as subscript or superscript. By default
513 these are printed in a smaller size, but a normal size can be used as well:
514
515 @lilypond[quote,verbatim]
516 \markup {
517   \column {
518     \line { 1 \super st movement }
519     \line { 1 \normal-size-super st movement 
520       \sub { (part two) }  }
521   }
522 }
523 @end lilypond
524
525 @cindex font families
526
527 The markup mode provides an easy way to select alternate
528 font families.  The default serif font, of roman type, is
529 automatically selected unless specified otherwise: on the
530 last line of the following example, there is no difference
531 between the first and the second word.
532
533 @lilypond[quote,verbatim]
534 \markup {
535   \column {
536     \line { Act \number 1 }
537     \line { \sans { Scene I. } }
538     \line { \typewriter { Verona. An open place. } }
539     \line { Enter \roman Valentine and Proteus. }
540   }
541 }
542 @end lilypond
543
544 @noindent
545 Some of these font families, used for specific items
546 such as numbers or dynamics, do not provide all
547 characters, as mentioned in @ref{New dynamic marks} and
548 @ref{Manual repeat marks}.
549
550 @c \concat is actually documented in Align (it is not
551 @c a font-switching command). But we need it here. -vv
552
553 When used inside a word, some font-switching or formatting
554 commands may produce an unwanted blank space.  This can
555 easily be solved by concatenating the text elements together:
556
557 @lilypond[quote,verbatim]
558 \markup {
559   \column {
560     \line {
561       \concat { 1 \super st }
562       movement
563     }
564     \line {
565       \concat { \dynamic p , }
566       \italic { con dolce espressione }
567     }
568   }
569 }
570 @end lilypond
571
572 An exhaustive list of font-switching, font-size
573 and font-families related commands can be found in @ref{Font}.
574
575 Defining custom font sets is also possible, as explained in
576 @ref{Fonts}.
577
578 @predefined
579
580 @funindex \teeny
581 @funindex \tiny
582 @funindex \small
583 @funindex \normalsize
584 @funindex \large
585 @funindex \huge
586 @code{\teeny},
587 @code{\tiny},
588 @code{\small},
589 @code{\normalsize},
590 @code{\large},
591 @code{\huge}.
592
593 @seealso
594 Notation Reference:
595 @ref{Font},
596 @ref{New dynamic marks},
597 @ref{Manual repeat marks},
598 @ref{Fonts}.
599
600 Snippets:
601 @rlsr{Text}.
602
603 Internals Reference:
604 @rinternals{TextScript}.
605
606 Installed files:
607 @file{scm/@/define@/-markup@/-commands@/.scm}.
608
609
610 @node Text alignment
611 @subsubsection Text alignment
612
613 @cindex text, aligning
614 @cindex aligning text
615
616 This subsection discusses how to place text in markup mode,
617 inside a @code{\markup} block.  Markup objects can also
618 be moved as a whole, using the syntax described in
619 @rlearning{Moving objects}.
620
621 @c Padding commands should be mentioned on this page, but
622 @c most of these require \box to be more clearly illustrated. -vv
623
624 @cindex text, horizontal alignment
625 @cindex horizontal text alignment
626 @funindex \left-align
627 @funindex \center-align
628 @funindex \right-align
629
630 Markup objects may be aligned in different ways.  By default,
631 a text indication is aligned on its left edge: in the following
632 example, there is no difference
633 between the first and the second markup.
634
635 @lilypond[quote,verbatim,fragment,relative=1]
636 a1-\markup { poco }
637 e'
638 a,-\markup { \left-align poco }
639 e'
640 a,-\markup { \center-align { poco } }
641 e'
642 a,-\markup { \right-align poco }
643 @end lilypond
644
645 @funindex \halign
646
647 Horizontal alignment may be fine-tuned
648 using a numeric value:
649
650 @lilypond[quote,verbatim,fragment,relative=1]
651 a1-\markup { \halign #-1 poco }
652 e'
653 a,-\markup { \halign #0 poco }
654 e'
655 a,-\markup { \halign #0.5 poco }
656 e'
657 a,-\markup { \halign #2 poco }
658 @end lilypond
659
660 @noindent
661 Some objects may have alignment procedures of their own,
662 and therefore are not affected by these commands.  It is
663 possible to move such markup objects as a whole, as shown
664 for instance in @ref{Text marks},
665
666 @cindex text, vertical alignment
667 @cindex vertical text alignment
668 @funindex \raise
669 @funindex \lower
670
671 Vertical alignment is a bit more complex.  As stated above,
672 markup objects can be moved as a whole; however, it is also
673 possible to move specific elements inside a markup block.
674 In this case, the element to be moved needs to be preceded
675 with an @emph{anchor point}, that can be another markup element
676 or an invisible object.  The following example demonstrates these
677 two possibilities; the last markup in this example has no anchor
678 point, and therefore is not moved.
679
680 @lilypond[quote,verbatim,fragment,relative=1]
681 d2^\markup { 
682   Acte I
683   \raise #2 { Scène 1 } }
684 a'
685 g_\markup {
686   \null
687   \lower #4 \bold { Très modéré } }
688 a
689 d,^\markup {
690   \raise #4 \italic { Une forêt. } }
691 a'4 a g2 a
692 @end lilypond
693
694 @funindex \general-align
695 @funindex \translate
696 @funindex \translate-scaled
697
698 Some commands can affect both the horizontal and vertical
699 alignment of text objects in markup mode.  Any object
700 affected by these commands must be preceded with an
701 anchor point:
702
703 @lilypond[quote,verbatim,fragment,relative=1]
704 d2^\markup {
705   Acte I
706   \translate #'(-1 . 2) "Scène 1" }
707 a'
708 g_\markup {
709   \null
710   \general-align #Y #3.2 \bold "Très modéré" }
711 a
712 d,^\markup {
713   \null
714   \translate-scaled #'(-1 . 2) \teeny "Une forêt." }
715 a'4 a g2 a
716 @end lilypond
717
718 @funindex \column
719 @funindex \center-column
720
721 @cindex multi-line markup
722 @cindex multi-line text
723 @cindex columns, text
724
725 A markup object may include several lines of text.
726 In the following example, each element or expression
727 is placed on its own line, either left-aligned or centered:
728
729 @lilypond[quote,verbatim]
730 \markup {
731   \column {
732     a
733     "b c"
734     \line { d e f }
735   }
736   \hspace #10
737   \center-column {
738     a
739     "b c"
740     \line { d e f }
741   }
742 }
743 @end lilypond
744
745 @funindex \fill-line
746
747 @cindex centering text on the page
748
749 Similarly, a list of elements or expressions may be
750 spread to fill the entire horizontal line width (if there
751 is only one element, it will be centered on the page).
752 These expressions can, in turn, include multi-line text
753 or any other markup expression:
754
755 @lilypond[quote,verbatim]
756 \markup {
757   \fill-line {
758     \line { William S. Gilbert }
759     \center-column {
760       \huge \smallCaps "The Mikado"
761       or
762       \smallCaps "The Town of Titipu"
763     }
764     \line { Sir Arthur Sullivan }
765   }
766 }
767 \markup {
768   \fill-line { 1885 } 
769 }
770 @end lilypond
771
772 @funindex \wordwrap
773 @funindex \justify
774
775 @cindex wordwrapped text
776 @cindex justified text
777
778 Long text indications can also be automatically wrapped
779 accordingly to the given line width.  These will be
780 either left-aligned or justified, as shown in
781 the following example.
782
783 @lilypond[quote,verbatim]
784 \markup {
785   \column {
786     \line  \smallCaps { La vida breve }
787     \line \bold { Acto I }
788     \wordwrap \italic {
789       (La escena representa el corral de una casa de
790       gitanos en el Albaicín de Granada. Al fondo una
791       puerta por la que se vé el negro interior de
792       una Fragua, iluminado por los rojos resplandores
793       del fuego.) 
794     }
795     \hspace #0
796
797     \line \bold { Acto II }
798     \override #'(line-width . 50)
799     \justify \italic {
800       (Calle de Granada. Fachada de la casa de Carmela
801       y su hermano Manuel con grandes ventanas abiertas
802       a través de las que se ve el patio
803       donde se celebra una alegre fiesta)
804     }
805   }
806 }
807 @end lilypond
808
809 An exhaustive list of text alignment commands
810 can be found in @ref{Align}.
811
812 @seealso
813 Learning Manual:
814 @rlearning{Moving objects}.
815
816 Notation Reference:
817 @ref{Align},
818 @ref{Text marks}.
819
820 Snippets:
821 @rlsr{Text}.
822
823 Internals Reference: @rinternals{TextScript}.
824
825 Installed files:
826 @file{scm/@/define@/-markup@/-commands@/.scm}.
827
828
829 @node Graphic notation inside markup
830 @subsubsection Graphic notation inside markup
831
832 @cindex graphics, embedding
833 @cindex drawing graphic objects
834
835 Various graphic objects may be added to a score,
836 using specific markup commands.
837
838 @funindex \box
839 @funindex \circle
840 @funindex \rounded-box
841 @funindex \bracket
842 @funindex \hbracket
843
844 @cindex decorating text
845 @cindex framing text
846
847 Some markup commands allow to decorate text elements
848 with graphics, as demonstrated in the following example.
849
850 @lilypond[quote,verbatim]
851 \markup \fill-line {
852   \center-column {
853     \circle Jack
854     \box "in the box"
855     \null
856     \line {
857       Erik Satie
858       \hspace #3
859       \bracket "1866 - 1925"
860     }
861     \null
862     \rounded-box \bold Prelude
863   }
864 }
865 @end lilypond
866
867 @funindex \pad-markup
868 @funindex \pad-x
869 @funindex \pad-to-box
870 @funindex \pad-around
871
872 @cindex padding around text
873 @cindex text padding
874
875 Some commands may require to increase the padding around
876 the text: this is achieved with some specific commands
877 exhaustively described in @ref{Align}.
878
879 @lilypond[quote,verbatim]
880 \markup \fill-line {
881   \center-column {
882     \box "Charles Ives (1874 - 1954)"
883     \null
884     \box \pad-markup #2 "THE UNANSWERED QUESTION"
885     \box \pad-x #8 "A Cosmic Landscape"
886     \null
887   }
888 }
889 \markup \column {
890   \line {
891     \hspace #10
892     \box \pad-to-box #'(-5 . 20) #'(0 . 5)
893       \bold "Largo to Presto"
894   }
895   \pad-around #3
896       "String quartet keeps very even time,
897 Flute quartet keeps very uneven time."
898 }
899 @end lilypond
900
901 @funindex \combine
902 @funindex \draw-circle
903 @funindex \filled-box
904 @funindex \triangle
905 @funindex \draw-line
906 @funindex \arrow-head
907
908 @cindex graphic notation
909 @cindex symbols, non-musical
910
911 Other graphic elements or symbols may be printed
912 without requiring any text.  As with any markup
913 expression, such objects can be combined together:
914
915 @lilypond[quote,verbatim]
916 \markup {
917   \combine
918     \draw-circle #4 #0.4 ##f
919     \filled-box #'(-4 . 4) #'(-0.5 . 0.5) #1
920   \hspace #5
921
922   \center-column {
923     \triangle ##t
924     \combine
925       \draw-line #'(0 . 4)
926       \arrow-head #Y #DOWN ##f
927   }
928 }
929 @end lilypond
930
931 @funindex \epsfile
932 @funindex \postscript
933
934 @cindex embedded graphics
935 @cindex images, embedding
936 @cindex graphics, embedding
937 @cindex postscript
938
939 Advanced graphic features include the ability to
940 include external image files converted to the
941 Encapsulated PostScript format (@emph{eps}), or
942 to directly embed graphics into the input file,
943 using native PostScript code.
944
945 @lilypond[quote,verbatim,fragment,relative=1]
946 c1^\markup {
947   \combine
948     \epsfile #X #10 #"./context-example.eps"
949     \postscript #"
950       -2 3 translate
951       2.7 2 scale
952       newpath
953       2 -1 moveto
954       4 -2 4 1 1 arct
955       4 2 3 3 1 arct
956       0 4 0 3 1 arct
957       0 0 1 -1 1 arct
958       closepath
959       stroke"
960   }
961 c
962 @end lilypond
963
964 An exhaustive list of graphics-specific commands
965 can be found in @ref{Graphic}.
966
967 @seealso
968 Notation Reference:
969 @ref{Graphic},
970 @ref{Editorial annotations}.
971
972 Snippets:
973 @rlsr{Text}.
974
975 Internals Reference: @rinternals{TextScript}.
976
977 Installed files:
978 @file{scm/@/define@/-markup@/-commands@/.scm},
979 @file{scm/@/stencil@/.scm}.
980
981 @node Music notation inside markup
982 @subsubsection Music notation inside markup
983
984 Various musical notation elements may be added
985 to a score, inside a markup object.
986
987 Notes and accidentals can be entered using specific
988 commands:
989
990 @lilypond[quote,verbatim,fragment,relative=2]
991 a2 a^\markup {
992   \note #"4" #1
993   =
994   \note-by-number #1 #1 #1.5
995 }
996 b1_\markup {
997   \natural \semiflat \flat
998   \sesquiflat \doubleflat
999 }
1000 \glissando
1001 a1_\markup {
1002   \natural \semisharp \sharp
1003   \sesquisharp \doublesharp
1004 }
1005 \glissando b
1006 @end lilypond
1007
1008 Other notation objects may also be printed
1009 in markup mode:
1010
1011 @lilypond[quote,verbatim,fragment,relative=1]
1012 g1 bes
1013 ees-\markup {
1014   \finger 4
1015   \tied-lyric #"~"
1016   \finger 1
1017 }
1018 fis_\markup { \dynamic rf }
1019 bes^\markup {
1020   \beam #8 #0.1 #0.5
1021 }
1022 cis
1023 d-\markup {
1024   \markalphabet #8
1025   \markletter #8
1026 }
1027 @end lilypond 
1028
1029 More generally, any available musical symbol may be
1030 included separately in a markup object, as demonstrated
1031 below; an exhaustive list of these symbols and their
1032 names can be found in @ref{The Feta font}.
1033
1034 @lilypond[quote,verbatim,fragment,relative=2]
1035 c2
1036 c'^\markup { \musicglyph #"eight" }
1037 c,4
1038 c,8._\markup { \musicglyph #"clefs.G_change" }
1039 c16
1040 c2^\markup { \musicglyph #"timesig.neomensural94" }
1041 @end lilypond
1042 @c TODO: add \lookup here? -vv
1043
1044 @noindent
1045 Another way of including non-text glyphs is described
1046 in @ref{Fonts explained}.
1047
1048 The markup mode also supports diagrams for specific
1049 instruments:
1050
1051 @lilypond[quote,verbatim,fragment,relative=2]
1052 c1^\markup {
1053   \fret-diagram-terse #"x;x;o;2;3;2;"
1054 }
1055 c^\markup {
1056   \harp-pedal #"^-v|--ov^"
1057 }
1058 c
1059 c^\markup {
1060   \combine
1061     \musicglyph #"accordion.accDiscant"
1062     \combine
1063       \raise #0.5 \musicglyph #"accordion.accDot"
1064       \raise #1.5 \musicglyph #"accordion.accDot"
1065 }
1066 @end lilypond
1067
1068 @c The accordion diagram is actually taken from a snippet.
1069
1070 @noindent
1071 Such diagrams are documented in @ref{Instrument Specific Markup}.
1072
1073 A whole score can even be nested inside a markup object.
1074 In such a case, the nested @code{\score} block must
1075 contain a @code{\layout} block, as demonstrated here:
1076
1077 @lilypond[quote,verbatim,fragment,relative=1]
1078 c4 d^\markup {
1079   \score {
1080     \relative { c4 d e f }
1081     \layout { }
1082   }
1083 }
1084 e f |
1085 c d e f
1086 @end lilypond
1087
1088 An exhaustive list of music notation related commands can be
1089 found in @ref{Music}.
1090
1091 @seealso
1092 Notation Reference:
1093 @ref{Music},
1094 @ref{The Feta font},
1095 @ref{Fonts explained}.
1096
1097 Snippets:
1098 @rlsr{Text}.
1099
1100 Internals Reference: @rinternals{TextScript}.
1101
1102 Installed files:
1103 @file{scm/@/define@/-markup@/-commands@/.scm},
1104 @file{scm/@/fret@/-diagrams@/.scm},
1105 @file{scm/@/harp@/-pedals@/.scm}.
1106
1107 @node Multi-page markup
1108 @subsubsection Multi-page markup
1109
1110 Although standard markup objects are not breakable, a
1111 specific syntax allows to enter lines of text that can
1112 spread over multiple pages:
1113
1114 @lilypond[quote,verbatim]
1115 \markuplines {
1116   \justified-lines {
1117     A very long text of justified lines.
1118     ...
1119   }
1120   \wordwrap-lines {
1121     An other very long paragraph.
1122     ...
1123   }
1124   ...
1125 }
1126 @end lilypond
1127
1128 This specific syntax accepts a list of markups, that can be
1129 @itemize
1130 @item
1131 the result of a markup list command,
1132 @item
1133 a list of markups,
1134 @item
1135 a list of markup lists.
1136 @end itemize
1137
1138 An exhaustive list of markup list commands can be found in
1139 @ref{Text markup list commands}.
1140
1141 @seealso
1142 Notation Reference:
1143 @ref{Text markup list commands},
1144 @ref{New markup list command definition}.
1145
1146 Snippets:
1147 @rlsr{Text}.
1148
1149 Internals Reference: @rinternals{TextScript}.
1150
1151 Installed files:
1152 @file{scm/@/define@/-markup@/-commands@/.scm}.
1153
1154 @predefined
1155 @funindex \markuplines
1156 @code{\markuplines}
1157
1158
1159 @node Fonts
1160 @subsection Fonts
1161
1162 This section presents the way fonts are handled,
1163 and how they may be changed in scores.
1164
1165 @menu
1166 * Fonts explained::
1167 * Single entry fonts::
1168 * Entire document fonts::
1169 @end menu
1170
1171 @node Fonts explained
1172 @subsubsection Fonts explained
1173
1174 @cindex Pango
1175 @cindex fonts, explained
1176 @funindex font-interface
1177
1178 Fonts are handled through several libraries.
1179 FontConfig is used to detect available fonts on the system;
1180 the selected fonts are rendered using Pango.
1181
1182 Music notation fonts can be described as a set of
1183 specific glyphs, ordered in several families.
1184 The following syntax allows to directly use various
1185 LilyPond @code{feta} non-text fonts in markup mode:
1186
1187 @lilypond[quote,verbatim,fragment,relative=2]
1188 a1^\markup {
1189   \vcenter {
1190     \override #'(font-encoding . fetaBraces)
1191     \lookup #"brace120"
1192     \override #'(font-encoding . fetaNumber)
1193     \column { 1 3 }
1194     \override #'(font-encoding . fetaDynamic)
1195     sf
1196     \override #'(font-encoding . fetaMusic)
1197     \lookup #"noteheads.s0petrucci"
1198   }
1199 }
1200 @end lilypond
1201
1202 @noindent
1203 A simpler, but more limited syntax is also described in
1204 @ref{Music notation inside markup}.
1205
1206 Three families of text fonts are made available: the
1207 @emph{roman} (serif) font, that defaults to New Century
1208 Schoolbook, the @emph{sans} font and the monospaced
1209 @emph{typewriter} font -- these last two families are
1210 determined by the Pango installation.
1211
1212 Each family may include different shapes and series.
1213 The following example demonstrates the ability to select
1214 alternate families, shapes, series and sizes:
1215
1216 @lilypond[quote,verbatim,fragment,relative=2]
1217   \override Score.RehearsalMark #'font-family = #'typewriter
1218   \mark \markup "Ouverture"
1219   \key d \major
1220   \override  Voice.TextScript #'font-shape = #'italic
1221   \override  Voice.TextScript #'font-series = #'bold
1222   d''2.^\markup "Allegro"
1223   r4
1224 @end lilypond
1225
1226 @noindent
1227 A similar syntax may be used in markup mode, however in this case
1228 it is preferable to use the simpler syntax explained in
1229 @ref{Selecting font and font size}:
1230
1231 @lilypond[quote,verbatim]
1232 \markup {
1233   \column {
1234     \line {
1235       \override #'(font-shape . italic)
1236       \override #'(font-size . 4)
1237       Idomeneo,
1238     }
1239     \line {
1240       \override #'(font-family . typewriter)
1241       {
1242         \override #'(font-series . bold)
1243         re
1244         di
1245       }
1246       \override #'(font-family . sans)
1247       Creta
1248     }
1249   }
1250 }
1251 @end lilypond
1252
1253 @ignore
1254 @c FIXME: This needs an example -vv
1255
1256 The size of the font may be set with the @code{font-size}
1257 property.  The resulting size is taken relative to the
1258 @code{text-font-size} as defined in the @code{\paper} block.
1259 @end ignore
1260
1261 Although it is easy to switch between preconfigured fonts,
1262 it is also possible to use other fonts, as explained in the
1263 following sections: @ref{Single entry fonts} and
1264 @ref{Entire document fonts}.
1265
1266 @seealso
1267 Notation Reference:
1268 @ref{The Feta font},
1269 @ref{Music notation inside markup},
1270 @ref{Selecting font and font size},
1271 @ref{Font}.
1272
1273 @node Single entry fonts
1274 @subsubsection Single entry fonts
1275
1276 Any font that is installed on the operating system and recognized
1277 by FontConfig may be used in a score, using the following syntax:
1278
1279 @lilypond[quote,verbatim,fragment,relative=1]
1280 \override Staff.TimeSignature #'font-name = #"Charter"
1281 \override Staff.TimeSignature #'font-size = #2
1282 \time 3/4
1283
1284 c1_\markup {
1285   \override #'(font-name . "Vera Bold")
1286     { Vera Bold }
1287 }
1288 @end lilypond
1289
1290 @funindex show-available-fonts
1291
1292 The following command displays a list of all available fonts
1293 on the operating system:
1294
1295 @example
1296 lilypond -dshow-available-fonts x
1297 @end example
1298
1299 @noindent
1300 The last argument of the command can be anything, but has to be
1301 present.
1302
1303 @seealso
1304 Notation Reference:
1305 @ref{Fonts explained},
1306 @ref{Entire document fonts}.
1307
1308 Snippets:
1309 @rlsr{Text}.
1310
1311 Installed files:
1312 @file{lily/@/font@/-config@/-scheme@/.cc}.
1313
1314 @node Entire document fonts
1315 @subsubsection Entire document fonts
1316
1317
1318 It is possible to change the default font families for the
1319 entire document.  In such a case, the following syntax has
1320 to be used, by providing three font families that will be
1321 respectively used as @emph{roman}, @emph{sans} and @emph{typewriter}
1322 fonts, as explained in @ref{Fonts explained}.
1323
1324 @cindex font families, setting
1325 @funindex make-pango-font-tree
1326
1327 @lilypond[verbatim,quote]
1328 \paper  {
1329   myStaffSize = #20
1330   #(define fonts
1331     (make-pango-font-tree "Times New Roman"
1332                           "Nimbus Sans"
1333                           "Luxi Mono"
1334                            (/ myStaffSize 20)))
1335 }
1336
1337 \relative c'{
1338   c1-\markup {
1339     roman,
1340     \sans sans,
1341     \typewriter typewriter. }
1342 }
1343 @end lilypond
1344
1345 @c we don't do Helvetica / Courier, since GS incorrectly loads
1346 @c Apple TTF fonts
1347
1348 @seealso
1349 Notation Reference:
1350 @ref{Fonts explained},
1351 @ref{Single entry fonts},
1352 @ref{Selecting font and font size},
1353 @ref{Font}.
1354