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