Closed Bug 1394661 Opened 2 years ago Closed 2 years ago

monospace font mapped to OS's system locale's map instead of OS's user locale

Categories

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

55 Branch
defect
Not set

Tracking

()

VERIFIED FIXED
mozilla57
Tracking Status
firefox-esr52 --- unaffected
firefox55 --- wontfix
firefox56 + verified
firefox57 --- verified

People

(Reporter: lichray, Assigned: m_kato)

References

Details

(Keywords: regression)

Attachments

(3 files)

Attached image Capture.PNG
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170824053622

Steps to reproduce:

Open a Python document page such as https://docs.python.org/2/library/abc.html


Actual results:

The code portions display in serif fonts, more likely to be SimSun on my system.


Expected results:

Display as a sans-serif font such as Arial.

PS: I tried restarting the browser with all plugins disabled, no changes.  The most recent auto update caused this regression.
[Tracking Requested - why for this release]: It's likely a regression from Firefox 55, causing wrong font selection.

The code portions should actually be displayed in a mono-space font, so it's technically okay, but obviously not the best font family, such as Consolas. If you have chance, assuming you're a developer, can you use this mozregression tool to determine the regression range?

https://mozilla.github.io/mozregression/

From command line: 
> mozregression --good 54 --bad 55

From GUI:
https://blog.nightly.mozilla.org/2017/06/07/using-mozregression-on-windows/
Component: Untriaged → Layout: Text
Product: Firefox → Core
2017-08-28T23:54:06: DEBUG : Starting merge handling...
2017-08-28T23:54:06: DEBUG : Using url: https://hg.mozilla.org/integration/autoland/json-pushes?changeset=9e59049712448824a3717ce2d9dcbe1cf07da941&full=1
2017-08-28T23:54:06: DEBUG : Found commit message:
Bug 1348259 - Switch nsLanguageAtomService to use OSPreferences::GetSystemLocale. r=m_kato

MozReview-Commit-ID: DvKbtrpfNJe

Seems related, because my operating system is English, but ANSI codepage is set to Simplified Chinese.
Great, thanks!
Blocks: 1348259
Has Regression Range: --- → yes
Component: Layout: Text → Internationalization
Flags: needinfo?(gandalf)
lichray, What's your system locale?  zh-TW? zh-CN? z-HK?
Flags: needinfo?(lichray)
(In reply to Makoto Kato [:m_kato] from comment #4)
> lichray, What's your system locale?  zh-TW? zh-CN? z-HK?

"United States", as shown in System Information and Region & Language settings.  zh-CN is just my ANSI codepage setting (for non-Unicode programs, as shown in the classic dialog Region/Administrative).
Flags: needinfo?(lichray)
I'm not sure what's going on here. 

Should we use app locale instead of os locale here?
Flags: needinfo?(gandalf) → needinfo?(m_kato)
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #6)
> I'm not sure what's going on here. 
> 
> Should we use app locale instead of os locale here?

Until Firefox 54, we use system locale for font selection.  I think that this depends on user environment and another fix.  I am looking this.
This <pre> applies monospace font instead of sans-serif.  So SimSun is expected font.

http://searchfox.org/mozilla-central/rev/cd82cacec2cf734768827ff85ba2dba90a534c5e/modules/libpref/init/all.js#3715

User can change font list by font.name-list.monospace.zh-CN from about:config
(In reply to Makoto Kato [:m_kato] from comment #8)
> This <pre> applies monospace font instead of sans-serif.  So SimSun is
> expected font.
> 
> http://searchfox.org/mozilla-central/rev/
> cd82cacec2cf734768827ff85ba2dba90a534c5e/modules/libpref/init/all.js#3715
> 
> User can change font list by font.name-list.monospace.zh-CN from about:config

1. Inspector says it's sans serif, inherited from body.  HTML5 may has its own rules, I'm not sure.
2. My system language is "United States", zh-CN should be unrelated here.
3. This web page is in en-US UTF-8, thus Unicode, legacy code page setting should be unrelated.
4. MS Edge, SeaMonkey, all versions of Firefox I have been used do not display a SumSun here.

I don't see any reason for SumSun to get involved on this page.
If this page has lang attribute, we can use language specific font.  But this page doesn't have it and page is UTF-8, so we cannot detect page language.  So there is no way to get language from page.

So, until Firefox 54, it used system locale / application locale from OS, not Firefox UX.  Although I add fallback by bug 1348259, your case doesn't match current fallback.

Also, regression range is invalid.  Correct is bug 1346819 and bug 1346674
Blocks: 1346819
No longer blocks: 1348259
Flags: needinfo?(m_kato)
Component: Internationalization → Layout: Text
Summary: Sans serif font mapped to a serif font in Firefox 55 → monospace font mapped to OS's system locale's map instead of OS's application locale
- Firefox 54 uses OS's application locale for fallback
  - Ex. When Windows 10 UX JPN with zh-CN locale for system locale, it uses MS Gothic
- By bug 1346819 and bug 1346674, it uses Firefox UX's locale for fallback
  - Ex. When Windows 10 UX JPN with zh-CN locale for system locale, it uses Latin-1 monospace
(reported various regressions)
- By bug 1348259, we use system locale for fallback to resolve regression bug.
  - Ex. When Windows 10 UX JPN with zh-CN locale for system locale, it uses SimSun monospace
Assignee: nobody → m_kato
Status: UNCONFIRMED → NEW
Ever confirmed: true
s/application/user/
Summary: monospace font mapped to OS's system locale's map instead of OS's application locale → monospace font mapped to OS's system locale's map instead of OS's user locale
Track 56+ as regression.
Comment on attachment 8902589 [details]
Bug 1394661 - Use user locale instead of system locale for font fallback.

lgtm.

Thanks for fixing it!
Attachment #8902589 - Flags: review?(gandalf) → review+
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f31bd85188cb
Use user locale instead of system locale for font fallback. r=gandalf
https://hg.mozilla.org/mozilla-central/rev/f31bd85188cb
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Please request Beta on this when you're comfortable doing so.
Flags: needinfo?(m_kato)
Comment on attachment 8902589 [details]
Bug 1394661 - Use user locale instead of system locale for font fallback.

Approval Request Comment
[Feature/Bug causing the regression]:
bug 1346674 and bug 1348259

[User impact if declined]:
Default content font is changed the flowing environment 

- content doesn't have lang attribute
  and
- content charset is UTF-8
  and
- system locale and user locale is different on Windows.  (Ex. User uses Windows ENG  version and non-unicode locale is zh-CN)

[Is this code covered by automated tests?]:
No, there is no way.

[Has the fix been verified in Nightly?]:
Yes.

[Needs manual test from QE? If yes, steps to reproduce]: 
If possible

- Step
1. Install Windows 7 US
2. Open [Control Panel]
3. [Clock, Language, and [Region] - [Region and Language] - [Administrative]
4. Set non-Unicode programs to Japanese (Japan) by [Change system locale...]
5. Reboot Windows
6. Browse https://docs.python.org/2/library/abc.html

- Result
PRE text (background color is green) is rendered by not MS Gothic.  Ex. Courier New.   It will be able to check by [Developer Tools] - [Inspector] - [Font] tab.

[List of other uplifts needed for the feature/fix]:
[Is the change risky?]:
Low.

[Why is the change risky/not risky?]:
Back to Firefox 54 behavior.  Firefox 54 uses user locale for default font.  We changed it to system locale on Firefox 55.

[String changes made/needed]:
None
Flags: needinfo?(m_kato)
Attachment #8902589 - Flags: approval-mozilla-beta?
hi lichray,
Can you help check if this issue was fixed in the latest nightly?
Flags: qe-verify+
Flags: needinfo?(lichray)
Attached image Nightly
Verified, works as expected.
Flags: needinfo?(lichray)
Comment on attachment 8902589 [details]
Bug 1394661 - Use user locale instead of system locale for font fallback.

Fix verified in nightly, may affect many users, so let's uplift for beta 10.
Attachment #8902589 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
I have reproduced this bug on an affected Nightly build 57.0a1 (2017-08-28) using STR from comment 20.

Not reproducible anymore on latest Nightly 57.0a1 (2017-09-14) and 56 Beta 12 (20170914024831) under Windows 7 x64.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.