Wandering Thoughts archives


Picking FreeType CJK fonts for xterm on a modern Linux system

Once I worked out how to make xterm show Chinese, Japanese, and Korean characters, I had to figure out what font to use. I discussed the general details of using FontConfig to hunt for CJK fonts in that entry, so now let's get down to details.

The Arch Linux xterm example uses 'WenQuanYi Bitmap Song' as its example CJK font. This is from the Wen Quan Yi font collection, and they're available for Fedora in a collection of wqy-*-fonts packages. So I started out with 'WenQuanYi Zen Hei Mono' as the closest thing that I already had installed on my system.

(Descriptions of Chinese fonts often talk about them being an 'X style' font. It turns out that Chinese has different styles of typography, analogous to how Latin fonts have serif and sans-serif styles; see here or here or here for three somewhat random links that talk about eg Heiti vs Mingti. Japanese apparently has a similar but simpler split, per here, with the major divisions being called 'gothic' and 'Mincho'. Learning this has suddenly made some Japanese font names make a lot more sense.)

Fedora itself has a Localization fonts requirements wiki page. The important and useful bit of this page is a matrix of language and the default and additional fonts Fedora apparently prefers for it. Note that each of Chinese, Japanese, and Korean pick different fonts here; there isn't one CJK font that's the first or even second preference for all of them. Since you have to pick only one font for xterm's CJK font, you may want to think about which language you care most about.

(This is probably where Han unification sticks its head up, too. Fedora talks about maybe influencing font rendering choices here on its Identifying fonts page.)

In Ubuntu, apparently some CJK default fonts have changed to Google's Noto CJK family. A discussion in that bug suggests that Fedora may also have changed its defaults to the Noto CJK fonts, contrary to what its wiki sort of implies. The Arch Wiki has its usual comprehensive list of CJK font options and there's also Wikipedia's general list. Neither particularly mentions monospaced fonts, though, assuming that this is even something that one has to consider in CJK fonts for xterm.

All of this led me to peer into the depths of /etc/fonts/conf.d on my Fedora machines to look for mentions of monospace. Here I found interesting configuration file snippets that said things like:

       <test name="lang">
       <test name="family">
       <edit name="family" mode="prepend">
       <string>Noto Sans Mono CJK JP</string>

       <family>Noto Sans Mono CJK JP</family>

I'm not really up on FontConfig magic, but this sure looked like it was setting up a 'Noto Sans Mono CJK JP' font as a monospace font if you wanted things in Japanese. There's also KR, SC (Simplified Chinese), and TC (Traditional Chinese) variants of Noto Sans Mono CJK lurking in the depths of my Fedora system.

After looking at an xterm using WenQuanYi Zen Hei Mono side by side with one using Noto Sans Mono CJK JP, I decided that the Noto version was probably better looking (on my very limited sample of CJK text, mostly in file names and font names) and also I felt slightly more confident in picking it, since it seemed more likely to be closer to how eg gnome-terminal was operating and also the general trend of CJK font choices in various Linuxes. I wish I could find out what CJK font(s) gnome-terminal was using, but the design of current versions makes that difficult.

(Some experimentation suggests that in my setup, gnome-terminal may be using VL Gothic here. I guess I can live with all of this, however it comes out; mostly I just want CJK characters to show up as something other than boxes or especially spaces.)

linux/LinuxXTermFreeTypeCJKFonts written at 00:48:32; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.