Node:Font selection, Next:, Previous:Applyoutput, Up:Tuning output



Font selection

The most common thing to change about the appearance of fonts is their size. The font size of any context can be easily changed by setting the fontSize property for that context. Its value is an integer: negative numbers make the font smaller, positive numbers larger. An example is given below:

       c4 c4 \property Voice.fontSize = #-1
       f4 g4
     

[picture of music]

This command will set font-relative-size (see below), and does not change the size of variable symbols, such as beams or slurs.

One of the uses of fontSize is to get smaller symbol for cue notes. An elaborate example of those is in input/test/cue-notes.ly.

The size of the font may be scaled with the object property font-magnification. For example, 2.0 blows up all letters by a factor 2 in both directions.

The font used for printing a object can be selected by setting font-name, e.g.

       \property Staff.TimeSignature
         \set #'font-name = #"cmr17"
     

Any font can be used, as long as it is available to TeX. Possible fonts include foreign fonts or fonts that do not belong to the Computer Modern font family.

Font selection for the standard fonts, TeX's Computer Modern fonts, can also be adjusted with a more fine-grained mechanism. By setting the object properties described below, you can select a different font; all three mechanisms work for every object that supports font-interface:

font-family
is a symbol indicating the general class of the typeface. Supported are roman (Computer Modern), braces (for piano staff braces), music (the standard music font, including ancient glyphs), dynamic (for dynamic signs) 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.
font-relative-size
is a number indicating the size relative the standard size. For example, with 20pt staff height, relative size -1 corresponds to 16pt staff height, and relative size +1 corresponds to 23 pt staff height.

There are small differences in design between fonts designed for different sizes, hence font-relative-size is preferred over font-magnification for changing font sizes.

font-design-size
is a number indicating the design size of the font.

This is a feature of the Computer Modern Font: each point size has a slightly different design. Smaller design sizes are relatively wider, which enhances readability.

For any of these properties, the value * (i.e. the symbol *, entered as #'*), acts as a wildcard. This can be used to override default setting, which are always present. For example:

       \property Lyrics . LyricText \override #'font-series = #'bold
       \property Lyrics . LyricText \override #'font-family = #'typewriter
       \property Lyrics . LyricText \override #'font-shape  = #'*
     

Predefined commands

The following commands set fontSize for the current voice.

\tiny, \small, \normalsize,

Bugs

Relative size is not linked to any real size.

There is no style sheet provided for other fonts besides the TeX family, and the style sheet cannot be modified easily.


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

Report errors to <bug-lilypond@gnu.org>.