[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Finding fonts ] | [ Up : Fonts ] | [ Font features > ] |
Font families
Three generic aliases for text font families2 are available: ‘serif’, ‘sans’, and ‘typewriter’. Depending on the backend, these families get mapped to different font family aliases.
For the svg
backend:
generic family SVG font family serif serif sans sans-serif typewriter monospace
‘serif’, ‘sans-serif’, and ‘monospace’ are ‘generic-family’ in SVG and CSS specifications.
For other backends:
generic family default font family alias font families contained in alias serif LilyPond Serif C059, Century SchoolBook URW, Century Schoolbook L, TeX Gyre Schola, DejaVu Serif, …, serif sans LilyPond Sans Serif Nimbus Sans, Nimbus Sans L, TeX Gyre Heros, DejaVu Sans, …, sans-serif typewriter LilyPond Monospace Nimbus Mono PS, Nimbus Mono, Nimbus Mono L, TeX Gyre Cursor, DejaVu Sans Mono, …, monospace
If a character does not exist in the appropriate font of the first listed family, the appropriate font of the next listed family gets used instead for that character.
Note that the URW font families distributed with LilyPond (‘C059’, ‘Nimbus Sans’, and ‘Nimbus Mono PS’) have a peculiarity: By default, in addition to the standard ligatures like ‘fl’ or ‘ffi’, they substitute the string ‘Nr.’ with the Numero Sign (U+2116) if the ‘latn’ script is selected. To circumvent this locally, insert a zero-width non-joiner character (ZWNJ, U+200C) between the ‘N’ and ‘r’ characters. To circumvent this globally, use the following code to make LilyPond always insert a ZWNJ character.
\paper { #(add-text-replacements! `(("Nr." . ,(format #f "N~ar." (ly:wide-char->utf-8 #x200C))))) }
‘LilyPond Serif’, ‘LilyPond Sans Serif’, and ‘LilyPond Monospace’ are font family aliases defined in the additional FontConfig configuration file 00-lilypond-fonts.conf, which can be usually found in directory /usr/local/share/lilypond/2.25.21/fonts, and which is used exclusively by LilyPond.
Each font family may include different shapes and series. The
following example demonstrates that, including code to also change
the size. The value supplied to font-size
is taken
relative to the default font size.
\override Score.TextMark.font-family = #'typewriter \textMark "Ouverture" \override Voice.TextScript.font-shape = #'italic \override Voice.TextScript.font-series = #'bold d''2.^\markup "Allegro" \override Voice.TextScript.font-size = -3 c''4^"smaller"
A similar syntax may be used in markup mode; however, in most cases it is preferable to use the simpler syntax explained in Selecting font and font size:
\markup { \column { \line { \override #'((font-shape . italic) (font-size . 4)) Idomeneo, } \line { \override #'(font-family . typewriter) { \override #'(font-series . bold) re di } \override #'(font-family . sans) Creta } } }
Footnotes
(2)
In its simplest form, a font family usually contains fonts in roman, italic, bold, and bold italic styles.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Finding fonts ] | [ Up : Fonts ] | [ Font features > ] |