CKTIS / CSS
font-format() — font format support query
`font-format()` is a supports condition asking whether the UA can use a specified font format for layout and rendering.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
font-format( <font-format> )font-format() is a supports condition asking whether the UA can use a specified font format for layout and rendering.
The example tests font-format(woff2) and gets true; its matching @supports branch gives the element width 42px. font-format(cktis-unknown) returns false, so that branch does not apply.
Grammar: font-format( <font-format> ).
The imported <font-format> grammar admits both a keyword such as woff2 and a string such as "woff2", but CSS Conditional 5 requires the string form of the query to evaluate false; use the keyword form to test support. The query tests engine capability, not whether a particular file exists, contains valid data, or downloads successfully. The format() format-hint function occurs inside the src descriptor of an @font-face rule and is not itself a descriptor; font-format() remains a supports-condition leaf and still requires an ordinary font fallback.
Examples
const probe=document.createElement('div');probe.id='format-probe';document.body.append(probe);
const style=document.createElement('style');
style.textContent='@supports font-format(woff2){#format-probe{width:42px}}@supports font-format(cktis-unknown){#format-probe{width:99px}}';
document.head.append(style);
const woff2=CSS.supports('font-format(woff2)');
const unknown=CSS.supports('font-format(cktis-unknown)');
console.log('woff2='+woff2+'; unknown='+unknown+'; applied-width='+getComputedStyle(probe).width);Result
woff2=true; unknown=false; applied-width=42px
`font-format()` is a supports condition asking whether the UA can use a specified font format for layout and rendering.