@@ -2,69 +2,105 @@ import { useLayoutEffect, useRef, useState } from "react";
22import { useLanguage } from "./languages" ;
33import { useLayoutEffectOnce } from "./hooks/use-effect-once" ;
44
5+ const interFontFaces = [
6+ new FontFace (
7+ "Inter" ,
8+ `url(${ require ( "./public/assets/font/Inter-Regular.ttf" ) } )` ,
9+ {
10+ weight : "400" ,
11+ }
12+ ) ,
13+ new FontFace (
14+ "Inter" ,
15+ `url(${ require ( "./public/assets/font/Inter-Medium.ttf" ) } )` ,
16+ {
17+ weight : "500" ,
18+ }
19+ ) ,
20+ new FontFace (
21+ "Inter" ,
22+ `url(${ require ( "./public/assets/font/Inter-SemiBold.ttf" ) } )` ,
23+ {
24+ weight : "600" ,
25+ }
26+ ) ,
27+ new FontFace (
28+ "Inter" ,
29+ `url(${ require ( "./public/assets/font/Inter-Bold.ttf" ) } )` ,
30+ {
31+ weight : "700" ,
32+ }
33+ ) ,
34+ ] ;
35+
36+ const notoSansSCFontFaces = [
37+ new FontFace (
38+ "NotoSansSC" ,
39+ `url(${ require ( "./public/assets/font/NatoSansSC-Regular.woff2" ) } )` ,
40+ {
41+ weight : "400" ,
42+ }
43+ ) ,
44+ new FontFace (
45+ "NotoSansSC" ,
46+ `url(${ require ( "./public/assets/font/NatoSansSC-Medium.woff2" ) } )` ,
47+ {
48+ weight : "500" ,
49+ }
50+ ) ,
51+ new FontFace (
52+ "NotoSansSC" ,
53+ `url(${ require ( "./public/assets/font/NatoSansSC-SemiBold.woff2" ) } )` ,
54+ {
55+ weight : "600" ,
56+ }
57+ ) ,
58+ new FontFace (
59+ "NotoSansSC" ,
60+ `url(${ require ( "./public/assets/font/NatoSansSC-Bold.woff2" ) } )` ,
61+ {
62+ weight : "700" ,
63+ }
64+ ) ,
65+ ] ;
66+
67+ const notoSansKRFontFaces = [
68+ new FontFace (
69+ "NotoSansKR" ,
70+ `url(${ require ( "./public/assets/font/NotoSansKR-Regular.woff2" ) } )` ,
71+ {
72+ weight : "400" ,
73+ }
74+ ) ,
75+ new FontFace (
76+ "NotoSansKR" ,
77+ `url(${ require ( "./public/assets/font/NotoSansKR-Medium.woff2" ) } )` ,
78+ {
79+ weight : "500" ,
80+ }
81+ ) ,
82+ new FontFace (
83+ "NotoSansKR" ,
84+ `url(${ require ( "./public/assets/font/NotoSansKR-Medium.woff2" ) } )` ,
85+ {
86+ weight : "600" ,
87+ }
88+ ) ,
89+ new FontFace (
90+ "NotoSansKR" ,
91+ `url(${ require ( "./public/assets/font/NotoSansKR-Bold.woff2" ) } )` ,
92+ {
93+ weight : "700" ,
94+ }
95+ ) ,
96+ ] ;
97+
598const languageToFontFaces : {
699 [ lang : string ] : FontFace [ ] | undefined ;
7100} = {
8- en : [
9- new FontFace (
10- "Inter" ,
11- `url(${ require ( "./public/assets/font/Inter-Regular.ttf" ) } )` ,
12- {
13- weight : "400" ,
14- }
15- ) ,
16- new FontFace (
17- "Inter" ,
18- `url(${ require ( "./public/assets/font/Inter-Medium.ttf" ) } )` ,
19- {
20- weight : "500" ,
21- }
22- ) ,
23- new FontFace (
24- "Inter" ,
25- `url(${ require ( "./public/assets/font/Inter-SemiBold.ttf" ) } )` ,
26- {
27- weight : "600" ,
28- }
29- ) ,
30- new FontFace (
31- "Inter" ,
32- `url(${ require ( "./public/assets/font/Inter-Bold.ttf" ) } )` ,
33- {
34- weight : "700" ,
35- }
36- ) ,
37- ] ,
38- ko : [
39- new FontFace (
40- "NotoSansKR" ,
41- `url(${ require ( "./public/assets/font/NotoSansKR-Regular.woff2" ) } )` ,
42- {
43- weight : "400" ,
44- }
45- ) ,
46- new FontFace (
47- "NotoSansKR" ,
48- `url(${ require ( "./public/assets/font/NotoSansKR-Medium.woff2" ) } )` ,
49- {
50- weight : "500" ,
51- }
52- ) ,
53- new FontFace (
54- "NotoSansKR" ,
55- `url(${ require ( "./public/assets/font/NotoSansKR-Medium.woff2" ) } )` ,
56- {
57- weight : "600" ,
58- }
59- ) ,
60- new FontFace (
61- "NotoSansKR" ,
62- `url(${ require ( "./public/assets/font/NotoSansKR-Bold.woff2" ) } )` ,
63- {
64- weight : "700" ,
65- }
66- ) ,
67- ] ,
101+ en : interFontFaces ,
102+ "zh-cn" : [ ...interFontFaces , ...notoSansSCFontFaces ] ,
103+ ko : [ ...interFontFaces , ...notoSansKRFontFaces ] ,
68104} ;
69105
70106export const useLoadFonts = ( ) => {
0 commit comments