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