Monospace font in Tamil locale

Monospace font in Tamil locale

Published by Arun Isaac on

In other languages: தமிழ்

Tags: tamil

Monospace fonts are not displayed correctly in a Tamil locale. How do you fix this?

In GNU/Linux, many applications pick fonts using fontconfig. But, in a Tamil locale, fontconfig does not pick English monospace fonts correctly. This is because, in a Tamil locale, fontconfig prioritizes the Tamil language and picks a Tamil font over an English monospace font. So, monospace fonts are not displayed where they should be. To fix this, we need to tell fontconfig to prioritize English fonts instead of trying to infer the language from the locale. We do this by setting the FC_LANG environment variable to en.

export FC_LANG=en

The FC_LANG environment variable is documented in a fontconfig man page.

Here are a couple of screenshots of the Nyxt web browser illustrating the difference before and after setting the FC_LANG.

Nyxt browser showing a GitHub page with code rendered in a proportional font

Figure 1: When FC_LANG is not set, code is incorrectly rendered in a proportional font

Nyxt browser showing a GitHub page with code rendered in a monospace font

Figure 2: When FC_LANG is set, code is correctly rendered in a monospace font