Closed Bug 1563602 Opened 5 years ago Closed 5 years ago

Firefox renders zh-Hani with a Japanese font, not a Chinese one.

Categories

(Core :: Layout: Text and Fonts, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: twisniewski, Assigned: jfkthame)

References

Details

Attachments

(2 files)

Attached file testcase.html

As reported in https://webcompat.com/issues/34232, Firefox renders text in lang=zh-Hani with a Japanese font, rather than a Chinese one, as demonstrated in the attached test-case (when inspected in the devtools font panel).

For instance, on my Macbook, Firefox uses Hiragino Kaku Gothic ProN, whereas for lang=zh and lang=zh-Han it uses PingFang SC. (Chrome uses Songti SC and PingFang SC respectively, while Safari uses Songti SC for all three cases). Also, the user who reported the issue mentioned that Edge uses Microsoft YaHei for all cases.

The priority flag is not set for this bug.
:lsalzman, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Component: Graphics: Text → Layout: Text and Fonts
Flags: needinfo?(lsalzman)
Priority: -- → P3

That's very interesting... because it seems that zh-somethingrandom is correctly using Chinese font, but zh-Hani is special. There must be some code or data specific for this locale?

More specifically, zh-Hans and zh-Hant use Simplified and Traditional Chinese fonts respectively, as expected from the script codes. Similarly, zh-CN uses Simplified Chinese, while zh-TW and zh-HK choose Traditional. Plain zh (with neither script nor region specified) uses Simplified.

zh-Hani, on the other hand, uses Japanese. That does seem wrong; while the script subtag Hani doesn't help differentiate, the zh language should still be a strong indication to prefer Chinese fonts.

Aha - I suspect this is coming from https://dxr.mozilla.org/mozilla-central/rev/ca257801d86f5d4e9c1768722c7131216c07d38f/intl/locale/nsLanguageAtomService.cpp#61, where the Hani script subtag is treated as Japanese. I guess we should check the primary language subtag before making that assumption.

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9468067f683b
Improve mapping of lang tags to internal langGroup codes for font-prefs selection. r=m_kato
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Assignee: nobody → jfkthame

So according to ISO 15924 Code Lists, "Hani" means "Han (Hanzi, Kanji, Hanja)", so indeed it shouldn't be mapped to any specific language itself.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: