Fonts and Input in Japanese

Few people know, but around 2003 and 2004 I took a Japanese course. Unfortunately, nearly a decade without contact with the language made me forget most of what I learned. Now I can only recognize a few very basic words written in Hiragana or Katakana.

Today I decided to reminisce about the language, but first I needed to prepare my computer. This post is to explain how to display and type Japanese characters on GNU/Linux (more specifically on Arch Linux).

Fonts

Your computer needs appropriate fonts to display Kanji, Hiragana, and Katakana characters.

Some fonts are available in the Arch repository and AUR, but you can also install fonts found on the internet. At the end of this post, I have included links to some free fonts.

Packages in the repository:

sudo pacman -S ttf-sazanami ttf-hanazono

Packages in AUR:

for f in {otf-ipafont,ttf-vlgothic,ttf-mplus,ttf-ipa-mona,ttf-monapo}; do packer $f; done

Ready! Open a Japanese website to test your new fonts.

Input

If you don’t write much, an online Romaji (Latin characters) to Japanese converter is probably enough. Otherwise, you will need to install specific packages.

The three most common ones are: IBus, uim, and SCIM. I tested IBus and SCIM, but I will only detail the explanation of IBus, which I found to be the best.

IBus

Install ibus and ibus-anthy from the official repository:

sudo pacman -S ibus ibus-qt ibus-anthy

ibus-qt is for making ibus work with Qt/KDE programs.

Run ibus-setup:

julio@acer ~> ibus-setup

A window will appear asking to activate the ibus daemon and another to configure it. In one of the windows, the following text appears:

IBus has been started! If you cannot use IBus, please add below lines in $HOME/.bashrc, and relogin your desktop.
  export GTK_IM_MODULE=ibus
  export XMODIFIERS=@im=ibus
  export QT_IM_MODULE=ibus

I skipped this step because I knew it wouldn’t work here (I use ZSH and Awesome). Instead, I simply run ibus-daemon -drx when I want to use IBus. You can add this line to your ~/.xinitrc to make IBus start along with X.

The configuration is quite intuitive. Just add the keyboard layouts you use to be able to switch between them with the shortcut ctrl + space.


Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus