Add style support for Chinese fonts

Hi @TrustedDeveloper, as far as I am aware, Sparkle tries to match the pasted font with one of the ones installed. The match should be happening both at the level of the unicode font name inside the font, and at the display name.

The other issue is Chinese web fonts are generally extremely large (one megabyte per font file, versus 150-200 for a typical latin web font), so they are generally not used in web context, and having a generic “arial” font with Chinese glyphs results in a fallback to the corresponding Chinese system font.

(a system font is one already present on the device displaying the page, a web font is delivered along with the website)

One problem with using a system font is the tracking prevention mentioned in this post:

So for system fonts you can build a “font stack”, a mechanism to instruct the browser to search in the specified list for alternative fonts on the computer. For example for japanese we pre-built this font stack for the Hiragino Mincho ProN font (you can check in the Sparkle font panel, system fonts section):

image

In Sparkle the system font font stack needs to be based on one of the allowed fonts, that for Chinese means:

  • Hei
  • Heiti SC
  • Heiti TC
  • LiHei Pro
  • LiSong Pro
  • Songti SC
  • Songti TC
  • STFangsong
  • STHeiti
  • STSong

There’s no need for a font stack for web fonts, because a web font is downloaded along with the website so it’s always there.

With all that said, I think you need to be pasting text that uses a font in the font stack, for it to keep that style (and the underlying font names need to match, as mentioned).

Alternatively you need to have the Chinese web font installed.

Tell me more and we can look at what’s not quite working.