From 8a6a0c2dca0fcb1398d17b3b1f70a1f6dd7d3021 Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 22 Jan 2026 16:21:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor(fonts):=20=E5=B0=86Google=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E6=9B=BF=E6=8D=A2=E4=B8=BA=E6=9C=AC=E5=9C=B0=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用本地字体文件替代Google字体,提升加载性能并避免隐私问题 --- src/app/layout.tsx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 7fe1c44..221ba50 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,20 +4,32 @@ import { TooltipProvider } from "@/components/ui/tooltip"; import { DATA } from "@/data/resume"; import { cn } from "@/lib/utils"; import type { Metadata } from "next"; -import { Geist, Geist_Mono } from "next/font/google"; +import localFont from "next/font/local"; import "./globals.css"; import { FlickeringGrid } from "@/components/magicui/flickering-grid"; -const geist = Geist({ - subsets: ["latin"], +const geist = localFont({ + src: [ + { + path: "../../public/fonts/CabinetGrotesk-Medium.ttf", + weight: "500", + style: "normal", + }, + ], variable: "--font-sans", - weight: ["400", "500", "600", "700"], + display: "swap", }); -const geistMono = Geist_Mono({ - subsets: ["latin"], - weight: ["300", "400", "500", "600", "700"], +const geistMono = localFont({ + src: [ + { + path: "../../public/fonts/ClashDisplay-Semibold.ttf", + weight: "600", + style: "normal", + }, + ], variable: "--font-mono", + display: "swap", }); export const metadata: Metadata = {