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