CJK font testing

These days I’ve been using lots of time testing CJK (Chinese, Japanese, Korean) fonts in browser and Linux desktop, especially the mystery of how fontconfig chooses which font to use for each glyph. CJK fonts have been notorious for fighting against each other when searching for proper font to display CJK unified glyphs. While Keith Packard (author of fontconfig) didn’t provide any in-depth explanation of how it works, everybody resorted into doing the guess work themselves. (Not even when asking him directly through email — his usual reply is that it automagically works, no useful information at all.)

I still haven’t achieved my goals yet. My goals are:

  1. Pick font according to language — For Chinese, Japanese and Korean web pages, if the lang attribute is specified, then corresponding font for each language is used. NOT always override all other fonts by Chinese ones.
  2. Pick uniformly — For all non-CJK web pages, don’t pick random font for each glyph individually. Always prefer single Chinese font (because I’m in Chinese environment), unless some glyphs are Japanese and Korean Han characters. In that case……
  3. Mix and match — Attempt to match various font face of each language together properly based on their stroke style. For example, uming (“AR PL ShanHeiSun Uni”) should mix together with some specific Japanese font (“Sazanami Mincho”, “Kochi Mincho”) and Korean font (“UnBatang”). It’s because they have very similar (Song/Ming style, or in Chinese, 宋體/明體) stroke styles.
  4. Use english for english — When displaying latin character glyphs, always use latin fonts like DejaVu and Bitstream Vera. Latin glyphs in Chinese fonts are unconditionally crappy. They are blurred for smaller sizes (though Chinese won’t setup display in smaller font size as it would become unreadable for CJK glyphs), unlike normal latin fonts that have solid outline. I’m not sure how freetype 2.2.x goes, but even if it has improvement regarding anti-aliasing when comparing with 2.0.x, it would be a long time before everybody switch to 2.2.

However, there are lots of problems in the setup:

  1. Mix and mismatch — While Song/Ming style can be matched with Serif, there is no match against Sans (or unmodulated as better term internationally). The best match against unmodulated font face is Hei style (黑體, means black style). Japanese font (“Sazanami Gothic”) and Korean one (“UnDotum”) is publicly available that closely resemble Hei style, but not Chinese. Kai style (楷體) simply is another style, not a substitution of Hei style.
  2. Hard to use English fonts for latin glyphs — Latin glyphs inside both uming and ukai are actually in monospaced Serif face. However, the punctuations and other symbols are not of uniform width, they are proportional. What should I call it? Anyway, so far the attempt to use Dejavu to override it is unsuccessful.
  3. Browser issue — Each browser may or may not have the capability to support CSS properly and pick glyphs according to language. Look at the 3 screenshots below:
    Font on Firefox Firefox
    Font on Konqueror Konqueror
    Font on Opera Opera

    Among Firefox, Opera and Konqueror, only Firefox managed to obey <span lang="xxx"></span> attribute and pick correct font among CJK ones. Konqueror only picks font from current locale when using Sans, Serif or Monospace aliases. Opera doesn’t even obey font-family in CSS (I guess it is using uming with no anti-alias). That means I have to stick to Firefox for font testing on browser.

  4. How about other fonts? — I’m pretty sure, things can go wild if other untested fonts are used, which is common among Chinese where borrowing Windows ttf (mingliu and simsun) and other commercial fonts is a common practise. Making fontconfig behave properly with these fonts is tedious work.
Tagged as , • Categorized as Language

1 Response

  1. Frankie says:

    Thanks for your pointers. The major complain I have UTF-8 character display is that the Hanzi are displayed using the Kanji font whenever the Han character available in Kanji font. I am thinking of un-installing those Kanji fonts to make the problem go away. Trying not to duplicate the work you have done, I wonder what was your resolution to the above problem.

Leave a Reply

E-mail is not disclosed nor shared. Required fields are marked *