11/* eslint-disable @next/next/no-css-tags */
22import type { Metadata , Viewport } from "next" ;
33import dynamic from "next/dynamic" ;
4- import { Inter } from "next/font/google" ;
54import localFont from "next/font/local" ;
65
76import GlobalLayout from "@/components/layout/GlobalLayout" ;
@@ -16,18 +15,23 @@ export const metadata: Metadata = {
1615 description : "솔리드 커넥션. 교환학생의 첫 걸음" ,
1716} ;
1817
19- const inter = Inter ( {
20- subsets : [ "latin" ] ,
21- display : "swap" , // FOUT 방지
22- preload : true ,
23- } ) ;
24-
18+ // 🎯 폰트 최적화: 하나의 폰트만 사용
2519const pretendard = localFont ( {
2620 src : "../../public/fonts/PretendardVariable.woff2" ,
27- display : "swap" , // FOUT 방지를 위한 swap 설정
21+ display : "swap" ,
2822 weight : "45 920" ,
2923 variable : "--font-pretendard" ,
30- preload : true , // 폰트 우선 로딩
24+ preload : true ,
25+ // 폰트 로딩 실패 시 fallback 폰트 체인
26+ fallback : [
27+ "system-ui" ,
28+ "-apple-system" ,
29+ "BlinkMacSystemFont" ,
30+ "Apple SD Gothic Neo" ,
31+ "Malgun Gothic" ,
32+ "맑은 고딕" ,
33+ "sans-serif" ,
34+ ] ,
3135} ) ;
3236
3337const KakaoScriptLoader = dynamic ( ( ) => import ( "@/lib/ScriptLoader/KakaoScriptLoader" ) , {
@@ -56,36 +60,41 @@ export const viewport: Viewport = {
5660
5761const RootLayout = ( { children } : { children : React . ReactNode } ) => (
5862 < AlertProvider >
59- < html lang = "ko" >
63+ < html lang = "ko" className = { pretendard . variable } >
6064 < head >
61- { /* Critical 폰트 preload with high priority */ }
65+ { /* 🚀 최우선 폰트 preload */ }
6266 < link
6367 rel = "preload"
6468 href = "/fonts/PretendardVariable.woff2"
6569 as = "font"
6670 type = "font/woff2"
6771 crossOrigin = "anonymous"
6872 />
69- { /* Prevent layout shift with font-display: swap */ }
73+
74+ { /* 폰트 로딩 최적화를 위한 Critical CSS */ }
7075 < style
7176 dangerouslySetInnerHTML = { {
7277 __html : `
73- @font-face {
74- font-family: 'Pretendard';
75- src: url('/fonts/PretendardVariable.woff2') format('woff2');
76- font-weight: 45 920;
77- font-display: swap;
78- font-style: normal;
78+ html {
79+ font-family: var(--font-pretendard), system-ui, -apple-system, sans-serif;
80+ font-synthesis: none;
81+ text-rendering: optimizeLegibility;
82+ -webkit-font-smoothing: antialiased;
83+ -moz-osx-font-smoothing: grayscale;
84+ }
85+ .font-loading {
86+ font-family: system-ui, -apple-system, sans-serif;
7987 }
8088 ` ,
8189 } }
8290 />
91+
8392 { /* DNS prefetch for external resources */ }
8493 < link rel = "dns-prefetch" href = "//www.googletagmanager.com" />
8594 < link rel = "dns-prefetch" href = "//connect.facebook.net" />
8695 < link rel = "dns-prefetch" href = "//t1.kakaocdn.net" />
8796 </ head >
88- < body className = { ` ${ pretendard . className } ${ inter . className } ` } >
97+ < body className = { pretendard . className } >
8998 < KakaoScriptLoader />
9099 < AppleScriptLoader />
91100 < GoogleAnalytics gaId = "G-V1KLYZC1DS" />
0 commit comments