You might be wondering why would anyone want to do this? In certain languages, an ill-chosen font can make the content exceedingly difficult to read. Let's imagine if this article had its content rendered in Monoton font, the experience would be a veritable nightmare for the reader.
In Thai language, there are 2 versions of the same character set, one with looped head, and another with non-looped head similar to Latin characters. The non-looped version was developed for art designing purposes. But the looped head version is the official one, and everyone writes in this form. Let's see their differences from the images below:
As a native Thai speaker, I can confirm that the looped version is 100x easier to read. Windows and Android use the looped version for their UI. On Linux, it seems only Ubuntu uses the looped version in its enhanced GNOME version. I don't know about other DEs, as I have never used anything other than GNOME on Linux. Unfortunately, the vanilla GNOME that you find on Fedora, openSUSE, Arch, etc. don't get the same level of attention to Thai language like the one on Ubuntu.
Without further ado, let's see how to fix it. Note, the fix method below would work with any language. I use Thai language as an example because I am... Thai 😂
---
Download and Install the Required Font
The easiest way to download and install the required font for free and legally is from your distro's package manager.
- For openSUSE, the package is: thai-fonts.
- For Arch, the package is: texlive-langother.
- For what it's worth, the package on Ubuntu is: fonts-tlwg.
For example, on openSUSE, you can install thai-fonts
package using YaST Software Management (similar to Synaptic on Ubuntu). Or you can use zypper
to install the package in the terminal:
sudo zypper install thai-fonts
Edit the Config File
1. You will have to head to /etc/fonts/conf.d
using the system's file manager.
2. Searching this folder for the files that contain this string in their filenames: family-prefer-lang-specific
. Except, the CJK (Chinese Japanese Korean) language, the file you'll need to edit is xx-family-prefer-lang-specific.conf
, of which the leading xx
in the filename is the number. Mine is 59
, so it's 59-family-prefer-lang-specific.conf
. It could be a different number on your system, it doesn't matter.
3. Open the file, it should look like this:
4. In my case for Thai language, I put this code in the file between <fontconfig>
and </fontconfig>
:
<match>
<test name="lang" compare="contains">
<string>th</string>
</test>
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend">
<string>Waree</string>
</edit>
</match>
<test name="lang" compare="contains">
is to test for the language that containsth
in its string, so other languages won't be affected by this change, e.g. English, which is my system UI language. Thelang
string uses RFC-3066-style. You can see the string of your language from the list here.<test name="family">
is to test for the font family we want to replace with our custom font. Since GNOME's default font is Cantarell, which is belonged tosans-serif
family, I putsans-serif
in the string tag to replace it.<edit name="family" mode="prepend">
is to specify the font name I want to replace the default font. In this case, it'sWaree
from the package (thai-fonts
) that I downloaded and installed previously.
Now, your config file should look similar to this:
You can see more info about this config file here.
5. Reboot your machine. After this, the config file should be loaded. And you should be able to notice immediately. For example, in your file manager:
---
This is it for today. I hope you all like it! Please let me know in the comment section down below. Bye 💨
---
Cover Photo by Kelly Sikkema on Unsplash