Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme): dont use Chinese quotes on non-Chinese documents #3834

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions src/client/theme-default/styles/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,40 @@ html body {
U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Chinese quotes rendering fix. 中英文弯引号共享 Unicode 码位,确保引号使用中文字体渲染 */
@font-face {
font-family: 'Chinese Quotes';
src: local('PingFang SC Regular'), local('PingFang SC'), local('SimHei'),
local('Source Han Sans SC');
unicode-range: U+2018, U+2019, U+201C, U+201D; /* 分别是 ‘’“” */
font-family: 'Punctuation SC';
font-weight: 400;
src: local('PingFang SC Regular'), local('Noto Sans CJK SC'),
local('Microsoft YaHei');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

@font-face {
font-family: 'Punctuation SC';
font-weight: 500;
src: local('PingFang SC Medium'), local('Noto Sans CJK SC'),
local('Microsoft YaHei');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

@font-face {
font-family: 'Punctuation SC';
font-weight: 600;
src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
local('Microsoft YaHei Bold');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

@font-face {
font-family: 'Punctuation SC';
font-weight: 700;
src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
local('Microsoft YaHei Bold');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

/* Generate the subsetted fonts using: `pyftsubset <file>.woff2 --unicodes="<range>" --output-file="inter-<style>-<subset>.woff2" --flavor=woff2` */
14 changes: 10 additions & 4 deletions src/client/theme-default/styles/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,20 @@
* -------------------------------------------------------------------------- */

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

:root:lang(zh) {
--vp-font-family-base: 'Punctuation SC', 'Inter', ui-sans-serif, system-ui,
'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans SC', 'Heiti SC', 'DengXian',
'Microsoft YaHei', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}

/**
* Shadows
* -------------------------------------------------------------------------- */
Expand Down