Skip to content

Prefer OS-bundled Japanese fonts when UI language is Japanese - #9002

Merged
Alkarex merged 1 commit into
FreshRSS:edgefrom
JamBalaya56562:japanese-font-family
Jul 9, 2026
Merged

Prefer OS-bundled Japanese fonts when UI language is Japanese#9002
Alkarex merged 1 commit into
FreshRSS:edgefrom
JamBalaya56562:japanese-font-family

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

What

Add a :lang(ja)-scoped font-family to the shared p/themes/base-theme/frss.css so that, when the UI language is Japanese, kanji/kana render with OS-bundled Japanese fonts instead of falling back to the generic sans-serif (which, on systems whose default sans-serif is a Chinese font, renders Han characters with Chinese glyph variants).

html:lang(ja) body {
	font-family: "OpenSans", "Cantarell", "Helvetica", "Arial",
		"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo",
		"Osaka", "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
}

Why / background

This revives the intent of the long-stalled #5671 ("add Japanese to font-family").

  • The original PR added "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-serif and Japanese users simply fall back to the OS default sans-serif.
  • Latin fonts stay first, so Latin text is unchanged (still 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 Osaka alone and for cross-platform, default-installed fonts. The stack here covers the major platforms with system fonts (no bundling required):

  • macOS / iOS: Hiragino Sans, Hiragino Kaku Gothic ProN, Osaka
  • Windows: Yu Gothic, Meiryo
  • Android / ChromeOS / Linux: Noto Sans CJK JP, Noto Sans JP

Why :lang(ja)-scoped instead of a global change

Adding 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="…"> in app/layout/layout.phtml) applies Japanese fonts only for Japanese UIs and leaves all other languages untouched.

Implementation notes

  • The rule lives in frss.css, which is loaded by every theme (via the _frss.css entry in each theme's metadata.json), so a single addition covers all themes.
  • Selector specificity of html:lang(ja) body (0,1,2) is higher than the per-theme html, body / body rules, so it wins across all bundled themes without editing each theme file.
  • frss.rtl.css is regenerated with npm run rtlcss (font-family is not affected by RTL flipping).

Testing

  • npm run stylelint passes.
  • Verified <html lang="ja"> is emitted for the Japanese UI language; the computed body font-family includes the Japanese stack under lang=ja and is unchanged for other languages.

Closes the goal of #5671.

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>
@Alkarex Alkarex added UI 🎨 User Interfaces I18n 🌍 Translations labels Jul 8, 2026
@Alkarex Alkarex added this to the 1.30.0 milestone Jul 8, 2026
@Alkarex
Alkarex merged commit 3d04c8e into FreshRSS:edge Jul 9, 2026
1 check passed
@Alkarex

Alkarex commented Jul 9, 2026

Copy link
Copy Markdown
Member

Additional tests and feedback still welcome

@mo74m3ed mo74m3ed left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mhr]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I18n 🌍 Translations UI 🎨 User Interfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants