Writing Chinese, Japanese, Korean in FreeBSD with fcitx

We can get Chinese, Japanese, Korean input in FreeBSD in the same way as in Linux (Writing Chinese, Japanese in Linux). But, some things in FreeBSD are different: in FreeBSD another set of fcitx, font packages.

What is nice, some things in FreeBSD are even simpler than in Linux. For example, during the installation process I didn’t need to run fcitx-configtool. I didn’t need to add input methods for languages, because fcitx automatically detected and enabled them after a reboot.

Core fcitx installation (required for all input methods)

Let’s install fcitx. In FreeBSD package has a different name – zh-fcitx, but it is similar to fcitx package in Linux:

sudo pkg install zh-fcitx

Then install fcitx-configtool, this is necessary to manage input methods, assign shortcuts and more. The utility is called by a similar to Linux fcitx-configtool command:

sudo pkg install zh-fcitx-configtool

We can install an additional fcitx-qt5 package, it includes Qt5 applications support and contains qt5-dbus as a dependency:

sudo pkg install fcitx-qt5

Basic utilities are installed.

Now we need to make some changes. We need to tell GTK, Qt, X that we want to use the new installed input method framework – fcitx.

Open .xinitrc file in our home directory with any text editor and add the following lines:

export XMODIFIERS=​⁣@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XIM=fcitx
fcitx

You need to decide which language you’ll use. If you want to install all together Chinese, Japanese, Korean languages in FreeBSD, then install all packages listed below and only after that make a reboot.

Install Chinese Input Method (Sunpinyin)

There are many Chinese input methods in FreeBSD ports. You can choose any with whom you had experience and familiar to you. But I couldn’t find google-pinyin input method. Therefore, I chose sunpinyin that is also works very nice:

sudo pkg install zh-fcitx-sunpinyin ## Chinese IM

We need to install Chinese fonts for X-server. I found both for Traditionlal and Simplified Chinese. The packages are quite large (200-300 megabytes each) but contains a huge number of Chinese characters. Of course, you can use any fonts that you like:

sudo pkg install noto-tc ## Google Noto Fonts family (Traditional Chinese)
sudo pkg install noto-sc ## Google Noto Fonts family (Simplified Chinese)

After fcitx core and language input method installations are passed, we need to reboot:

sudo shutdown -r now

Enable/Disable Chinese input can be done with Ctrl+Space shortcut.

Then start typing in pinyin:

zhong wen in leafpad with fcitx under FreeBSD
Checking Chinese input works in leafpad text editor (GTK2 application)

ü is on “v” character:

ü in sunpinyin with fcitx under FreeBSD and dwm
Checking ü pinyin letter

Settings are in fcitx-configtool:

fcitx-configtool

Install Japanese Input Method (Mozc)

First we need to install Japanese input method. I like to use mozc, it is modern and stable:

sudo pkg install ja-fcitx-mozc  ## Japanese IM

Mozc is a service, so when the system starts it also needs to be run. Therefore, add an additional line to .xinitrc, X server will run mozc at startup:

export XMODIFIERS=⁣​@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XIM=fcitx
/usr/local/bin/mozc start        ## My favorite Japanese input method
fcitx

Install Japanese fonts. It can be any desired:

sudo pkg install ja-font-takao   ## Japanese fonts

After fcitx core and language input method installations are passed, we need to reboot:

sudo shutdown -r now

Enable/Disable Japanese input can be done with Ctrl+Space shortcut.

Then, start typing in kana:

writing nihongo in Japanese in leafpad text editor using fcitx+mozc under FreeBSD and dwm
Japanese input in FreeBSD using fcitx and mozc

Settings are in fcitx-configtool:

fcitx-configtool

Install Korean Input Method (Hangul)

Korean Input installation is the easiest and fastest. The problem is that there are few Korean fonts in FreeBSD ports and many of them don’t have a maintainer. Therefore, there is a risk of their removal from ports.

First, install Korean input method:

sudo pkg install ko-fcitx-hangul ## Korean IM

The most trusty way is to install Google fonts. The package is really big (200-300 megabytes), but it contains many modern and old syllables. Of course, you can install other fonts that you choose from the ports:

sudo pkg install noto-kr ## Korean google fonts. Over 1.5 million archaic Hangul syllables and 11,172 modern syllables

After fcitx core and language input method installations are passed, we need to reboot:

sudo shutdown -r now

Enable/Disable Korean input can be done with Ctrl+Space shortcut.

I plan to study Korean in the future. Therefore, I can’t give image examples.

Settings are in fcitx-configtool:

fcitx-configtool

How to switch between input methods

If you have installed several input methods (for example, Chinese, and Korean together), you can switch between them using Ctrl+Shift shortcut.

fcitx-configtool in FreeBSD with enabled input methods
fcitx-configtool: Chinese (Sunpinyin), Japanese (Mozc) and Korean (Hangul) input methods are enabled

Google Noto Fonts familiy in FreeBSD

If you are interested in Google Noto Fonts family (Even archaic hieroglyphs, letters, syllables presented, therefore these packages are very large in size) here are all ports:

x11-fonts/noto (meta package, contains all listed below packages):
  - x11-fonts/noto-basic (was noto-lite): basic fonts set with emoji
  - x11-fonts/noto-extra: extra fonts set
  - x11-fonts/noto-jp: Japanese fonts set
  - x11-fonts/noto-kr: Korean fonts set
  - x11-fonts/noto-sc: Simplified Chinese fonts set
  - x11-fonts/noto-tc: Traditional Chinese fonts set

Leave a Reply

Your email address will not be published.