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