CKTIS / CSS
@font-feature-values — names for OpenType features
The @font-feature-values rule binds readable identifiers to OpenType feature indices for specified font families.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
@font-feature-values <family-name># {
<feature-value-block-list>
}@font-feature-values <font-family-name-list> { ... } neither loads a font nor activates a typographic feature by itself. It defines a name dictionary for one or more families. Nested blocks such as @styleset, @stylistic, @character-variant, @swash, @ornaments, and @annotation map an identifier to one or more OpenType feature indices.
The identifier is then used by font-variant-alternates, for example as styleset(readable). The browser resolves readable through the @styleset mapping, but a visible result exists only when the actually selected face in the named family contains the corresponding feature. A fallback font does not acquire missing alternate glyphs.
A common trap is treating a valid computed value as proof of a visible variant: font selection, feature support, and font-file content are separate conditions. The example registers readable: 1, applies styleset(readable), and reads both the CSSOM rule and the computed value.
Examples
const style = document.createElement('style');
style.textContent = `@font-feature-values Demo { @styleset { readable: 1; } }
.probe { font-family: Demo, sans-serif; font-variant-alternates: styleset(readable); }`;
document.head.append(style);
const probe = document.createElement('div');
probe.className = 'probe';
probe.textContent = 'CKTIS';
document.body.append(probe);
const rule = style.sheet.cssRules[0];
console.log('rule=' + rule.constructor.name + '; css=' + rule.cssText.replace(/\s+/g, ' ') + '; used=' + getComputedStyle(probe).fontVariantAlternates);Result
rule=CSSFontFeatureValuesRule; css=@font-feature-values Demo { @styleset { readable: 1; } }; used=styleset(readable)The @font-feature-values rule binds readable identifiers to OpenType feature indices for specified font families.