CKTIS / CSS
font-tech() — Abfrage einer Schrifttechnologie
`font-tech()` ist eine supports-Bedingung für eine in Schriften implementierte Funktion und nicht für das Containerformat einer Schriftdatei.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
font-tech( <font-tech> )font-tech() ist eine supports-Bedingung für eine in Schriften implementierte Funktion und nicht für das Containerformat einer Schriftdatei.
Das Beispiel erhält true für font-tech(variations) und font-tech(color-colrv1); der Variationszweig setzt tatsächlich den Zeichenabstand 7px. font-tech(cktis-unknown) ergibt false und überschreibt ihn nicht.
Grammatik: font-tech( <font-tech> ).
Technologienamen umfassen features-opentype, Variationen, Farbschrifttechnologien und palettes. Ein wahres Ergebnis bedeutet, dass der UA die Technik verwenden kann, nicht dass die ausgewählte Schrift erforderliche Tabellen oder Glyphen enthält. Nutze die Bedingung für Verbesserungen mit lesbarem Fallback; das Containerformat prüft getrennt font-format().
Beispiele
const probe=document.createElement('div');probe.id='tech-probe';probe.textContent='variable';document.body.append(probe);
const style=document.createElement('style');
style.textContent='@supports font-tech(variations){#tech-probe{letter-spacing:7px}}@supports font-tech(cktis-unknown){#tech-probe{letter-spacing:19px}}';
document.head.append(style);
const variations=CSS.supports('font-tech(variations)');
const colrv1=CSS.supports('font-tech(color-colrv1)');
const unknown=CSS.supports('font-tech(cktis-unknown)');
console.log('variations='+variations+'; color-colrv1='+colrv1+'; unknown='+unknown+'; applied-spacing='+getComputedStyle(probe).letterSpacing);Ergebnis
variations=true; color-colrv1=true; unknown=false; applied-spacing=7px
`font-tech()` ist eine supports-Bedingung für eine in Schriften implementierte Funktion und nicht für das Containerformat einer Schriftdatei.