Map cursive generic font family to Kai in Chinese

RESOLVED FIXED in Firefox 50

Status

()

defect
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: xidorn, Assigned: xidorn)

Tracking

(Blocks 1 bug)

Trunk
mozilla50
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox45 affected, firefox50 fixed)

Details

(Whiteboard: [parity-webkit])

Attachments

(3 attachments)

Kai is one of the four most frequently-used fonts in Chinese (including Simplified Chinese and Traditional Chinese), and have different font family name in different platforms. Authors want to have one generic font family to use this kind of fonts on all platforms instead of listing all of them in the font-family property.

A proposal is that Kai should be mapped as cursive in Chinese. Although Kai may not seem to be completely a cursive font, it is still reasonable to do so based on its origin and shape.

Currently, cursive is not widely-used in Chinese language (and actually we do not have any sensible mapping yet), so it makes sense to do this.

John Daggett, Bobby Tung (from Taiwan) and I discussed this during the break of CSSWG f2f meeting in TPAC, and IIRC we have consensus about this, so it is expected that the spec should be updated accordingly.

WebKit has been shipping this mapping. We should do this as well.
Output of:
plutil -p /System/Library/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist

For Chinese:

  0 => "zh-Hans"
  1 => "STKaiti-SC-Regular"

  0 => "zh-Hant"
  1 => "STKaiTi-TC-Regular"
(In reply to Xidorn Quan [:xidorn] (UTC+9) from comment #0)

> WebKit has been shipping this mapping. We should do this as well.

This is OSX specific and for OSX I think we simply need to reflect system defaults into out font pref lists. This should be a priority list across OSX versions, with OSX 10.11 defaults at the head of the list where they differ from older OS versions. It would be nice to make this somehow programmatically possible but I don't see any clear way to do this with a public API.

Not sure what the Kai fonts should be for Windows/Linux/Android.
Assignee: nobody → jdaggett
(In reply to Xidorn Quan [:xidorn] (UTC+9) from comment #3)
> Bobby has an image about this:
> https://cdn-images-1.medium.com/max/1600/1*54sLzm-OMOJ6OCt1GWkPEw.png

Hmmm, so favor SimKai over Kaiti?

Our current pref for windows:

> pref("font.name.cursive.zh-CN", "KaiTi");
Hmm, it seems KaiTi is added later than SimKai, so we probably should keep using KaiTi, but add SimKai as a fallback. I'll confirm with Bobby about that.
jtd, any news here?
Flags: needinfo?(jdaggett)
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #5)
> Hmm, it seems KaiTi is added later than SimKai, so we probably should keep
> using KaiTi, but add SimKai as a fallback. I'll confirm with Bobby about
> that.

Which of these two should be preferred?
Flags: needinfo?(jd.bugzilla) → needinfo?(quanxunzhen)
Sorry I forgot to confirm...

It seems SimKai is Kaiti. SimKai is the filename while Kaiti is its font name.

I just got a new version of that table of the fonts. Please see the note in this file.
Flags: needinfo?(quanxunzhen)
Assignee: jd.bugzilla → bugzilla
So basically this patch does three things:
1. add KaiTi_GB2312 to the name-list.cursive.zh-CN because it seems to me KaiTi_GB2312 is the name of KaiTi on Windows XP
2. add DFKai-SB as cursive.zh-TW for tranditional Chinese for Windows
3. add Kaiti SC/TC as cursive font for OS X

The table provided in comment 8 says OS X uses STKaiti-SC/TC, but I cannot find those fonts in my system. The file Kaiti.ttc there contains three different families named "Kaiti SC", "Kaiti TC", and "STKaiti", so I suppose we actually want them rather than STKaiti-SC/TC.
Attachment #8755288 - Flags: review?(jfkthame) → review?(jd.bugzilla)
Sorry for the delay here, I saw the original r? but then other things crowded it off my radar... :(

IMO this seems fine, but perhaps it'd be best to have it reviewed by someone from the Beijing and/or Taipei offices, to see if they have any comments on the appropriate font mappings.
Jack, could you find someone in Beijing office to verify that cursive font family would be correctly mapped to some Kai font (楷体) on all supported Windows (XP ~ 10) and Mac (10.9 ~) for zh-CN content with this patch applied?

Testing code could be something like:
data:text/html;charset=UTF-8,<p lang="zh-CN" style="font: 52px cursive">你好
Flags: needinfo?(jguo)
Astley, could you find some one in Taipei office to verify that cursive font family would be correctly mapped to some Kai font (楷體) on all supported Windows (XP ~ 10) and Mac (10.9 ~) for zh-TW (and probably also zh-HK) content with this patch applied?

Testing code could be something like:
data:text/html;charset=UTF-8,<p lang="zh-TW" style="font: 52px cursive">你好
Flags: needinfo?(aschen)
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #13)
> Astley, could you find some one in Taipei office to verify that cursive font
> family would be correctly mapped to some Kai font (楷體) on all supported
> Windows (XP ~ 10) and Mac (10.9 ~) for zh-TW (and probably also zh-HK)
> content with this patch applied?
> 
> Testing code could be something like:
> data:text/html;charset=UTF-8,<p lang="zh-TW" style="font: 52px cursive">你好

Tested on Windows 10, OSX 10.11 with locale zh-TW, cursive successfully maps to DFKai-SB and Kaiti TC respectively.
I'll have QA and IT help for other platforms, versions, locales testing and update the result in this bug.
Flags: needinfo?(aschen)
Blocks: 1276841
You can use builds from this try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f36dc36bd6c1 (Sorry that I didn't push that before I asked for help)

To check the font mapped, you can enable "devtools.fontinspector.enabled" in about:config, then view the used font in the Inspector of the developer tools.
Comment on attachment 8755288 [details]
MozReview Request: Bug 1220019 - Use Kaiti for cursive in Chinese. r?jfkthame

Looks fine to me, as long as you've verified that these are the actual *family* names that are used for those font families.
Attachment #8755288 - Flags: review?(jd.bugzilla) → review+
I've verified on the following platforms that it works:
1. Windows 10 zh-CN, zh-TW
2. Windows XP zh-CN
3. OS X 10.10 zh-CN, zh-TW

And Astley verified on the following platforms:
1. Windows 10 zh-TW
2. Windows XP zh-TW
3. OS X 10.11 zh-TW, zh-CN

I guess it should be good enough to go. The only uncertainity is OS X 10.9 which we are still supporting. But I'm not too worried about that.
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b0ecb5f3f7b7
Use Kaiti for cursive in Chinese. r=jtd
https://hg.mozilla.org/mozilla-central/rev/b0ecb5f3f7b7
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Canceling the ni? as the bug has been resolved...
Flags: needinfo?(jguo)
You need to log in before you can comment on or make changes to this bug.