Repository navigation
Conversation
tats-u
marked this pull request as draft
September 13, 2026 15:09
Contributor
Author
|
Needs to adjust subsetFonts.py. |
- Prefers Noto Sans CJK to good old Microsoft fonts - Respects Traditional Chinese locales - Reflects internal lang change - Adjusts Yu Gothic weights for non-Japanese Windows
tats-u
marked this pull request as ready for review
September 19, 2026 15:40
Contributor
Author
brc-dd
reviewed
Nov 9, 2026
brc-dd
reviewed
Nov 9, 2026
brc-dd
reviewed
Nov 9, 2026
brc-dd
approved these changes
Nov 9, 2026
Contributor
Author
|
With the current design, it's pretty troublesome to customize fonts for a specific CJK language. We will probably need to add a lot of CSS variables like --vp-font-family-zh-cn.
User: :root {
--vp-font-family-ja: Hiragino Sans, Meiryo, Yu Gothic Weight Fixed, Noto Sans CJK JP, Noto Sans JP;
}Our side: :root {
--vp-font-family-ja: 'Hiragino Sans', 'Noto Sans CJK JP', 'Noto Sans JP', 'Yu Gothic Weight Fixed', 'Meiryo';
--vp-font-family-zh-cn: 'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans SC', 'Microsoft YaHei',;
/* ... */
}
[lang]:where(:lang(zh, ja, ko)) {
--vp-font-family-base: 'Inter Core', var(--vp-font-family-cjk),
BlinkMacSystemFont, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
[lang]:where(:lang(ja)) {
--vp-font-family-cjk: var(--vp-font-family-ja);
}
[lang]:where(:lang(zh)){
--vp-font-family-cjk: var(--vp-font-family-zh-cn);
}
/* ... */ |
👷 Deploy request for vitepress-docs pending review.Visit the deploys page to approve it
|
Contributor
Author
|
To prefer Windows built-in fonts like before, you now simply need to insert the following: :root {
--vp-font-family-zh-cn: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC';
--vp-font-family-zh-tw: 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans CJK TC', 'Noto Sans TC';
--vp-font-family-ja: 'Hiragino Sans', 'Meiryo', 'Yu Gothic Weight Fixed', 'Noto Sans CJK JP';
--vp-font-family-ko: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans CJK KR';
} |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Description
Good old Windows standard fonts from before 2010, such as Microsoft YaHei and Meiryo, are overly optimized for 96 dpi displays. The Noto Sans CJK fonts included with recent versions of Windows (e.g., Noto Sans SC and Noto Sans JP; note that only the subset for the CJK language in use is installed by default) feature character shapes with fewer quirks and provide a consistent look with Linux-based operating systems and other CJK languages.
Furthermore, Noto Sans CJK offers a wide range of weights from extremely thin to extremely bold, and its aesthetic is similar to Hiragino Sans, making it possible to match the appearance on Apple devices.
Even on a 96 dpi display, as long as the text is not rendered extremely small, I think Noto's readability is not much inferior to the older Windows standard fonts. Rather, it has an appropriate stroke weight and renders smoothly. Also, unlike older Windows standard fonts other than Yu Gothic, Noto supports text-spacing-trim, which removes the excess whitespace that occurs with certain combinations of consecutive punctuation marks (as defined by the typesetting rules of each language).
Meiryo and YaHei cannot remove the extra spacing that occurs between parentheses, brackets, or quotation marks and adjacent punctuation:
In current VitePress, Simplified Chinese fonts are assigned to Traditional Chinese pages. When it is clear that a page is for Taiwan, Hong Kong, or Macao, fonts optimized for those regions should be prioritized. When it is unclear which of those three regions the page is for, the user's preference should be respected. Microsoft JhengHei is optimized for Taiwan, so it should not be prioritized for pages intended for Hong Kong or Macao.
In the language selector, "日本語" on the Simplified Chinese page and "简体中文" on the Japanese page are not rendered in the font of their respective languages:
"简体中文" is rendered by Meiryo but it should not be.
"日本語" is rendered by YaHei but it should not be.
Yu Gothic, which is used when displaying Japanese pages on non-Japanese versions of Windows, has a Regular weight that is only about as thick as the Light weight of other fonts. It is simply much too thin. Therefore, I made it use Medium by default, and Bold (though it is still only about as thick as the SemiBold of a typical font) for bold text. See https://github.com/tats-u/yu-gothic-css/ for details.
Linked Issues
Additional Context
Tip
The author can publish a preview release by commenting
/publishafter creating the PR.