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

Font face 'Chinese Quotes' causes extra space between English letters #3790

Closed
4 tasks done
shadow-light opened this issue Apr 14, 2024 · 1 comment · Fixed by #3834
Closed
4 tasks done

Font face 'Chinese Quotes' causes extra space between English letters #3790

shadow-light opened this issue Apr 14, 2024 · 1 comment · Fixed by #3834
Labels
theme Related to the theme

Comments

@shadow-light
Copy link
Contributor

Describe the bug

A custom font-face was added to VitePress to fix rendering issues for quotes in Chinese, but this has inadvertently caused rendering issues in English (and possibly other languages).

Curly apostrophes are particularly affected as Can’t turns into Can’ t, because the spacing of the apostrophe is much larger in some Chinese fonts. This happens on systems that default to the SimHei local font and possibly others.

Reproduction

Add curly quotes between letters (or enable typographer for Markdown)

https://stackblitz.com/edit/vite-jhejpq?file=docs%2Findex.md,docs%2F.vitepress%2Fconfig.ts

But it will only reproduce when the system defaults to the SimHei font (Windows I think).

image

Expected behavior

Curly quotes should not take any extra space than needed.

System Info

Reproduced on Windows systems where the local font used is SimHei.

Additional context

I assume reverting this behaviour would negatively affect Chinese users, so I'll leave it to the discretion of the maintainers as to whether it should be reverted or not. It was very difficult to identify the problem though, so documenting it would at least be helpful so other users know to override the behaviour themselves.

Manually overriding --vp-font-family-base is a workaround.

Validations

@shadow-light shadow-light added the bug: pending triage Maybe a bug, waiting for confirmation label Apr 14, 2024
@brc-dd brc-dd added theme Related to the theme and removed bug: pending triage Maybe a bug, waiting for confirmation labels Apr 26, 2024
@brc-dd
Copy link
Member

brc-dd commented Apr 26, 2024

Instead of reverting, it can be made smarter I guess. Maybe add that inside :lang(zh) selector 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants