Changing fonts

It is possible to change the fonts used in LilyPond’s default font families.

\paper {
  property-defaults.fonts.serif = "Linux Libertine O"
  property-defaults.fonts.sans = "DejaVu Sans"
  property-defaults.fonts.typewriter = "DejaVu Sans Mono"
}

\relative c'{
  c1-\markup {
    serif,
    \sans sans,
    \typewriter typewriter. }
}

[image of music]

The same syntax can be used to change the music font; see Replacing the notation font.

To change the fonts used for one specific grob, or one specific part of a markup, override the fonts property. The following example changes the font for normal tablature “note heads” (which use the serif family) while keeping the default font for those that are drawn as a cross (which use the music family).

\layout {
  \override TabVoice.TabNoteHead.property-defaults.fonts.serif =
    "Linux Libertine O"
}

\new TabStaff { c' d' e' \deadNote c' }

[image of music]

Below is an example for overriding fonts in markup:

\markup \override #'(fonts . ((serif . "Linux Libertine O")
                              (typewriter . "DejaVu Sans Mono"))) {
  Copyright © John Doe \typewriter john@doe.org
}

[image of music]

See also

Notation Reference: Finding fonts, Font families, Selecting font and font size, Font markup, Replacing the notation font.


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