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-4] 90-degree oblique means? #10084

Open
SamB opened this issue Mar 14, 2024 · 1 comment
Open

[css-fonts-4] 90-degree oblique means? #10084

SamB opened this issue Mar 14, 2024 · 1 comment
Labels
css-fonts-4 Current Work

Comments

@SamB
Copy link
Contributor

SamB commented Mar 14, 2024

So I noticed that https://drafts.csswg.org/css-fonts-4/#propdef-font-style lets you do this:

https://developer.mozilla.org/en-US/play?id=RwqvczHT9BBF%2FM%2Fui2mK8HA%2BoFvn%2FYaKPD7JcaMY3ES4yxk%2BckvLxowPWfSIOAOGeAIk6TiLXNHbgkrG

<body>Hi.</body>
/* A font with no italic/oblique face */
@import url(https://cdn.jsdelivr.net/npm/@fontsource/unifont/index.min.css);

body {
  font-family: Unifont;
  font-style: oblique 90deg;
}

In Chrome, this apparently just synthesizes a 12 degree oblique or whatever, which is apparently totally okay because
the spec doesn't say which oblique faces a user agent may synthesize, so that's not super interesting.

Firefox seems to try to actually do 90 degree oblique, but it's a little hard to tell because I'm pretty sure the transformation isn't actually defined mathematically at that point?

What should actually happen here? It would probably be a good idea to at least add a note that ±90deg doesn't really make sense, suggest browsers consider clamping synthesis to a smaller range, and add wpt tests to make sure browsers at least don't crash if they actually try to synthesize that.

(Font designers would presumably be able to see that this does not make sense, and in any case, this spec doesn't seem to define validity for fonts themselves.)

@svgeesus
Copy link
Contributor

svgeesus commented Mar 14, 2024

CSS Values 4 only supports closed ranges and thus we have to write that values in the range 90deg to -90deg inclusive are allowed.

The OpenType spec gives the same range, but exclusive:

Valid numeric range: Values must be greater than -90 and less than +90.

You are correct that implementations may struggle with, say, a perfectly legal 89.999deg slope angle and the end result is unlikely to be typographically satisfying.

But just because a thing is possible does not mean it should be done; I don't see us declaring that slope angles greater than 60 degrees are silly in the same way that we don't prevent setting the width of <body> to 2px.

@svgeesus svgeesus added the css-fonts-4 Current Work label Mar 14, 2024
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

2 participants