Font selection - GNU LilyPond
Description: GNU LilyPond

Next: New dynamic marks, Previous: Overview of text markup commands, Up: Text

#### 8.1.7 Font selection

By setting the object properties described below, you can select a font from the preconfigured font families. LilyPond has default support for the feta music fonts. Text fonts are selected through Pango/FontConfig. The serif font defaults to New Century Schoolbook, the sans and typewriter to whatever the Pango installation defaults to.

- `font-encoding` is a symbol that sets layout of the glyphs. This should only be set to select different types of non-text fonts, e.g.

  `fetaBraces` for piano staff braces, `fetaMusic` the standard music font, including ancient glyphs, `fetaDynamic` for dynamic signs and `fetaNumber` for the number font.

- `font-family` is a symbol indicating the general class of the typeface. Supported are `roman` (Computer Modern), `sans`, and `typewriter`.
- `font-shape` is a symbol indicating the shape of the font. There are typically several font shapes available for each font family. Choices are `italic`, `caps`, and `upright`.
- `font-series` is a symbol indicating the series of the font. There are typically several font series for each font family and shape. Choices are `medium` and `bold`.

Fonts selected in the way sketched above come from a predefined style sheet. If you want to use a font from outside the style sheet, then set the `font-name` property,

    {
      \override Staff.TimeSignature #'font-name = #"Charter"
      \override Staff.TimeSignature #'font-size = #2
      \time 3/4
      c'1_\markup {
        \override #'(font-name . "Vera Bold")
          { This text is in Vera Bold }
      }
    }

Any font can be used, as long as it is available to Pango/FontConfig.

The size of the font may be set with the `font-size` property. The resulting size is taken relative to the `text-font-size` as defined in the `\paper` block.

It is also possible to change the default font family for the entire document. This is done by calling the `make-pango-font-tree` from within the `\paper` block. The function takes names for the font families to use for roman, sans serif and monospaced text. For example,

    \paper  {
      myStaffSize = #20

      #(define fonts
        (make-pango-font-tree "Times New Roman"
                              "Nimbus Sans"
                              "Luxi Mono"
                               (/ myStaffSize 20)))
    }

    {
      c'^\markup { roman: foo \sans bla \typewriter bar }
    }

##### See also

Examples: `input/regression/font-family-override.ly`.

This page is for LilyPond-2.8.8 (stable-branch).

Other languages: English.
Using automatic language selection.