Fix font priority for languages using Han characters#5930
Merged
Alkarex merged 2 commits intoFreshRSS:edgefrom Dec 10, 2023
Merged
Fix font priority for languages using Han characters#5930Alkarex merged 2 commits intoFreshRSS:edgefrom
Alkarex merged 2 commits intoFreshRSS:edgefrom
Conversation
Member
|
Cross-ref to #1541. |
Frenzie
approved these changes
Dec 6, 2023
Member
Frenzie
left a comment
There was a problem hiding this comment.
Makes sense to me in theory, but it does leave me a little confused about what to do if one wanted to use a custom font for both.
Contributor
Author
|
That's a very good point and I did explore the topic of setting custom fonts for individual languages, the issue being that fonts that use Han character glyphs don't play nicely in a single list so separation is necessary. So, if a theme wanted to use custom fonts the lang() selector could be used as follows to achieve that separation: body:lang(ja) {
font-family: "Osaka", "Meiryo", sans-serif;
}
body:lang(zh-cn) {
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
body:lang(zh-tw) {
font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
}I didn't go ahead with something like that as it seemed to be somewhat outside the main issue of not rendering Japanese with a Chinese font. |
c4f3edd to
300e26d
Compare
Contributor
Author
|
I've now signed the commits. Could you re-review, please? |
Frenzie
approved these changes
Dec 6, 2023
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.
Closes #5670
Changes proposed in this pull request:
The presence of the simplified Chinese fonts 'PingFang SC' and 'Microsoft YaHei' in several theme's font-family lists means that if they are installed on a users system they will be favoured over other fonts for displaying text in other languages that use 'Han characters' such as Japanese and traditional Chinese leading to broken text in those languages.
By removing 'PingFang SC' and 'Microsoft YaHei' from the font-family list of these themes we allow the browser to use the HTML lang attribute to display text in a font that is correct for the language if one is present on the users system.
We now simply leverage browser behaviour to provide a much fuller and more robust check for default language fonts.
How to test the feature manually:
Enter Display page of Configuration.

From language menu select '日本語' then click submit button to display Japanese.

From language menu select '简体中文' then click submit button to display simplified Chinese.

From language menu select '正體中文' then click submit button to display traditional Chinese.

Pull request checklist: