Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-fonts] Consider always serializing the angle for font-style: oblique #8291

Open
nt1m opened this issue Jan 9, 2023 · 7 comments
Open
Labels
css-fonts-4 Current Work

Comments

@nt1m
Copy link
Member

nt1m commented Jan 9, 2023

Right now, the angle should only be serialized "if specified" according to the spec.
http://w3c.github.io/csswg-drafts/css-fonts-4/#font-style-prop

Given the default angle has changed from 20deg to 14deg, I think it is better to always serialize the angle for backwards compatibility, since a website may expect oblique to mean either.

@nt1m
Copy link
Member Author

nt1m commented Jan 10, 2023

cc @litherum @jfkthame @svgeesus @lilles @emilio What do you think?

@litherum
Copy link
Contributor

I think it's a great idea! I don't see a downside (other than it kind of violates the shortest serialization principle), but being explicit about what oblique means seems like a good idea. Especially if it changes in the future!

@jfkthame
Copy link
Contributor

It would mean that the serialized form would be incompatible with older UAs that only support the oblique keyword, but not the specification of an angle. IMO we should stay with the backward-compatible shortest serialization, and omit the angle when it is the default value.

@nt1m
Copy link
Member Author

nt1m commented Jan 10, 2023

@jfkthame The problem is that "default angle" means 20deg or 14deg depending on the browser version, and that is problematic for backwards compatibility.

If a website developed for an older UA reads oblique they are more likely going to assume 20deg than 14deg.

oblique has a different meaning on an older UA vs. current UA.

@jfkthame
Copy link
Contributor

jfkthame commented Jan 10, 2023

oblique dates back to (at least) CSS 2.1, and AFAIK did not originally say anything about the angle, only that it should select a face labelled as being oblique. CSS Fonts 3 also didn't specify an angle.

I don't think old sites or browsers tended to assume anything specific about the angle of slant.

(In gecko, at least, I don't recall ever having a 20° slant, although it may at one time have been somewhat platform-dependent rather than being explicitly managed.)

What I'm uncomfortable about here is that we'd be changing the serialization of font-style: oblique, a value which has existed "forever", to a new form of serialization that existing code may stumble over.

[edit: Checking the history of CSS Fonts 4, it seems 20deg was given as the default in the FPWD in 2017. However, it was changed to 14deg already the next year.]

@svgeesus
Copy link
Contributor

Checking the history of CSS Fonts 4, it seems 20deg was given as the default in the FPWD in 2017. However, it was changed to 14deg already the next year.

Right, although I recall seeing some 20deg assumptions in WPT fairly recently, like in the last year.

I understand the concern about backwards compat with in-the-wild code that was correct with CSS2 or CSS Fonts 3, but also understand the concern about 14deg vs. 20deg which affects more modern code. Not seeing an obvious path forward here.

@litherum
Copy link
Contributor

(Up until this week, WebKit used 20deg instead of 14deg.)

@fantasai fantasai added the css-fonts-4 Current Work label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-fonts-4 Current Work
Projects
None yet
Development

No branches or pull requests

5 participants