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