Do Chrome, Firefox and Safari match font-style (normal,
italic, oblique, slnt) the way CSS Fonts 4 says?
A reference implementation of the spec decides what each case should do; the browsers are tested against it.
@font-face descriptor × use-site CSS
One font, one glyph under test: real Cairo (slnt −11..11), subset to
the letters of OBLIQUE, tested on the capital I. Columns (A, B, C…) are what the
@font-face declares; rows (1, 2, 3…) are the CSS at the use site, and a cell
is its column letter plus its row number. What each cell should do is not decided by hand: an
independent JavaScript implementation of CSS Fonts 4 font-style matching
(reference/) computes it, and never uses a browser to do so.
Every cell states what the reference expects. Where the spec pins the outcome down
(“spec: slnt −11”) the cell is a WPT test for that one rendering. Where it allows several
outcomes (“spec*: slnt 0 / synth”) a test can only forbid some of them, so an engine can pass and
still render something different from the others: that is an interop problem, and the cell is amber.
Where nothing testable is excluded, the cell is only measured. font-synthesis is left at its default in rows 1 to 7, since synthesis should apply only
when a face is missing; rows 8 and 9 set it on purpose. Each specimen is live in your browser:
pink is a rendering the spec accepts, cyan is the CSS
under test; aligned they merge into dark blue, and visible pink is a failure. The circles
are recorded results: Chromium and Firefox from wpt run, Safari from a direct
safaridriver replay (wpt run proved unreliable on Safari).
Candidate for upstreaming; no WPT PR has been opened.
54 cells: 42 interoperable (all three engines render the same allowed thing) · 6 failing (A2, C2, A3, C3, A6, C6: an engine renders what the spec forbids) · 6 diverging (F2, E4, E5, E6, E7, F8: the spec allows several outcomes and the engines chose differently). 2 cells have no WPT test and are only measured.
@font-face {
font-family: "Oblique Test";
src: url(Cairo.var.subset.ttf); /* real Cairo, slnt -11..11, wght 200..1000 */
font-style: <column>;
}AThe font's own range@font-face { font-style: oblique -11deg 11deg; }Declared oblique with the font's true slnt range | BPast the break-point@font-face { font-style: oblique -14deg 14deg; }Declared oblique past CSS's 14deg break-point: the smallest range that reaches beyond the font's own limit (11) and still contains every angle CSS can imply (14deg for bare oblique, 11deg for italic). Ranges are inclusive, so rows 2, 3 and 6 probe the boundary exactly. | CNarrow, one-sided range@font-face { font-style: oblique 0deg 10deg; }Declared oblique, inside the font's range and excluding the negative side (the pattern of Inter's slnt -10..0) | DBare oblique@font-face { font-style: oblique; }Declared oblique, no range (14deg) | ENormal@font-face { font-style: normal; }Declared upright | FAuto@font-face { font-style: auto /* or omitted */ }Descriptor omitted = auto, the initial value. Selected as if normal, but not clamped, so the font's own slnt range applies | |
|---|---|---|---|---|---|---|
1 font-style: normal; | A1 OBLIQUEOBLIQUE | B1 OBLIQUEOBLIQUE | C1 OBLIQUEOBLIQUE | D1 OBLIQUEOBLIQUE | E1 OBLIQUEOBLIQUE | F1 OBLIQUEOBLIQUE |
2 font-style: italic; | A2 OBLIQUEOBLIQUE | B2 OBLIQUEOBLIQUE | C2 OBLIQUEOBLIQUE | D2 OBLIQUEOBLIQUE | E2 OBLIQUE | F2 OBLIQUE |
3 font-style: oblique; | A3 OBLIQUEOBLIQUE | B3 OBLIQUEOBLIQUE | C3 OBLIQUEOBLIQUE | D3 OBLIQUEOBLIQUE | E3 OBLIQUE | F3 OBLIQUEOBLIQUE |
4 font-style: oblique 11deg; | A4 OBLIQUEOBLIQUE | B4 OBLIQUEOBLIQUE | C4 OBLIQUEOBLIQUE | D4 OBLIQUEOBLIQUE | E4 OBLIQUE | F4 OBLIQUEOBLIQUE |
5 font-style: oblique 5deg; | A5 OBLIQUEOBLIQUE | B5 OBLIQUEOBLIQUE | C5 OBLIQUEOBLIQUE | D5 OBLIQUEOBLIQUE | E5 OBLIQUE | F5 OBLIQUEOBLIQUE |
6 font-style: oblique 45deg; | A6 OBLIQUEOBLIQUE | B6 OBLIQUEOBLIQUE | C6 OBLIQUEOBLIQUE | D6 OBLIQUEOBLIQUE | E6 OBLIQUE | F6 OBLIQUEOBLIQUE |
7 font-style: oblique -5deg; | A7 OBLIQUEOBLIQUE | B7 OBLIQUEOBLIQUE | C7 OBLIQUEOBLIQUE | D7 OBLIQUEOBLIQUE | E7 OBLIQUE | F7 OBLIQUEOBLIQUE |
8 font-style: italic; | A8 OBLIQUEOBLIQUE | B8 OBLIQUEOBLIQUE | C8 OBLIQUEOBLIQUE | D8 OBLIQUEOBLIQUE | E8 OBLIQUEOBLIQUE | F8 OBLIQUE |
9 font-style: oblique; | A9 OBLIQUEOBLIQUE | B9 OBLIQUEOBLIQUE | C9 OBLIQUEOBLIQUE | D9 OBLIQUEOBLIQUE | E9 OBLIQUEOBLIQUE | F9 OBLIQUEOBLIQUE |
slnt -11 is an 11° forward slant (CSS angle and slnt have opposite signs), slnt 0 is upright, synth is a synthesized skew (~14° its angle), + synth is one stacked on the axis. Click a specimen for its test file.
Per @font-face descriptor; open a row for the cells behind it. Every column counts the same items:
each cell, and each of the two standalone tests in group Z. An engine column counts where that engine renders an
allowed outcome, which a loose WPT test can pass (a cell with no test, where nothing can fail, counts when the engine
rendered anything). Interop is stricter: it counts an item only when all three engines render the
same allowed thing, so where the spec allows several outcomes and the engines chose differently, it does not count.
@font-face { font-style: oblique -11deg 11deg; }@font-face { font-style: oblique -14deg 14deg; }@font-face { font-style: oblique 0deg 10deg; }@font-face { font-style: oblique; }@font-face { font-style: normal; }@font-face { font-style: auto /* or omitted */ }font-style: italic; spec*: slnt 0 / -11 / synth no testfont-style: italic; font-synthesis-style: none; spec*: slnt 0 / -11 no testhand-written, not cells of the grid
Cells A2, A3, A6 and C2, C3, C6 (italic, bare oblique and oblique 45deg
against a face declared oblique -11deg 11deg or 0deg 10deg, default synthesis): the axis
must clamp and nothing may be synthesized on top. Firefox does that. Chrome stacks a synthetic skew on the axis
(36px lean, expected 16px). Safari stacks for bare oblique and oblique 45deg, and gives a
pure synthetic skew, no axis at all, for italic. Rows 8 and 9 repeat rows 2 and 3 with synthesis off
and pass everywhere, so the failure is the extra skew and nothing else. A range wider than the font's own
(column B, -20deg 20deg) passes all nine rows in all three engines.