Fixing (Debian, X, PDF viewer) font setup for Japanese
I have been experiencing crazy switches in my fonts displayed in the browser, in applications, etc. In particular, stuff written in Japanese was displayed with Chinese characters instead of Japanese. The differences are subtle, but they are there:
The problem in my case, but maybe in others, was a that by default Droid Sans Fallback font was used, which contains Chinese characters instead of Japanese. The above image gives IPAex Gothic above, and Droid Sans Fallback below. It is obvious that the shapes differ at several places.
I reported a bug against the fonts-droid package, and it seems it will be fixed soon. But even when it is fixed, the default setup will use the IPA fonts by default, and users having other fonts, like Kozuka or Hiragino at hand, might find it useful to have them activated as default fonts.
The solution is to drop a new font configuration file into /etc/fonts/conf.d/ that selects the fonts in the preferred order. My list of fonts looks like this, and since I have the Kozuka fonts available, they are selected by default. The order can be adjusted to your liking.
serif
Hiragino Mincho ProN
Hiragino Mincho Pro
Kozuka Mincho Pr6N
Kozuka Mincho Pro
IPAexMincho
IPAMincho
Kochi Mincho
sans-serif
Hiragino Kaku Gothic ProN
Hiragino Kaku Gothic Pro
Kozuka Gothic Pr6N
Kozuka Gothic Pro
IPAexGothic
IPAGothic
Droid Sans Japanese
Kochi Gothic
monospace
Hiragino Maru Gothic ProN
Hiragino Maru Gothic Pro
MotoyaLMaru
Hiragino Kaku Gothic ProN
Hiragino Kaku Gothic Pro
Kozuka Gothic Pr6N
Kozuka Gothic Pro
IPAexGothic
IPAGothic
Droid Sans Japanese
Kochi Gothic
The names can be found by inspecting the output of fc-list and searching for proper fonts. It is important that this file comes before the default 65-nonlatin.conf which would select the IPA fonts. With this I now get the Kozuka fonts be default when viewing web pages, or even as default font in some PDF viewers when fonts are not embedded.
Comments and improvements are always welcome!
The interesting thing is, that this is a problem with almost _all_ android smartphones sold outside Japan nowadays. Droid Sans Fallback with no Japanese system font installed.
It’s all ok and fine, until you start to notice.
Many many thanks to you. I spent 2 hours trying to fix this until I found this page.
Acutally I created a file similar to yours in the /usr/share/fontconfig/conf.avail/ repository, because every file in /etc/fonts/conf.d were links, not common files. Then I linked it in /etc/fonts/conf.d with the “ln -s” command and it worked. (I had filled in the file with fonts of my own first)
Thanks again,
Matthieu S.