Prefer OS-bundled Japanese fonts when UI language is Japanese - #9002
Merged
Conversation
Add a :lang(ja)-scoped font-family in the shared frss.css so kanji/kana render with Japanese glyphs on Japanese UIs, without affecting Chinese (zh-CN/zh-TW) users. Revives the intent of PR FreshRSS#5671 with a cross-platform font list. frss.rtl.css is regenerated via rtlcss. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
Additional tests and feedback still welcome |
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.
What
Add a
:lang(ja)-scopedfont-familyto the sharedp/themes/base-theme/frss.cssso that, when the UI language is Japanese, kanji/kana render with OS-bundled Japanese fonts instead of falling back to the genericsans-serif(which, on systems whose default sans-serif is a Chinese font, renders Han characters with Chinese glyph variants).Why / background
This revives the intent of the long-stalled #5671 ("add Japanese to font-family").
"Osaka"in front of the Chinese fonts (PingFang SC/Microsoft YaHei) that were in the stack at the time. Those Chinese fonts have since been removed from the codebase, so today the stack is just"OpenSans", "Cantarell", "Helvetica", "Arial", sans-serifand Japanese users simply fall back to the OS defaultsans-serif.OpenSans); the Japanese fonts are only reached as a fallback for kana/kanji.Addressing the original review feedback
The review on #5671 asked for more than
Osakaalone and for cross-platform, default-installed fonts. The stack here covers the major platforms with system fonts (no bundling required):Why
:lang(ja)-scoped instead of a global changeAdding Japanese fonts unconditionally to the global stack would make Chinese (
zh-CN/zh-TW) users see Japanese glyph variants for shared Han characters — the mirror image of the problem this fixes. Scoping to:lang(ja)(the UI language set on<html lang="…">inapp/layout/layout.phtml) applies Japanese fonts only for Japanese UIs and leaves all other languages untouched.Implementation notes
frss.css, which is loaded by every theme (via the_frss.cssentry in each theme'smetadata.json), so a single addition covers all themes.html:lang(ja) body(0,1,2) is higher than the per-themehtml, body/bodyrules, so it wins across all bundled themes without editing each theme file.frss.rtl.cssis regenerated withnpm run rtlcss(font-family is not affected by RTL flipping).Testing
npm run stylelintpasses.<html lang="ja">is emitted for the Japanese UI language; the computedbodyfont-familyincludes the Japanese stack underlang=jaand is unchanged for other languages.Closes the goal of #5671.