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

docs: Add explanation about font-display #44001

Merged
merged 5 commits into from Dec 16, 2022

Conversation

hanneslund
Copy link
Contributor

Add explanation and recommendation of font-display.

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have a helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • e2e tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have a helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running pnpm build && pnpm lint
  • The "examples guidelines" are followed from our contributing doc

@hanneslund
Copy link
Contributor Author

Ping @leerob

@kodiakhq kodiakhq bot merged commit e57edff into vercel:canary Dec 16, 2022
@@ -22,6 +22,12 @@ To get started, install `@next/font`:
npm install @next/font
```

### Choosing font-display

[`font-display`](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display) lets you to control how your font is displayed while it's loading. `@next/font` uses `font-display: optional` by default. When the primary font used by `@next/font` does not load within 100ms, the auto generated fallback font will be displayed in the browser. While it is automatically generated to be as visually similar to the primary font as possible to reduce layout shift, it does come with the tradeoff that your intended font might not be shown on slower networks unless it's cached.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"might not be shown on slower networks unless it's cached."

I don't understand how caching affects the first display of the font. If the network is slow, and it takes longer than 100ms, it doesn't matter if it's cached - right?

Or is this trying to say that on the next visit it would be shown since it is now cached in the user's browser from the first session?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is this trying to say that on the next visit it would be shown since it is now cached in the user's browser from the first session?

Yeah, this. Unless it's in cache.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants