next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Fix Google Fonts missing font hinting info

Open BenoitHiller opened this issue 2 weeks ago • 1 comments

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

BenoitHiller avatar Dec 06 '25 21:12 BenoitHiller

Allow CI Workflow Run

  • [ ] approve CI run for commit: 87affba5d3c078493d9161dadda4e64534b2a7f6

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

nextjs-bot avatar Dec 06 '25 21:12 nextjs-bot