Skip to content

Commit 539935d

Browse files
authored
Merge pull request #1661 from chainapsis/roy/KEPLR-1396
Load Inter font for ko locale & Add NatoSansSC font
2 parents 09f12f5 + c3a6b44 commit 539935d

File tree

6 files changed

+104
-62
lines changed

6 files changed

+104
-62
lines changed
1.12 MB
Binary file not shown.
1.1 MB
Binary file not shown.
1.09 MB
Binary file not shown.
1.11 MB
Binary file not shown.

apps/extension/src/styles/global.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ export const GlobalStyle = createGlobalStyle`
1919
-webkit-font-smoothing: antialiased;
2020
2121
&[data-lang="ko"] {
22-
font-family: 'NotoSansKR', sans-serif;
22+
font-family: 'Inter', 'NotoSansKR', sans-serif;
2323
2424
word-break: keep-all;
2525
word-wrap: break-word;
2626
}
27+
&[data-lang="zh-cn"] {
28+
font-family: 'Inter', 'NotoSansSC', sans-serif;
29+
}
2730
color: ${(props) =>
2831
props.theme.mode === "light"
2932
? ColorPalette["gray-700"]
@@ -49,7 +52,10 @@ export const GlobalStyle = createGlobalStyle`
4952
color: ${ColorPalette["gray-200"]};
5053
5154
&[data-lang="ko"] {
52-
font-family: 'NotoSansKR', sans-serif;
55+
font-family: 'Inter', 'NotoSansKR', sans-serif;
56+
}
57+
&[data-lang="zh-cn"] {
58+
font-family: 'Inter', 'NotoSansSC', sans-serif;
5359
}
5460
}
5561

apps/extension/src/use-load-fonts.ts

Lines changed: 96 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,105 @@ import { useLayoutEffect, useRef, useState } from "react";
22
import { useLanguage } from "./languages";
33
import { 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+
598
const 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

70106
export const useLoadFonts = () => {

0 commit comments

Comments
 (0)