Closed Bug 1216440 Opened 4 years ago Closed 2 years ago

Handle Noto Sans CJK JP/KR/SC/TC per content locale

Categories

(Core Graveyard :: Widget: Gonk, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: timdream, Unassigned)

References

Details

Currently "Droid Sans Fallback" is hardcoded in gfxAndroidPlatform::GetCommonFallbackFonts(), and the font does not distinguish visual glyph differences among the CJK regions.

Noto Sans CJK is introduced to fix that by use different variant for different region. The font name is suffixed with each of the region involved.

I've been trying to put Noto Sans CJK TC in my own build and list that in the |font.name-list.*.zh-TW| pref, but as bug 1206844 comment 58 have shown the font will ended up used ahead of Firefox Emoji, creating undesired result when try rendering Emoji.

So the only option here is to also hardcode the font name into gfxAndroidPlatform::GetCommonFallbackFonts() and create zh-equalivent evaluation functions of |IsJapaneseLocale()| to get the desired font into fallback list.

Also, the font for the last resort should be changed according to UI language, so CJK characters in e.g. en-US content can be shown in desired glyph of the user.

Ideally we should create an customization (as in, can be changed in pref) opportunity here, so add-on like [1] could continue to work without overwriting Emoji in every platform. But I don't know how much effort that would take.

Or, maybe it's time to change the definition of font.name-list.* and put the hardcoded Emoji font names between font.name.* and font.name-list.*. Not sure, just thinking aloud here.

Jonathan, what do you think we should do? Depend on the scope touched, I might be able to contribute here. :)

[1] https://addons.mozilla.org/en-US/firefox/addon/chinese-default-font-tweak/
Flags: needinfo?(jfkthame)
Note that this bug is independent of whether or not to put these fonts into Gonk base image (I should change the component here but I am not sure where this should go). Gecko will have access to Noto fonts on B2GDroid or (in my case) with font manually pushed. So we should start working on this bug before FxOS moved away from Droid Sans Fallback.
It's not at all clear to me what you are proposing here. I've seen the long discussion on bug 1206844 and I'm not really comfortable with the way this seems to be trending. GetCommonFallbackFonts() is for general fallback situations where the fonts in the prefs list doesn't cover a particular character. It shouldn't be used for arbitrating emoji vs. text form priorities for particular codepoints.

I think the Android fontlists and FxOS fontlists should probably include the Noto Sans CJK fonts appropriately but I don't think that's the subject of this bug.
We will add new preference by bug 1032671.  Emoji range defines as UTR#51.
(In reply to John Daggett (:jtd) from comment #2)
> GetCommonFallbackFonts() is for general fallback
> situations where the fonts in the prefs list doesn't cover a particular
> character. It shouldn't be used for arbitrating emoji vs. text form
> priorities for particular codepoints.

Thanks for the quick feedback. Let's not mess with GetCommonFallbackFonts() then.

(In reply to Makoto Kato [:m_kato] from comment #3)
> We will add new preference by bug 1032671.  Emoji range defines as UTR#51.

Thanks for pointing me to that bug. I assume this pref will allow Gecko to find the Emoji font regardless of the font set in font.name-list.*? I however don't see the patch removing Emoji font names in GetCommonFallbackFonts() ...

The requirement here (together with bug 1206844) is that:

1. Emoji (specifically, some BMP symbols w/ VS16) must be render in Emoji font regardless of the content locale it's in.
2. CJK characters should render in their own Noto Sans CJK variant.

If bug 1032671 can fulfill (1) then there is no need to patch bug 1206844, and there will be an elegant solution (not touching GetCommonFallbackFonts(), just the pref) for (2).

Sounds great!
(In reply to Tim Guan-tin Chien [:timdream] (please needinfo) from comment #4)
> (In reply to John Daggett (:jtd) from comment #2)
> > GetCommonFallbackFonts() is for general fallback
> > situations where the fonts in the prefs list doesn't cover a particular
> > character. It shouldn't be used for arbitrating emoji vs. text form
> > priorities for particular codepoints.
> 
> Thanks for the quick feedback. Let's not mess with GetCommonFallbackFonts()
> then.
> 

Update summary per this comment.
Summary: Handle Noto Sans CJK JP/KR/SC/TC in gfxAndroidPlatform::GetCommonFallbackFonts() → Handle Noto Sans CJK JP/KR/SC/TC per content locale
Additional.  I already added Noto Sans prefs to Fennec Android.  We should copy same prefs to Gonk if we change font to Noto Sans or Source Han Sans (bug 1074022).
(In reply to Makoto Kato [:m_kato] from comment #6)
> Additional.  I already added Noto Sans prefs to Fennec Android.  We should
> copy same prefs to Gonk if we change font to Noto Sans or Source Han Sans
> (bug 1074022).

The problem is, based in finding in bug 1206844 comment 58, have Noto Sans CJK set in font.name-list means it's black white symbols will be selected before the Emoji font in these CJK content locales. We will need to ensure bug 1032671 fix that.
Bug 1032671 has been sit still for quite sometime. Will that bug help the problem stated in the above comment? If so we should wait for it before switching FxOS to Noto Sans CJK.
Depends on: 1032671
Unassign myself due to project changes.
Assignee: timdream → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(jfkthame)
Closing as we are not working on Firefox OS anymore.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.