Chinese (and CJK) fonts

I am using Arch Linux, and recently I found that my fonts are little different after upgrade.

In DBeaver, the monospace font shows this:

This causes the monospace doesn’t follow the same width. And I found that, the default “Monospace” doesn’t use DejaVu Sans Mono anymore after the recent upgrade.

After looking some solutions, I tried edit ~/.conf/fontconfig/fonts.conf according to this this one.

<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="assign" binding="same"><string>DejaVu Sans Mono</string></edit>
</match>

The above solution solves the monospace in most applications like Mousepad and DBeaver.

But then, I found CJK issue in Mousepad when using monospace font, like this,

The Simplified Chinese font and Traditional Chinese font are different.

If open with “charmap” and choose Monospace font, we can check what are the fonts being rendered, like this

I right-clicked the character, found that two fonts are being used in Monospace for these Chinese characters: Meiryo and KaiTi. Meiryo was installed with “ttf-vista-fonts” package, and KaiTi I installed directly to ~/.local/share/fonts.

After some study, I found that the above fontconfig is not good enough. Lastly, I changed my setting to

<alias>
  <family>sans</family>
  <prefer>
    <family>DejaVu Sans</family>
    <family>WenQuanYi Zen Hei</family>
  </prefer>
</alias>
<alias>
  <family>monospace</family>
  <prefer>
    <family>DejaVu Sans Mono</family>
    <family>WenQuanYi Zen Hei</family>
  </prefer>
</alias>

After saving the changes, the application must be restarted in order to see the effect.

And this finally solved the font issues.

JDownloader Chinese or Japanese characters problem in Linux

When downloading the files contain Chinese or Japanese characters using JDownloader in Linux (for my case, Arch Linux), I found that all the Chinese or Japanese characters are shown with boxes. There are a lot of suggested solutions I found from Internet, especially adding !font=Dialog to the language file. I also tried to edit the fontconfig.properties file, adding path to JAVA_FONTS, etc. But all the solutions do not work.

So, my solution is, just change the user interface style to non-Synthetica style, eg, Substance or Light. Both types of style work well, allow me to see the file names with correct characters. Problem solved.

Please note that, this is not the fault of Synthetica (Synthetica FAQ).