Selecting font and font size

Basic font switching is supported in markup mode:

\relative {
  d''1^\markup {
    \bold { Più mosso }
    \italic { non troppo \underline Vivo }
  }
  r2 r4 r8
  d,_\markup { \italic quasi \smallCaps Tromba }
  f1 d2 r
}

[image of music]

The global text size to be used in markups can be set with the text-font-size paper variable. This is useful to adjust to a different main font that might appear smaller or larger despite of having the same nominal font sizes. The value is given in points (without specifying a unit); the default value depends on the staff height and is computed as (staff-height / 20 * 11).

See Distances and measurements for more information on dimensions used by LilyPond.

\score {
  { f'^"Default text size" }
  \layout { text-font-size = 10 }
}

\score {
  { f'^"Default text size" }
  \layout { text-font-size = 20 }
}

[image of music]

The font size can be altered, relative to the global text size, in a number of different ways.

It can be set to predefined size.

\relative b' {
  b1_\markup { \huge Sinfonia }
  b1^\markup { \teeny da }
  b1-\markup { \normalsize camera }
}

[image of music]

It can be set relative to its previous value.

\relative b' {
  b1_\markup { \larger Sinfonia }
  b1^\markup { \smaller da }
  b1-\markup { \magnify #0.6 camera }
}

[image of music]

It can be increased or decreased relative to the value set by the global staff size.

\relative b' {
  b1_\markup { \fontsize #-2 Sinfonia }
  b1^\markup { \fontsize #1 da }
  b1-\markup { \fontsize #3 camera }
}

[image of music]

It can also be set to a fixed point size, regardless of the global staff size.

\relative b' {
  b1_\markup { \abs-fontsize #20 Sinfonia }
  b1^\markup { \abs-fontsize #8 da }
  b1-\markup { \abs-fontsize #14 camera }
}

[image of music]

If the text includes spaces, then it is best to put it all inside quote marks, so that the size of each space is appropriate for the size of the other characters.

\markup \fontsize #6 \bold { Sinfonia da camera }
\markup \fontsize #6 \bold { "Sinfonia da camera" }

[image of music]

Text may be printed as subscript or superscript. By default these are printed in a smaller size, but a normal size can be used as well:

\markup {
  \column {
    \line { 1 \super st movement }
    \line { 1 \normal-size-super st movement
      \sub { (part two) }  }
  }
}

[image of music]

The markup mode provides an easy way to select alternate font families. A serif font is selected by default unless specified otherwise; on the last line of the following example, there is no difference between the first and the second word.

\markup {
  \column {
    \line { Act \number 1 }
    \line { \sans { Scene I. } }
    \line { \typewriter { Verona. An open place. } }
    \line { Enter \serif Valentine and Proteus. }
  }
}

[image of music]

Some of these font families, used for specific items such as numbers or dynamics, do not provide all characters, as mentioned in New dynamic marks and Manual repeat marks.

When used inside a word, some font-switching or formatting commands may produce an unwanted blank space. This can easily be solved by concatenating the text elements together:

\markup {
  \column {
    \line {
      \concat { 1 \super st }
      movement
    }
    \line {
      \concat { \dynamic p , }
      \italic { con dolce espressione }
    }
  }
}

[image of music]

An exhaustive list of font switching commands and custom font usage commands can be found in Font markup.

Defining custom font sets is also possible, as explained in Fonts.

Predefined commands

\teeny, \tiny, \small, \normalsize, \large, \huge, \smaller, \larger.

See also

Notation Reference: Font markup, New dynamic marks, Manual repeat marks, Fonts.

Installed Files: scm/define-markup-commands.scm.

Snippets: Text.

Internals Reference: TextScript.

Known issues and warnings

Using the font sizing commands \teeny, \tiny, \small, \normalsize, \large, and \huge will lead to inconsistent line spacing compared to using \fontsize.


LilyPond Notation Reference v2.25.20 (development-branch).