Next: , 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.

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 }

[image of music]

Any font can be used, as long as it is available to Pango/FontConfig. To get a full list of all available fonts, run the command

lilypond -dshow-available-fonts blabla

(the last argument of the command can be anything, but has to be present).

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 }

[image of music]

See also

Examples: input/regression/

Next: , Previous: Overview of text markup commands, Up: Text

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

Report errors to