The webfonts API that shipped and then changed

6.0 shipped a webfonts API, deprecated the PHP registration form during the release cycle, and settled on declaring fonts in theme.json.

{
  "settings": {
    "typography": {
      "fontFamilies": [{
        "fontFamily": "Inter, sans-serif",
        "name": "Inter",
        "slug": "inter",
        "fontFace": [{
          "fontFamily": "Inter",
          "fontWeight": "100 900",
          "fontStyle": "normal",
          "src": ["file:./assets/fonts/inter-var.woff2"]
        }]
      }]
    }
  }
}

WordPress generates the @font-face rules and a preload hint, which is more than a manual stylesheet usually does. The API churn during 6.0 and 6.1 is the reason to declare fonts here rather than through PHP — the JSON form is the one that survived, and the PHP registration functions were removed before most people had used them.