Web Fonts and Variable Fonts

A variable font replaces a family of static files with one file exposing continuous axes. The registered axes are lowercase and map to ordinary properties: wght to font-weight, wdth to font-stretch, ital and slnt to font-style, opsz to font-optical-sizing. Custom axes such as GRAD (grade) are uppercase and reachable only through font-variation-settings. Its @font-face rule declares ranges such as font-weight: 100 1000.

One variable font file at different weights, widths and gradesHTMLLive
<style>
  @import "https://fonts.googleapis.com/css2?family=Roboto+Flex:\
wdth,wght,GRAD@25..151,100..1000,-200..150";
  p { font: 30px "Roboto Flex", sans-serif; margin: 0 8px; }
  .a { font-weight: 150; font-stretch: 151%; }  .b { font-weight: 900; font-stretch: 25%; }
  .c { font-variation-settings: "GRAD" 150; }
</style>
<p><span class="a">Thin and wide</span> · <span class="b">Black and condensed</span></p>
<p>Grade 0 · <span class="c">Grade 150 bolder, same width</span></p>
Browser output of Listing 4.43
Browser output of 43

font-variation-settings values are not merged: a rule that sets only "GRAD" resets every other axis, so feed axes from custom properties and prefer high-level properties. To keep fonts fast: