Fix Google Fonts missing font hinting info #86909
Open
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Ensure that the fonts fetched from Google Fonts contain font hinting instructions.
Why?
Google Fonts returns files that have the font hinting instructions removed when the user agent is set as OSX. This is almost certainly due to the fact that OSX disabled sub-pixel antialiasing by default with the release of Mojave.
If you are using a lower desity screen and are on windows(or have manually enabled sub-pixel antialiasing on OSX) then the fonts will render poorly without the font hinting.
Google is only able to safely omit this info (in the interest of saving a bit of bandwidth) because they are doing OS detection, unless next.js wants to do the same it should be using the files that render correctly in all environments.
How?
The hardcoded user agent in the font fetching logic was replaced with an equivalent windows one.
Fixes #78118