v154 · font-width

Two names, one value

An alias has to work in both directions. These probes construct a real FontFace, write through one name, and read through the other — then do it the other way round, because a one-way mapping is a different thing entirely.

Write one, read the other

Running…

Each probe, and what it read back
probewroteread backaliased?

The FontFace objects here are never added to the document and never load — a descriptor is readable on a constructed face regardless, which is what makes this probe cheap and side-effect free.

code path

// Construct with the new name, read the old one.
const a = new FontFace("Probe", "url(about:invalid)", { width: "75%" });
a.stretch;   // "75%" if they are the same slot

// Construct with the old name, read the new one.
const b = new FontFace("Probe", "url(about:invalid)", { stretch: "75%" });
b.width;     // "75%"

// And assignment has to propagate too, not just construction.
b.width = "125%";
b.stretch;   // "125%"

see also