Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

Library definitions now support a fonts key, for preloading of fonts.

Previously Drupal did not provide an API for font preloading, although there were patterns such as adding the links manually to the html header template.

Fonts to be preloaded can now be declared at the same level as CSS and JavaScript in the library definition, and a <link rel="preload" element will be added to the HTML header programmatically.

Note that setting preload: false in a definition is the same as not including a font in the definition, it has no effect.

global-styling:
  version: VERSION
  fonts:
    fonts/metropolis/Metropolis-Regular.woff2:
      preload: true

Fonts should be preloaded when they're very likely to block rendering above the fold. See https://web.dev/learn/performance/optimize-web-fonts for more details

Impacts: 
Module developers
Themers