web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
5.01k stars 3.11k forks source link

Are these font tests correct? #36473

Open nt1m opened 2 years ago

nt1m commented 2 years ago

css/css-fonts/font-weight-bolder-001.xht css/css-fonts/font-weight-lighter-001.xht css/css-fonts/font-weight-normal-001.xht

I've been going through font failures in WebKit and I came across these 3 tests that fail the same way across all 3 browser engines.

@jfkthame @litherum @drott Are these tests correct?

jfkthame commented 2 years ago

Note that these tests require the CSSTest font collection to be installed.

The results I see on wpt.fyi indicate that the required test fonts were not installed for the test runs reported there, so they're not useful.

Locally, with the fonts installed I'm seeing the bolder and lighter tests passing in Firefox, and only one discrepancy in the normal test (not sure yet whether that's a test error or a browser issue). In Chrome, they also mostly pass though there are a handful of entries in the bolder and lighter tests that don't match, and the same normal discrepancy as in Firefox.

So I haven't been through the tests in detail but I suspect they're probably correct; they just have the problem that they're dependent on a custom collection of fonts being installed.

Given that Safari doesn't allow locally-installed fonts to be used, I guess these tests can't work there.

(I suppose the test files could be converted to use @font-face to load the fonts, but browsers may not handle font matching for webfont-defined families in quite the same way as installed fonts -- certainly, per spec the relevant style attributes are handled differently, as they come from the @font-face descriptors rather than the font resource -- so that wouldn't be entirely equivalent.)

nt1m commented 2 years ago

Thanks @jfkthame! It sounds like we should either:

svgeesus commented 9 months ago

I would suggest changing these tests to use @font-face with the appropriate descriptors and (for consistency) no local-font fallback.