Join GitHub today
[css-fonts] Default angle for font-style:oblique should conform to host platform #2295
Currently the Fonts 4 draft says that if the optional
In order to better match the "native" text rendering of the platform, therefore, Firefox currently uses a platform-specific value when applying a synthetic-italic/oblique effect. I would suggest that this is appropriate behavior for
Moreover, if we must specify a default here, rather than allowing the browser to follow platform conventions, I think
Interesting data, which itself indicates that 20deg is too large.
Could you clarify which angle is used on which platform?
In general I dislike platform-dependent or UA-dependent behaviour, but in this case there is no particular downside to interop (stylesheet authors can always select the value they want, this handling of unspecified value is just for backwards compat). It does makes default-angle testing a bit harder. But I would not oppose this if that is what we decide.
Oh, I picked 20deg because I rendered some characters in a couple non-variable fonts which I thought were representative, took a screenshot, and used a compass and rulers to figure out what their angle was. It’s totally possible that either
I’m all for correcting the measurements I’ve made.
Making the threshold be platform-specific is problematic, because it can cause a totally different font to be chosen for the same input. For example, if there are fonts on the site at angles 19deg and 45deg, moving the threshold from 20deg to 18deg will cause an apparent visual shift of 45deg-19deg=26deg. This is a huge visual difference between platforms with only a tiny difference in threshold.
Gecko implements synthetic-oblique using a "skew factor" defined in https://searchfox.org/mozilla-central/rev/003262ae12ce937950ffb8d3b0fa520d1cc38bff/gfx/thebes/gfxFont.h#61-69:
where this "skew" is the tangent of the resulting oblique angle. So we have (approximately) 16.7° on Windows, 11.3° on Linux, and 14° on macOS.
The Working Group just discussed
The full IRC log of that discussion<dael> Topic: default angle for font-style: oblique
<dael> github: https://github.com//issues/2295
<dael> myles: When css content says font-style:oblique in a non variation world a font is oblique or not. In a variations world that need to be maped to an angle. Variation axis can go between 0 and 90 degrees. When you say font-style:oblique and you don't have an angle where should it go.
<dael> myles: When I wrot the spec I printed paper with representitive fonts and I measure the angle and it looked like 20 deg.
<dael> ChrisL: Based on Jonathan's data the mid-point is 14deg and that's what OSX uses I think that's reasonable.
<dael> florian: Issue had more details about it being platform dependent.
<dael> myles: Spec says it's not and impl made it dependent.
<dael> florian: FF made it dependent becasue it is outside the browser.
<dael> myles: So options are 1) 20deg, 2)14deg 3) make impl pick something.
<dael> astearns: The algo has a whole set of if it's below this pick this
<dael> fantasai: I think that algo should change to lower then 14 then. It should be a lower end to what's consdered normal.
<dael> florian: That would go against leaving it up to ua because we can't do one that's always lower.
<dael> ChrisL: Yes.
<fantasai> s/14 then/14/
<dael> myles: There's 2 pieces. This issue is what should we pick with no angle and it should be 14
<dael> astearns: Obj to using 14 as the oblique angle?
<dael> dbaron: 14 or 14.06? I mention it because Gecko was storing the tan of the angle so we stored 0.25 and the arctan is 14.06
<dael> astearns: Objectiosn to 14 degrees?
<dbaron> 14.036deg is atan(0.25)
<dael> RESOLVED: Use 14 degrees as the angle for undefined oblique
<dael> myles: fantasai should open an issue as to where to put the bounderies.
<dael> fantasai: I suggest 10 for now and then we investigate.
<dael> myles: WE should figure out the answer
<dael> myles: Can we pick 14?
<dael> fantasai: We want it less.
<dael> astearns: I uggest as a part of the resolution edits you say there's an issue and then we can edit in the appropriate thing