Question presented to candidate: "Why would you use next/font instead of a Google Fonts link tag, and what exactly does it generate?"
What a strong answer should cover:
- next/font downloads Google fonts at build time (or uses local files) and serves them from your own domain: no request to Google at runtime.
- It generates
@font-facerules and a class or CSS variable to apply the font. - It creates a fallback font face using a local system font with
size-adjustand ascent/descent overrides so the fallback takes the same space, reducing layout shift. - It preloads the font file for the pages that use it.
- Subsetting (for Google fonts) and
displaycontrol file size and rendering behaviour.
Clarifying questions expected:
- "Is the font from Google or a licensed local file?" β
next/font/googleornext/font/local. - "Which weights and subsets are really used?" β fewer means smaller files.
Code / implementation expected: Yes β a local font with a CSS variable.