Bug 215359 - @font-face font-weight descriptor should reject bolder and lighter
Summary: @font-face font-weight descriptor should reject bolder and lighter
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-10 23:12 PDT by Takeshi Kurosawa
Modified: 2020-08-14 10:35 PDT (History)
9 users (show)

See Also:


Attachments
Patch (9.13 KB, patch)
2020-08-10 23:28 PDT, Takeshi Kurosawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takeshi Kurosawa 2020-08-10 23:12:58 PDT
Both "bolder" and "lighter" are not allowed for @font-face font-weight descriptor.

https://www.w3.org/TR/css-fonts-3/#descdef-font-weight
> Name: 	font-weight
> Value: 	normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 

https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight
> For: 	@font-face
> Value: 	auto | <font-weight-absolute> <font-weight-absolute>?

In WebKit, CSS parser accepts "bolder" and "lighter" and font resolver computes absolute weight from "bolder" and "lighter". This doesn't match other browsers behavior and the specs. Rejecting "bolder" and "lighter" improves interoperability and spec compliance.

WPT.fyi
https://wpt.fyi/results/css/css-fonts/variations/at-font-face-descriptors.html

Firefox's CSS parser rejects "bolder" and "lighter".
https://bugzilla.mozilla.org/show_bug.cgi?id=1454596


Chrome's CSS parser accepts "bolder" and "lighter" and its font resolver doesn't use "bolder" and "lighter" (I think it's confusing).
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/css/font_face.cc;l=661-678;drc=b80faef62a12ac2966f19b014e845a8137718885
Comment 1 Takeshi Kurosawa 2020-08-10 23:28:02 PDT
Created attachment 406367 [details]
Patch
Comment 2 Takeshi Kurosawa 2020-08-14 08:59:40 PDT
Comment on attachment 406367 [details]
Patch

Thank you for reviewing! Could someone land this please?
Comment 3 EWS 2020-08-14 10:34:45 PDT
Committed r265677: <https://trac.webkit.org/changeset/265677>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 406367 [details].
Comment 4 Radar WebKit Bug Importer 2020-08-14 10:35:18 PDT
<rdar://problem/67081913>