fontVariations property

List<FontVariation>? fontVariations
final

A list of FontVariations that affect how a variable font is rendered.

Some fonts are variable fonts that can generate multiple font faces based on the values of customizable attributes. For example, a variable font may have a weight axis that can be set to a value between 1 and 1000. FontVariations can be used to select the values of these design axes.

For example, to control the weight axis of the Roboto Slab variable font (https://fonts.google.com/specimen/Roboto+Slab):

const TextStyle(
  fontFamily: 'RobotoSlab',
  fontVariations: <FontVariation>[FontVariation('wght', 900.0)]
)

Font variations can be interpolated via lerp. This is fastest when the same font variation axes are specified, in the same order, in both TextStyle objects. See lerpFontVariations.

See also:

  • fontFeatures, for font variations that have discrete values.

Implementation

final List<FontVariation>? fontVariations;