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
Choosing appropriate fallback font list by system locale (especially on Windows) #18829
Closed
3 tasks done
Labels
Comments
2 tasks
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 23, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com>
6 tasks
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 23, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 23, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 notes: Changed to respect users' OS preferences for Accept-Language, navigator.languages. Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 23, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com>
PR fixed this issue is ongoing at #23247 |
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 24, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <hanazuki@rollingapple.net> fix typo in spec
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 24, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <hanazuki@rollingapple.net> fix typo in spec
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 24, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <hanazuki@rollingapple.net>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 24, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 25, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 28, 2020
This commit partially fixes electron#18829 Chromium uses navigator.languages (Accept-Language) to determine fallback fonts on Windows, especially kanji/han characters in CJK. Previously the full preferences set to OS was not given to Chromium. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language is given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 28, 2020
This commit fixes electron#18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
sorah
added a commit
to sorah/electron
that referenced
this issue
Apr 28, 2020
This commit fixes electron#18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on electron#15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
deepak1556
pushed a commit
that referenced
this issue
May 4, 2020
This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
ckerr
pushed a commit
that referenced
this issue
May 4, 2020
This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
ckerr
pushed a commit
that referenced
this issue
May 4, 2020
This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
deepak1556
pushed a commit
that referenced
this issue
May 5, 2020
This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Sorah Fukumori <her@sorah.jp> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
codebytere
pushed a commit
that referenced
this issue
May 5, 2020
* fix: respect system language preferences on Win/macOS (#23247) This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> * fix: remove unintentionally-committed code Some excess code was accidentally included in the last commit's cherry-pick. * chore: fix extraneous #include found by lint * fix: correct another manual backport error :P Co-authored-by: Sorah Fukumori <her@sorah.jp> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
ckerr
pushed a commit
that referenced
this issue
May 5, 2020
This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
codebytere
pushed a commit
that referenced
this issue
May 7, 2020
* fix: respect system language preferences on Win/macOS (#23247) This commit fixes #18829 Previously the full preferences set to OS was not given to Chromium. Also, this commit improves fallback font selection for CJK text. Chromium uses browser languages to determine fallback fonts on Windows, especially kanji/han characters in CJK. For instance, when user sets 'en-US, ja-JP' to Accept-Language, while Chromium chooses Japanese font for kanji text, but Electron chooses Chinese font. This is because only the first language was given to Accept-Language on Electron. This patch is based on #15532 Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net> * fix: don't shadow the `w` local variable * fixup! fix: respect system language preferences on Win/macOS (#23247) Co-authored-by: Sorah Fukumori <her@sorah.jp> Co-authored-by: Nitish Sakhawalkar <nitsakh@icloud.com> Co-authored-by: Kasumi Hanazuki <kasumi@rollingapple.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Preflight Checklist
Problem Description
Under a Windows machine using English as a display language, Japanese kanji texts are rendered with Chinese font
SimSum
. This behavior matches with Chrome's one if the machine doesn't list Japanese as an alternative preferred locale, and HTML content language is set toen-US
.But if the machine lists Japanese as an alternative, Electron should render the text with Japanese fonts.
AFAIK, Chrome renders kanji texts (Han script) with Japanese fonts when the accept-language configuration includes Japanese, as reading Chromium (blink)'s font_fallback_win.cc. This behavior is done by considering the system locales including secondary/alternative locales. Because of this, I don't encounter the same problem in Chrome.
Looks like Electron currently honors only primary system locale and content locale (HTML
lang
), but not secondary/alternative locales. Thus I think Electron's current behavior is not following Chrome's one.As I'm not familiar with the Electron codebase, I'm still not sure why the current implementation doesn't make this problem on Mac. I'm listing Japanese as an alternative locale both on my Mac and Windows machine, but this problem happens only on Windows; as looking into font related codes in Chromium, I guess macOS' CoreText is doing good for choosing a font.
Related to #15486 #18197.
In real life, for Slack workspace/Discord servers where its primary language is Japanese, this problem forces people using English as a primary system language to read Japanese with an unmatched font, which is rendered ugly as a Japanese text. I don't think letting app developers using Electron to implement font configuration is happy, just for this problem. Electron should provide a good default to devs.
Proposed Solution
Get all preferred locales from OS and set them to Chromium engine. I'm guessing #15532 fixes this problem.
Additional Information
Japanese text shown on Slack app (Windows)
If I manually change
<html>
lang toja-JP
, kanji text starts rendered with Japanese font, Meiryo.Windows Language Preference
Mac Language Preference
The text was updated successfully, but these errors were encountered: