Part 04 / Topic 3 of 8
The font setup this harness already had, finally explained
Part 1 toured harness/app/layout.tsx without ever explaining its two font imports. They've been there since the very first create-next-app scaffold:
import { Geist, Geist_Mono } from "next/font/google";
const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] });
const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] });
next/font/google self-hosts the font — the installed package's own fonts guide: "Fonts are included as static assets and served from the same domain as your deployment, meaning no requests are sent to Google by the browser when the user visits your site." Verified directly against this harness, not assumed:
$ curl -s http://localhost:PORT/ | grep -c "fonts.googleapis.com"
0
$ curl -s -D - -o /dev/null http://localhost:PORT/ | grep -i "^Link:"
Link: </_next/static/media/07a39a8a4660cc7c-s.p.0r6juujl39pe6.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2", </_next/static/media/605ce01b664af129-s.p.0wgildi0cnwt9.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"
Zero references to Google's own domain anywhere in the page; the two font files are preloaded from /_next/static/media/, this app's own origin. Both woff2 files exist because two separate font objects were created, Geist and Geist_Mono, one per <link rel="preload">.
Done here? The practice set for Part 4 — including the solutions — is on the part page.