Skip to content

Conversation

@BenoitHiller
Copy link

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

@nextjs-bot nextjs-bot added Turbopack Related to Turbopack with Next.js. type: next labels Dec 6, 2025
@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Dec 6, 2025

Allow CI Workflow Run

  • approve CI run for commit: 87affba

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

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 back
with the release of Mojave.

Switching out the user agent for an equivalent windows one will ensure
that the font hinting is included, dramatically improving the rendering
of most fonts on 1x resolution screens where font hinting is enabled.

This seems to result in a roughly 20% increase in the size of the
fetched fonts.
@BenoitHiller BenoitHiller force-pushed the font_fetch_user_agent branch from 5de290d to 87affba Compare December 6, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Turbopack Related to Turbopack with Next.js. type: next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimizations performed on next/font/google fonts are able to dramatically change the appearance of rendered text

2 participants