Saturday, 10 January 2015

Japanese fonts for Evince

After much searching on the Internet and a lot of trial and error I finally found a way to correctly display the Japanese text in the PDF statements I download from Shinsei Bank. The default PDF viewer on CentOS 7 is Evince.

The problems stem from the use of two non-embedded fonts which are not available on my Linux system:
  • GothicBBB-Medium-90ms-RKSKJH
  • Ryumin-Light-90ms-RKSJ-H
Substituting these fonts is achieved by editing or creating the file "~/.fonts.conf". In my case I had no prior settings and created that file from scratch with the following contents:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family"><string>GothicBBB</string></test>
    <edit name="family" mode="assign" binding="same"><string>MS Mincho</string></edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family"><string>Ryumin</string></test>
    <edit name="family" mode="assign" binding="same"><string>MS Mincho</string></edit>
  </match>
</fontconfig>

After creating this file run the command "fc-cache" in a terminal window.

As you can see I am using Microsoft's MS Mincho as the replacement font. This is the only font I have found which works correctly with these PDF files. Fonts like IPA Mincho display weird characters where there should be empty spaces in tables. If anyone out there has a fix for that or can suggest some other free fonts I can try I would be glad to hear from them.