Skip to content

Commit c3a6b44

Browse files
committed
feat: add and load NatoSansSC webfont
1 parent 1e5d134 commit c3a6b44

File tree

6 files changed

+70
-31
lines changed

6 files changed

+70
-31
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export const GlobalStyle = createGlobalStyle`
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"]
@@ -51,6 +54,9 @@ export const GlobalStyle = createGlobalStyle`
5154
&[data-lang="ko"] {
5255
font-family: 'Inter', 'NotoSansKR', sans-serif;
5356
}
57+
&[data-lang="zh-cn"] {
58+
font-family: 'Inter', 'NotoSansSC', sans-serif;
59+
}
5460
}
5561
5662
// Set border-box as default for convenience.

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

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,74 @@ const interFontFaces = [
3333
),
3434
];
3535

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+
3698
const languageToFontFaces: {
3799
[lang: string]: FontFace[] | undefined;
38100
} = {
39101
en: interFontFaces,
40-
ko: [
41-
...interFontFaces,
42-
new FontFace(
43-
"NotoSansKR",
44-
`url(${require("./public/assets/font/NotoSansKR-Regular.woff2")})`,
45-
{
46-
weight: "400",
47-
}
48-
),
49-
new FontFace(
50-
"NotoSansKR",
51-
`url(${require("./public/assets/font/NotoSansKR-Medium.woff2")})`,
52-
{
53-
weight: "500",
54-
}
55-
),
56-
new FontFace(
57-
"NotoSansKR",
58-
`url(${require("./public/assets/font/NotoSansKR-Medium.woff2")})`,
59-
{
60-
weight: "600",
61-
}
62-
),
63-
new FontFace(
64-
"NotoSansKR",
65-
`url(${require("./public/assets/font/NotoSansKR-Bold.woff2")})`,
66-
{
67-
weight: "700",
68-
}
69-
),
70-
],
102+
"zh-cn": [...interFontFaces, ...notoSansSCFontFaces],
103+
ko: [...interFontFaces, ...notoSansKRFontFaces],
71104
};
72105

73106
export const useLoadFonts = () => {

0 commit comments

Comments
 (0)