The first line shows the text with no variations.
The second line animates the weight.
The third line animations the width.
The fourth line animates both.
hamburgefonstiv
hamburgefonstiv
hamburgefonstiv
hamburgefonstiv
<div style="font-weight: 632;">hamburgefonstiv</div>
<div style='font-stretch: 83.7%;'>hamburgefonstiv</div>
// Note: No change! The browser can enable variation italics automatically.
<div style="font-style: italic;">hamburgefonstiv</div>
<div style="
font-variation-settings: 'fncy' 9001;">hamgurgefonstiv</div>
@keyframes zooming {
from {
font-variation-settings: 'wght' 400, 'wdth' 85;
}
to {
font-variation-settings: 'wght' 800, 'wdth' 105;
}
}
<div style="animation-duration: 3s;
animation-name: zooming;">hamburgefonstiv</div>
@font-face {
// Note that this is identical to what you currently do today!
font-family: "VariationFont";
src: url("VariationFont.otf");
}
<div style="font-family: 'VariationFont';"> hamburgefonstiv</div>
@font-face {
font-family: 'FancyFont';
src: url("FancyFont.otf") format("opentype-variations"), url("FancyFont-600.otf") format("opentype");
font-weight: 600;
// Old browsers would fail to parse "615",
// so it would be ignored and 600 remains.
// New browsers would parse it correctly so 615 would win.
// Note that, because of the font selection
// rules, the font-weight descriptor above may
// be sufficient thereby making the font-weight
// descriptor below unnecessary.
font-weight: 615;
}
#fancy {
font-family: "FancyFont";
font-weight: 600;
font-weight: 615;
}
<div id="fancy">hamburgefonstiv</div>
@font-face {
font-family: "VariationFont";
src: url("VariationFont.otf");
font-weight: 400;
}
<div style="font-family: VariationFont; font-weight: 300;">hamburgefonstiv</div>
<div style="font-family: VariationFont; font-weight: 700;">hamburgefonstiv</div>
@font-face {
font-family: "SegmentedVariationFont";
src: url("SegmentedVariationFont-LightWeights.otf");
font-weight: 1;
}
@font-face {
// There is complication here due to the peculiar nature of the font selection rules.
// Note how this block uses the same source file as the block below.
font-family: "SegmentedVariationFont";
src: url("SegmentedVariationFont-HeavyWeights.otf");
font-weight: 301;
}
@font-face {
font-family: "SegmentedVariationFont";
src: url("SegmentedVariationFont-HeavyWeights.otf");
font-weight: 999;
}