diff --git a/packages/frontend/src/app/layout.tsx b/packages/frontend/src/app/layout.tsx index d16b3ea0..2bf7e704 100644 --- a/packages/frontend/src/app/layout.tsx +++ b/packages/frontend/src/app/layout.tsx @@ -1,19 +1,43 @@ import type { Metadata, Viewport } from 'next'; -import { Geist, Geist_Mono } from 'next/font/google'; +import localFont from 'next/font/local'; import './globals.css'; import { Providers } from './providers'; -const geistSans = Geist({ - subsets: ['latin'], +// Geist and Geist Mono are committed under src/fonts/geist (the variable +// woff2 files of the vercel/geist-font v1.8.1 release, SIL OFL 1.1), so +// `next build` never has to reach Google Fonts. The local loader names the +// font-family after the constant, so `Geist` keeps the family name the app +// had before; the mono face becomes `GeistMono`, as a constant cannot hold a +// space. The upstream files carry more glyphs than Google's subsets (arrows, +// for one), so unicode-range is the union of the subsets Google served: +// characters outside it keep falling back to the system font as before. +const Geist = localFont({ + src: '../fonts/geist/Geist-Variable.woff2', variable: '--font-geist-sans', - weight: ['400', '500', '600', '700'], + weight: '400 700', + style: 'normal', display: 'swap', + declarations: [ + { + prop: 'unicode-range', + value: + 'U+0000-02CC, U+02CE-02D7, U+02DA, U+02DC-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+0400-052F, U+1C80-1C8A, U+1D00-1DBF, U+1E00-1EFF, U+2000-206F, U+20A0-20C4, U+2113, U+2116, U+2122, U+2191, U+2193, U+2212, U+2215, U+2C60-2C7F, U+2DE0-2DFF, U+A640-A69F, U+A720-A7FF, U+FE2E-FE2F, U+FEFF, U+FFFD', + }, + ], }); -const geistMono = Geist_Mono({ - subsets: ['latin'], +const GeistMono = localFont({ + src: '../fonts/geist/GeistMono-Variable.woff2', variable: '--font-geist-mono', - weight: ['400', '500'], + weight: '400 500', + style: 'normal', display: 'swap', + declarations: [ + { + prop: 'unicode-range', + value: + 'U+0000-02CC, U+02CE-02D7, U+02DA, U+02DC-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+0400-052F, U+1C80-1C8A, U+1D00-1DBF, U+1E00-1EFF, U+2000-206F, U+20A0-20C4, U+2113, U+2116, U+2122, U+2191, U+2193, U+2212, U+2215, U+23B8-23BD, U+2500-259F, U+2C60-2C7F, U+2DE0-2DFF, U+A640-A69F, U+A720-A7FF, U+FE2E-FE2F, U+FEFF, U+FFFD', + }, + ], }); import { LicenseWall } from '@/components/license-wall'; import { GoogleTagManager, GoogleTagManagerNoscript } from '@/components/google-tag-manager'; @@ -69,7 +93,7 @@ export default function RootLayout({ const cookieDomain = process.env.COOKIE_DOMAIN; return ( - +