Selecting notation font size

Note:
For font sizes of text, see Selecting font and font size.
For staff size, see Setting the staff size.
For cue notes, see Formatting cue notes.
For ossia staves, see Ossia staves.

To change the size of the notation without changing the staff size, specify a magnification factor with the \magnifyMusic command:

\new Staff <<
  \new Voice \relative {
    \voiceOne
    <e' e'>4 <f f'>8. <g g'>16 <f f'>8 <e e'>4 r8
  }
  \new Voice \relative {
    \voiceTwo
    \magnifyMusic 0.63 {
      \override Score.SpacingSpanner.spacing-increment = #(* 1.2 0.63)
      r32 c'' a c a c a c r c a c a c a c
      r c a c a c a c a c a c a c a c
    }
  }
>>

[image of music]

The \override in the example above is a bug workaround. See the “Known issues and warnings” at the end of this section.

If a normal sized note head is merged with a smaller one, the size of the smaller note may need to be reset (with ‘\once \normalsize) so that the stems and accidentals align properly:

\new Staff <<
  \key fis \minor
  \mergeDifferentlyDottedOn
  \new Voice \relative {
    \voiceOne
    \magnifyMusic 0.63 {
      \override Score.SpacingSpanner.spacing-increment =
        #(* 1.2 0.63)

      \once \normalsize cis'32( cis' gis b a fis
        \once \normalsize d d'
      \once \normalsize cis, cis' gis b a gis
        \once \normalsize fis fis'
      \once \normalsize fis, fis' ais, cis b gis
        \once \normalsize eis eis'
      \once \normalsize a, a' bis, d cis b
        \once \normalsize gis gis')
    }
  }
  \new Voice \relative {
    \voiceTwo
    cis'8. d16 cis8. fis16 fis8. eis16 a8. gis16
  }
>>

[image of music]

The \magnifyMusic command is not intended for cue notes, grace notes, or ossia staves—there are more appropriate methods of entering each of those constructs. Instead, it is useful when the notation size changes in a single instrumental part on one staff, and where grace notes are not appropriate, such as in cadenza-like passages or in cases such as the above examples. Setting the \magnifyMusic value to 0.63 duplicates the dimensions of the CueVoice context.

Note: The \magnifyMusic command should not be used when also resizing the staff. See section Setting the staff size.

Resizing individual layout objects

An individual layout object can be resized by using the \tweak or \override commands to adjust its font-size property:

\relative {
  % resize a note head
  <f' \tweak font-size -4 b e>-5
  % resize a fingering
  bes-\tweak font-size 0 -3
  % resize an accidental
  \once \override Accidental.font-size = -4 bes!-^
  % resize an articulation
  \once \override Script.font-size = 4 bes!-^
}

[image of music]

The default font-size value for each layout object is listed in the Internals Reference. The font-size property can only be set for layout objects that support the font-interface layout interface. If font-size is not specified in the object’s ‘Standard settings’ list, its value is 0. See All layout objects.

Understanding the fontSize property

The fontSize context property adjusts the relative size of all glyph-based notational elements in a context.1

\relative {
  \time 3/4
  d''4---5 c8( b a g) |
  \set fontSize = -6
  e'4-- c!8-4( b a g) |
  \set fontSize = 0
  fis4---3 e8( d) fis4 |
  g2.
}

[image of music]

The fontSize value is a number indicating the size relative to the standard size for the current staff height. The default fontSize is 0; adding 6 to any fontSize value doubles the printed size of the glyphs, and subtracting 6 halves the size. Each step increases the size by approximately 12%.

The Scheme function magnification->font-size is provided for convenience since the logarithmic units of the font-size property are not entirely intuitive. For example, to adjust the musical notation to 75% of the default size, use:

\set fontSize = #(magnification->font-size 0.75)

The Scheme function magstep does the opposite: it converts a font-size value into a magnification factor.

The fontSize property will only affect notational elements that are drawn with glyphs, such as note heads, accidentals, scripts, etc. It will not affect the size of the staff itself, nor will it scale stems, beams, or horizontal spacing. To scale stems, beams, and horizontal spacing along with the notation size (without changing the staff size), use the \magnifyMusic command discussed above. To scale everything, including the staff size, see Setting the staff size.

Whenever the fontSize context property is set, its value is added to the value of the font-size grob property for individual layout objects, before any glyphs are printed. This can cause confusion when setting individual font-size properties while fontSize is already set:

% the default font-size for NoteHead is 0
% the default font-size for Fingering is -5
c''4-3

\set fontSize = -3
% the effective font size for NoteHead is now -3
% the effective font size for Fingering is now -8
c''4-3

\override Fingering.font-size = 0
% the effective font size for Fingering is now -3
c''4-3

[image of music]

The following shorthand commands are also available:

CommandEquivalent toRelative size
\teeny\set fontSize = -371%
\tiny\set fontSize = -279%
\small\set fontSize = -189%
\normalsize\set fontSize = 0100%
\large\set fontSize = 1112%
\huge\set fontSize = 2126%
\relative c'' {
  \teeny
  c4.-> d8---3
  \tiny
  c4.-> d8---3
  \small
  c4.-> d8---3
  \normalsize
  c4.-> d8---3
  \large
  c4.-> d8---3
  \huge
  c4.-> d8---3
}

[image of music]

Font size changes are achieved by scaling the design size that is closest to the desired size. The standard font size (for font-size = 0) depends on the standard staff height. For a 20pt staff, an 11pt font is selected.

Predefined commands

\magnifyMusic, \teeny, \tiny, \small, \normalsize, \large, \huge.

See also

Notation Reference: Selecting font and font size, Setting the staff size, Formatting cue notes, Ossia staves.

Installed Files: ly/music-functions-init.ly, ly/property-init.ly.

Snippets: Editorial annotations.

Internals Reference: font-interface.

Known issues and warnings

There are currently two bugs that are preventing proper horizontal spacing when using \magnifyMusic. There is only one available workaround, and it is not guaranteed to work in every case. In the example below, replace the mag variable with your own value. You may also try removing one or both of the \newSpacingSection commands, and/or the \override and \revert commands:

\magnifyMusic mag {
  \newSpacingSection
  \override Score.SpacingSpanner.spacing-increment = #(* 1.2 mag)
  [music]
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
}

Footnotes

(1)

Note the words ‘glyph-based’ – a stem, for example, is not a glyph but directly constructed by LilyPond with lines and curves; consequently, it is not affected. The same holds for similar objects like slurs or beams.


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