Skip to content

Commit 75115f4

Browse files
authored
fix(theme): don't use Chinese quotes on non-Chinese documents (#3834)
1 parent 1174060 commit 75115f4

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

src/client/theme-default/styles/fonts.css

+33-5
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,40 @@ html body {
146146
U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
147147
}
148148

149-
/* Chinese quotes rendering fix. 中英文弯引号共享 Unicode 码位,确保引号使用中文字体渲染 */
150149
@font-face {
151-
font-family: 'Chinese Quotes';
152-
src: local('PingFang SC Regular'), local('PingFang SC'), local('SimHei'),
153-
local('Source Han Sans SC');
154-
unicode-range: U+2018, U+2019, U+201C, U+201D; /* 分别是 ‘’“” */
150+
font-family: 'Punctuation SC';
151+
font-weight: 400;
152+
src: local('PingFang SC Regular'), local('Noto Sans CJK SC'),
153+
local('Microsoft YaHei');
154+
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
155+
U+00B7, U+007E, U+002F;
156+
}
157+
158+
@font-face {
159+
font-family: 'Punctuation SC';
160+
font-weight: 500;
161+
src: local('PingFang SC Medium'), local('Noto Sans CJK SC'),
162+
local('Microsoft YaHei');
163+
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
164+
U+00B7, U+007E, U+002F;
165+
}
166+
167+
@font-face {
168+
font-family: 'Punctuation SC';
169+
font-weight: 600;
170+
src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
171+
local('Microsoft YaHei Bold');
172+
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
173+
U+00B7, U+007E, U+002F;
174+
}
175+
176+
@font-face {
177+
font-family: 'Punctuation SC';
178+
font-weight: 700;
179+
src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
180+
local('Microsoft YaHei Bold');
181+
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
182+
U+00B7, U+007E, U+002F;
155183
}
156184

157185
/* Generate the subsetted fonts using: `pyftsubset <file>.woff2 --unicodes="<range>" --output-file="inter-<style>-<subset>.woff2" --flavor=woff2` */

src/client/theme-default/styles/vars.css

+10-4
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,20 @@
261261
* -------------------------------------------------------------------------- */
262262

263263
:root {
264-
--vp-font-family-base: 'Chinese Quotes', Inter, ui-sans-serif, system-ui,
265-
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
266-
'Noto Color Emoji';
267-
--vp-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
264+
--vp-font-family-base: 'Inter', ui-sans-serif, system-ui, sans-serif,
265+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
266+
--vp-font-family-mono: ui-monospace, 'Menlo', 'Monaco', 'Consolas',
268267
'Liberation Mono', 'Courier New', monospace;
269268
font-optical-sizing: auto;
270269
}
271270

271+
:root:lang(zh) {
272+
--vp-font-family-base: 'Punctuation SC', 'Inter', ui-sans-serif, system-ui,
273+
'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans SC', 'Heiti SC', 'DengXian',
274+
'Microsoft YaHei', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
275+
'Segoe UI Symbol', 'Noto Color Emoji';
276+
}
277+
272278
/**
273279
* Shadows
274280
* -------------------------------------------------------------------------- */

0 commit comments

Comments
 (0)